Class: Genba::Client::Products
- Inherits:
-
Object
- Object
- Genba::Client::Products
- Defined in:
- lib/genba/client/products.rb
Overview
Products client
Instance Method Summary collapse
- #get_changes(from_date: nil, country_iso: nil, include_meta: false, params: {}, headers: {}) ⇒ Object
- #get_products(sku_id: nil, country_iso: nil, include_meta: false, headers: {}) ⇒ Object
- #get_removed(from_date: nil, country_iso: nil, params: {}, headers: {}) ⇒ Object
-
#initialize(client) ⇒ Products
constructor
A new instance of Products.
Constructor Details
#initialize(client) ⇒ Products
Returns a new instance of Products.
7 8 9 |
# File 'lib/genba/client/products.rb', line 7 def initialize(client) @client = client end |
Instance Method Details
#get_changes(from_date: nil, country_iso: nil, include_meta: false, params: {}, headers: {}) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/genba/client/products.rb', line 21 def get_changes(from_date: nil, country_iso: nil, include_meta: false, params: {}, headers: {}) payload = params.merge( countryISO: country_iso, includeMeta: ).select { |_, v| !v.nil? } payload[:fromDate] = from_date.strftime('%FT%T') if from_date @client.rest_get_with_token('/product/changes', payload, headers) end |
#get_products(sku_id: nil, country_iso: nil, include_meta: false, headers: {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/genba/client/products.rb', line 11 def get_products(sku_id: nil, country_iso: nil, include_meta: false, headers: {}) payload = { skuId: sku_id, countryISO: country_iso, includeMeta: }.select { |_, v| !v.nil? } @client.rest_get_with_token('/product', payload, headers) end |
#get_removed(from_date: nil, country_iso: nil, params: {}, headers: {}) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/genba/client/products.rb', line 30 def get_removed(from_date: nil, country_iso: nil, params: {}, headers: {}) payload = params.merge( countryISO: country_iso, customerAccountId: @client.customer_account_id ).select { |_, v| !v.nil? } payload[:fromDate] = from_date.strftime('%FT%T') if from_date @client.rest_get_with_token('/product/removed', payload, headers) end |