Class: Tradeking::Client

Inherits:
Object
  • Object
show all
Includes:
Http::Request, Http::Response
Defined in:
lib/tradeking/client.rb

Instance Method Summary collapse

Methods included from Http::Response

#response

Methods included from Http::Request

#delete, #get, #post, #put, #request

Constructor Details

#initialize(options = {}) ⇒ Client

Creates an instance of an API client

Attributes

  • options - Access credentials hash, required keys are: consumer_key, consumer_secret, access_token, access_token_secret

Example

client = Tradeking::Client.new(“abc”, consumer_secret: “abc”, access_token: “abc”, access_token_secret: “abc”)



16
17
18
19
20
21
22
23
24
# File 'lib/tradeking/client.rb', line 16

def initialize options = {}
  @consumer_key = options[:consumer_key]
  @consumer_secret = options[:consumer_secret]
  @access_token = options[:access_token]
  @access_token_secret = options[:access_token_secret]

  @oauth_consumer = OAuth::Consumer.new @consumer_key, @consumer_secret, { :site => API_URI }
  @oauth_access_token = OAuth::AccessToken.new(@oauth_consumer, @access_token, @access_token_secret)
end