Class: Tradeking::Client
- Inherits:
-
Object
- Object
- Tradeking::Client
- Includes:
- Http::Request, Http::Response
- Defined in:
- lib/tradeking/client.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
Creates an instance of an API client.
Methods included from Http::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 = {} @consumer_key = [:consumer_key] @consumer_secret = [:consumer_secret] @access_token = [:access_token] @access_token_secret = [: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 |