Class: UnleashedClient::SalesOrder

Inherits:
Object
  • Object
show all
Defined in:
lib/unleashed_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, api_id:, query: "") ⇒ SalesOrder

Returns a new instance of SalesOrder.



9
10
11
12
13
14
# File 'lib/unleashed_client.rb', line 9

def initialize(api_key:, api_id:, query: "")
  @api_key = api_key
  @api_id = api_id
  @query = query
  @unleashed_model = 'SalesOrders'
end

Instance Attribute Details

#api_idObject (readonly)

Returns the value of attribute api_id.



7
8
9
# File 'lib/unleashed_client.rb', line 7

def api_id
  @api_id
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



7
8
9
# File 'lib/unleashed_client.rb', line 7

def api_key
  @api_key
end

Instance Method Details

#get_details(guid:) ⇒ Object



31
32
33
# File 'lib/unleashed_client.rb', line 31

def get_details(guid:)
  HTTP::Client.get_with_guid(api_id: @api_id, api_key: @api_key, query: @query, unleashed_model: @unleashed_model, guid: guid)
end

#get_first_200Object



21
22
23
24
# File 'lib/unleashed_client.rb', line 21

def get_first_200
  response = HTTP::Client.get(api_id: @api_id, api_key: @api_key, query: @query, unleashed_model: @unleashed_model)
  response["Items"]
end

#get_number_of_pagesObject



16
17
18
19
# File 'lib/unleashed_client.rb', line 16

def get_number_of_pages
  response = HTTP::Client.get(api_id: @api_id, api_key: @api_key, query: @query, unleashed_model: @unleashed_model)
  response["Pagination"]["NumberOfPages"]
end

#get_orders_from_page(page_number:) ⇒ Object



26
27
28
29
# File 'lib/unleashed_client.rb', line 26

def get_orders_from_page(page_number:)
  response = HTTP::Client.get_from_page(api_id: @api_id, api_key: @api_key, query: @query, unleashed_model: @unleashed_model, page_number: page_number)
  response["Items"]
end