Class: Genba::Client::Products
- Inherits:
-
Object
- Object
- Genba::Client::Products
- Defined in:
- lib/genba/client/products.rb
Instance Method Summary collapse
-
#get(sku_id, headers: {}) ⇒ Object
Return information about a product.
-
#initialize(client) ⇒ Products
constructor
A new instance of Products.
-
#list(country_code: nil, include_meta: nil, from_date: nil, deleted: nil, continuation_token: nil, headers: {}) ⇒ Object
Gets a collection of available products.
Constructor Details
#initialize(client) ⇒ Products
Returns a new instance of Products.
6 7 8 |
# File 'lib/genba/client/products.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#get(sku_id, headers: {}) ⇒ Object
Return information about a product
11 12 13 14 15 16 |
# File 'lib/genba/client/products.rb', line 11 def get(sku_id, headers: {}) payload = { }.select { |_, v| !v.nil? } @client.rest_get_with_token("/products/#{sku_id}", payload, headers) end |
#list(country_code: nil, include_meta: nil, from_date: nil, deleted: nil, continuation_token: nil, headers: {}) ⇒ Object
Gets a collection of available products
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/genba/client/products.rb', line 19 def list(country_code: nil, include_meta: nil, from_date: nil, deleted: nil, continuation_token: nil, headers: {}) payload = { countryCode: country_code, includeMeta: , fromDate: from_date, deleted: deleted, continuationtoken: continuation_token }.select { |_, v| !v.nil? } @client.rest_get_with_token('/products', payload, headers) end |