Class: LabelMe::Order::LineItem
- Inherits:
-
Object
- Object
- LabelMe::Order::LineItem
- Defined in:
- lib/label_me/order/line_item.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#number ⇒ Object
Returns the value of attribute number.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#unit_price ⇒ Object
Returns the value of attribute unit_price.
Instance Method Summary collapse
- #===(other) ⇒ Object
-
#initialize(row) ⇒ LineItem
constructor
A new instance of LineItem.
- #to_hash ⇒ Object
Constructor Details
#initialize(row) ⇒ LineItem
Returns a new instance of LineItem.
4 5 6 7 8 9 |
# File 'lib/label_me/order/line_item.rb', line 4 def initialize(row) @number = row.line_item_id.to_i @quantity = row.line_item_quantity.to_i @unit_price = row.line_item_unit_price.to_i @code = row.line_item_code end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
14 15 16 |
# File 'lib/label_me/order/line_item.rb', line 14 def code @code end |
#number ⇒ Object
Returns the value of attribute number.
11 12 13 |
# File 'lib/label_me/order/line_item.rb', line 11 def number @number end |
#quantity ⇒ Object
Returns the value of attribute quantity.
12 13 14 |
# File 'lib/label_me/order/line_item.rb', line 12 def quantity @quantity end |
#unit_price ⇒ Object
Returns the value of attribute unit_price.
13 14 15 |
# File 'lib/label_me/order/line_item.rb', line 13 def unit_price @unit_price end |
Instance Method Details
#===(other) ⇒ Object
25 26 27 |
# File 'lib/label_me/order/line_item.rb', line 25 def ===(other) self.number == other.number end |
#to_hash ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/label_me/order/line_item.rb', line 16 def to_hash { number: number, quantity: quantity, unit_price: unit_price, code: code } end |