NameError:正在调用的模块上的未初始化常量

时间:2016-02-22 04:26:57

标签: ruby irb

我正在尝试通过IRB测试运行一个小宝石。我在跑:test = Test::Client.new(token: xxx)。我收到此错误:NameError: uninitialized constant Test。你能指点我正确的方向吗?感谢您的帮助。

require 'rubygems'
require 'httparty'

module Test
  class Client
    include HTTParty
    API_ENDPOINT = "https://api.example.com/v1"
    def initialize(options={})
      self.class.base_uri API_ENDPOINT
      self.class.headers "Accept" => "application/json", "authorization" => "Bearer #{options[:token]}"
    end
  end
end

0 个答案:

没有答案