Class: AboutYou::SDK::Model::ProductsEansResult
- Inherits:
-
Object
- Object
- AboutYou::SDK::Model::ProductsEansResult
- Defined in:
- lib/AboutYou/Model/products_ean_result.rb
Overview
this class represents a products ean result model
Instance Attribute Summary collapse
-
#eans_not_found ⇒ Object
Returns the value of attribute eans_not_found.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#page_hash ⇒ Object
Returns the value of attribute page_hash.
-
#products ⇒ Object
Returns the value of attribute products.
Class Method Summary collapse
Instance Attribute Details
#eans_not_found ⇒ Object
Returns the value of attribute eans_not_found.
10 11 12 |
# File 'lib/AboutYou/Model/products_ean_result.rb', line 10 def eans_not_found @eans_not_found end |
#errors ⇒ Object
Returns the value of attribute errors.
12 13 14 |
# File 'lib/AboutYou/Model/products_ean_result.rb', line 12 def errors @errors end |
#page_hash ⇒ Object
Returns the value of attribute page_hash.
11 12 13 |
# File 'lib/AboutYou/Model/products_ean_result.rb', line 11 def page_hash @page_hash end |
#products ⇒ Object
Returns the value of attribute products.
13 14 15 |
# File 'lib/AboutYou/Model/products_ean_result.rb', line 13 def products @products end |
Class Method Details
.create_from_json(json_object, factory) ⇒ Object
Returns static.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/AboutYou/Model/products_ean_result.rb', line 21 def self.create_from_json(json_object, factory) products_ean_result = new products_ean_result.products = [] products_ean_result.eans_not_found = [] products_ean_result.errors = [] products_ean_result.page_hash = json_object['page_hash'] ? json_object['page_hash'] : nil json_object['eans'].each do |json_product| if json_product['error_code'] products_ean_result.errors.push(json_product) products_ean_result.eans_not_found.push(json_product['ean']) next end products_ean_result.products.push(factory.create_product(json_product)) end if json_object['eans'] products_ean_result end |