Class: TophatterMerchant::Variation
- Defined in:
- lib/tophatter_merchant/variation.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#deleted_at ⇒ Object
Returns the value of attribute deleted_at.
-
#disabled_at ⇒ Object
Returns the value of attribute disabled_at.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#product_identifier ⇒ Object
Returns the value of attribute product_identifier.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#size ⇒ Object
Returns the value of attribute size.
Class Method Summary collapse
-
.create(params) ⇒ Object
ap Variation.create(product_identifier: ‘6631A’, identifier: ‘6631A-GRAY’, color: ‘Gray’, quantity: 33).to_h.
-
.retrieve(identifier) ⇒ Object
ap TophatterMerchant::Variation.retrieve(‘FOOBAR-R’).to_h.
-
.schema ⇒ Object
ap TophatterMerchant::Variation.schema.
-
.update(identifier, data) ⇒ Object
ap TophatterMerchant::Variation.update(‘FOOBAR-R’, quantity: 100).to_h.
Instance Method Summary collapse
Methods inherited from Resource
attr_accessor, #attributes, attributes, #attributes=, #initialize, #persisted?, #to_h
Constructor Details
This class inherits a constructor from TophatterMerchant::Resource
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
3 4 5 |
# File 'lib/tophatter_merchant/variation.rb', line 3 def color @color end |
#created_at ⇒ Object
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/tophatter_merchant/variation.rb', line 3 def created_at @created_at end |
#deleted_at ⇒ Object
Returns the value of attribute deleted_at.
3 4 5 |
# File 'lib/tophatter_merchant/variation.rb', line 3 def deleted_at @deleted_at end |
#disabled_at ⇒ Object
Returns the value of attribute disabled_at.
3 4 5 |
# File 'lib/tophatter_merchant/variation.rb', line 3 def disabled_at @disabled_at end |
#identifier ⇒ Object
Returns the value of attribute identifier.
3 4 5 |
# File 'lib/tophatter_merchant/variation.rb', line 3 def identifier @identifier end |
#product_identifier ⇒ Object
Returns the value of attribute product_identifier.
3 4 5 |
# File 'lib/tophatter_merchant/variation.rb', line 3 def product_identifier @product_identifier end |
#quantity ⇒ Object
Returns the value of attribute quantity.
3 4 5 |
# File 'lib/tophatter_merchant/variation.rb', line 3 def quantity @quantity end |
#size ⇒ Object
Returns the value of attribute size.
3 4 5 |
# File 'lib/tophatter_merchant/variation.rb', line 3 def size @size end |
Class Method Details
.create(params) ⇒ Object
ap Variation.create(product_identifier: ‘6631A’, identifier: ‘6631A-GRAY’, color: ‘Gray’, quantity: 33).to_h
23 24 25 |
# File 'lib/tophatter_merchant/variation.rb', line 23 def create(params) Variation.new post(url: "#{path}.json", params: params) end |
.retrieve(identifier) ⇒ Object
ap TophatterMerchant::Variation.retrieve(‘FOOBAR-R’).to_h
18 19 20 |
# File 'lib/tophatter_merchant/variation.rb', line 18 def retrieve(identifier) Variation.new get(url: "#{path}/retrieve.json", params: { identifier: identifier }) end |
.schema ⇒ Object
ap TophatterMerchant::Variation.schema
13 14 15 |
# File 'lib/tophatter_merchant/variation.rb', line 13 def schema get(url: "#{path}/schema.json") end |
Instance Method Details
#id ⇒ Object
7 8 9 |
# File 'lib/tophatter_merchant/variation.rb', line 7 def id created_at.present? ? identifier : nil end |