Class: AboutYou::SDK::Model::ProductsResult
- Inherits:
-
Object
- Object
- AboutYou::SDK::Model::ProductsResult
- Includes:
- AbstractModel
- Defined in:
- lib/AboutYou/Model/products_result.rb
Overview
This class represents a products result model
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#ids_not_found ⇒ Object
Returns the value of attribute ids_not_found.
-
#page_hash ⇒ Object
Returns the value of attribute page_hash.
-
#products ⇒ Object
Returns the value of attribute products.
Attributes included from AbstractModel
Class Method Summary collapse
Instance Method Summary collapse
-
#products_not_found ⇒ Object
Integer[] array of product ids.
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
14 15 16 |
# File 'lib/AboutYou/Model/products_result.rb', line 14 def errors @errors end |
#ids_not_found ⇒ Object
Returns the value of attribute ids_not_found.
12 13 14 |
# File 'lib/AboutYou/Model/products_result.rb', line 12 def ids_not_found @ids_not_found end |
#page_hash ⇒ Object
Returns the value of attribute page_hash.
13 14 15 |
# File 'lib/AboutYou/Model/products_result.rb', line 13 def page_hash @page_hash end |
#products ⇒ Object
Returns the value of attribute products.
15 16 17 |
# File 'lib/AboutYou/Model/products_result.rb', line 15 def products @products end |
Class Method Details
.create_from_json(json_object, factory) ⇒ Object
Returns static.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/AboutYou/Model/products_result.rb', line 23 def self.create_from_json(json_object, factory) products_result = new products_result.page_hash = json_object['page_hash'] ? json_object['page_hash'] : nil products_result.errors = [] products_result.ids_not_found = [] products_result.products = {} if json_object['ids'] json_object['ids'].each do |key, json_product| if json_product['error_code'] products_result.ids_not_found.push(key) products_result.errors.push(json_product) next end products_result.products[Integer(key)] = factory.create_product( json_product ) end end products_result end |
Instance Method Details
#products_not_found ⇒ Object
Returns integer[] array of product ids.
50 51 52 |
# File 'lib/AboutYou/Model/products_result.rb', line 50 def products_not_found ids_not_found end |