Class: Thesslstore::Client
- Inherits:
-
Object
- Object
- Thesslstore::Client
- Includes:
- HTTParty
- Defined in:
- lib/thesslstore/client.rb
Instance Attribute Summary collapse
-
#auth_request ⇒ Object
readonly
Returns the value of attribute auth_request.
Instance Method Summary collapse
- #create_download(options = {}) ⇒ Object
- #create_new_order(options = {}) ⇒ Object
- #create_query(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 19 20 21 22 |
# File 'lib/thesslstore/client.rb', line 14 def initialize( = {}) partner_code = [:partner_code] || Thesslstore.config[:partner_code] || fail("Missing required options: :partner_code") auth_token = [:auth_token] || Thesslstore.config[:auth_token] || fail("Missing required options: :auth_token") @auth_request = Thesslstore::AuthRequest.new({'PartnerCode' => partner_code, 'AuthToken' => auth_token}) self.class.base_uri('https://api.thesslstore.com/rest') # Sets the headers for every request self.class.headers({'Content-Type' => 'application/json; charset=utf-8', 'Accept' => 'application/json'}) end |
Instance Attribute Details
#auth_request ⇒ Object (readonly)
Returns the value of attribute auth_request.
12 13 14 |
# File 'lib/thesslstore/client.rb', line 12 def auth_request @auth_request end |
Instance Method Details
#create_download(options = {}) ⇒ Object
28 29 30 |
# File 'lib/thesslstore/client.rb', line 28 def create_download( = {}) download = Thesslstore::Order::Download.new({AuthRequest: @auth_request}) end |
#create_new_order(options = {}) ⇒ Object
24 25 26 |
# File 'lib/thesslstore/client.rb', line 24 def create_new_order( = {}) new_order = Thesslstore::Order::NewOrder.new({AuthRequest: @auth_request}) end |
#create_query(options = {}) ⇒ Object
32 33 34 |
# File 'lib/thesslstore/client.rb', line 32 def create_query( = {}) query = Thesslstore::Order::Query.new({AuthRequest: @auth_request}) end |