Class: Kin::Product
- Inherits:
-
Object
- Object
- Kin::Product
- Defined in:
- lib/product.rb
Instance Attribute Summary collapse
-
#brand ⇒ Object
Returns the value of attribute brand.
-
#care_instructions ⇒ Object
Returns the value of attribute care_instructions.
-
#description ⇒ Object
Returns the value of attribute description.
-
#fit_notes ⇒ Object
Returns the value of attribute fit_notes.
-
#id ⇒ Object
Returns the value of attribute id.
-
#image_urls ⇒ Object
Returns the value of attribute image_urls.
-
#material ⇒ Object
Returns the value of attribute material.
-
#name ⇒ Object
Returns the value of attribute name.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#product ⇒ Object
Returns the value of attribute product.
-
#skus ⇒ Object
Returns the value of attribute skus.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #get_images ⇒ Object
-
#initialize(name = '', product = '', id = 0, brand = '', url = '', image_urls = {}, skus = [], description = '', fit_notes = '', material = '', care_instructions = '', origin = '') ⇒ Product
constructor
A new instance of Product.
Constructor Details
#initialize(name = '', product = '', id = 0, brand = '', url = '', image_urls = {}, skus = [], description = '', fit_notes = '', material = '', care_instructions = '', origin = '') ⇒ Product
Returns a new instance of Product.
9 10 11 12 13 |
# File 'lib/product.rb', line 9 def initialize(obj={}) raise "Invalid Argument" unless obj.is_a?(Hash) initialize(obj['name'], obj['product'], obj['id'], obj['url'], obj['image_urls'], obj['skus'], obj['description'], obj['fit_notes'], obj['material'], obj['care_instructions'], obj['origin']) end |
Instance Attribute Details
#brand ⇒ Object
Returns the value of attribute brand.
6 7 8 |
# File 'lib/product.rb', line 6 def brand @brand end |
#care_instructions ⇒ Object
Returns the value of attribute care_instructions.
6 7 8 |
# File 'lib/product.rb', line 6 def care_instructions @care_instructions end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/product.rb', line 6 def description @description end |
#fit_notes ⇒ Object
Returns the value of attribute fit_notes.
6 7 8 |
# File 'lib/product.rb', line 6 def fit_notes @fit_notes end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/product.rb', line 6 def id @id end |
#image_urls ⇒ Object
Returns the value of attribute image_urls.
6 7 8 |
# File 'lib/product.rb', line 6 def image_urls @image_urls end |
#material ⇒ Object
Returns the value of attribute material.
6 7 8 |
# File 'lib/product.rb', line 6 def material @material end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/product.rb', line 6 def name @name end |
#origin ⇒ Object
Returns the value of attribute origin.
6 7 8 |
# File 'lib/product.rb', line 6 def origin @origin end |
#product ⇒ Object
Returns the value of attribute product.
6 7 8 |
# File 'lib/product.rb', line 6 def product @product end |
#skus ⇒ Object
Returns the value of attribute skus.
6 7 8 |
# File 'lib/product.rb', line 6 def skus @skus end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/product.rb', line 6 def url @url end |
Instance Method Details
#get_images ⇒ Object
31 32 33 |
# File 'lib/product.rb', line 31 def get_images @image_urls.values.flatten if image_urls.is_a?(Hash) end |