Class: Akeneo::ProductModelService
- Inherits:
-
ServiceBase
- Object
- ServiceBase
- Akeneo::ProductModelService
- Defined in:
- lib/akeneo/product_model_service.rb
Constant Summary
Constants inherited from ServiceBase
ServiceBase::API_VERSION, ServiceBase::DEFAULT_PAGINATION_LIMIT, ServiceBase::DEFAULT_PAGINATION_TYPE
Constants included from Cache
Instance Method Summary collapse
Methods inherited from ServiceBase
Methods included from Cache
disabled=, #get_request, prepended
Constructor Details
This class inherits a constructor from Akeneo::ServiceBase
Instance Method Details
#all(with_family: nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/akeneo/product_model_service.rb', line 13 def all(with_family: nil) Enumerator.new do |product_models| path = "/product-models?#{pagination_param}&#{limit_param}" path += search_with_family_param(with_family) if with_family loop do response = get_request(path) extract_collection_items(response).each { |product_model| product_models << product_model } path = extract_next_page_path(response) break unless path end end end |
#create_or_update(code, options) ⇒ Object
27 28 29 |
# File 'lib/akeneo/product_model_service.rb', line 27 def create_or_update(code, ) patch_request("/product-models/#{code}", body: .to_json) end |
#find(id) ⇒ Object
7 8 9 10 11 |
# File 'lib/akeneo/product_model_service.rb', line 7 def find(id) response = get_request("/product-models/#{id}") response.parsed_response if response.success? end |