Class: Dugway::Item
- Inherits:
-
Struct
- Object
- Struct
- Dugway::Item
- Defined in:
- lib/dugway/cart.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#option ⇒ Object
Returns the value of attribute option.
-
#product ⇒ Object
Returns the value of attribute product.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#unit_price ⇒ Object
Returns the value of attribute unit_price.
Instance Method Summary collapse
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
120 121 122 |
# File 'lib/dugway/cart.rb', line 120 def id @id end |
#name ⇒ Object
Returns the value of attribute name
120 121 122 |
# File 'lib/dugway/cart.rb', line 120 def name @name end |
#option ⇒ Object
Returns the value of attribute option
120 121 122 |
# File 'lib/dugway/cart.rb', line 120 def option @option end |
#product ⇒ Object
Returns the value of attribute product
120 121 122 |
# File 'lib/dugway/cart.rb', line 120 def product @product end |
#quantity ⇒ Object
Returns the value of attribute quantity
120 121 122 |
# File 'lib/dugway/cart.rb', line 120 def quantity @quantity end |
#unit_price ⇒ Object
Returns the value of attribute unit_price
120 121 122 |
# File 'lib/dugway/cart.rb', line 120 def unit_price @unit_price end |
Instance Method Details
#as_json(options = nil) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/dugway/cart.rb', line 125 def as_json(=nil) { :id => id, :name => name, :price => price, :unit_price => unit_price, :shipping => 0.0, :tax => 0.0, :total => price, :quantity => quantity, :product => product['permalink'], :option => option['id'] } end |
#price ⇒ Object
121 122 123 |
# File 'lib/dugway/cart.rb', line 121 def price unit_price * quantity end |