Class: Kin::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/product.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#brandObject

Returns the value of attribute brand.



6
7
8
# File 'lib/product.rb', line 6

def brand
  @brand
end

#care_instructionsObject

Returns the value of attribute care_instructions.



6
7
8
# File 'lib/product.rb', line 6

def care_instructions
  @care_instructions
end

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'lib/product.rb', line 6

def description
  @description
end

#fit_notesObject

Returns the value of attribute fit_notes.



6
7
8
# File 'lib/product.rb', line 6

def fit_notes
  @fit_notes
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/product.rb', line 6

def id
  @id
end

#image_urlsObject

Returns the value of attribute image_urls.



6
7
8
# File 'lib/product.rb', line 6

def image_urls
  @image_urls
end

#materialObject

Returns the value of attribute material.



6
7
8
# File 'lib/product.rb', line 6

def material
  @material
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/product.rb', line 6

def name
  @name
end

#originObject

Returns the value of attribute origin.



6
7
8
# File 'lib/product.rb', line 6

def origin
  @origin
end

#productObject

Returns the value of attribute product.



6
7
8
# File 'lib/product.rb', line 6

def product
  @product
end

#skusObject

Returns the value of attribute skus.



6
7
8
# File 'lib/product.rb', line 6

def skus
  @skus
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/product.rb', line 6

def url
  @url
end

Instance Method Details

#get_imagesObject



31
32
33
# File 'lib/product.rb', line 31

def get_images
  @image_urls.values.flatten if image_urls.is_a?(Hash)
end