Class: Thesslstore::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/thesslstore/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  partner_code  = options[:partner_code] || Thesslstore.config[:partner_code] || fail("Missing required options: :partner_code")
  auth_token    = options[: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_requestObject (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(options = {})
  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(options = {})
  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(options = {})
  query = Thesslstore::Order::Query.new({AuthRequest: @auth_request})
end