Class: MpApi::Item
- Inherits:
-
Object
- Object
- MpApi::Item
- Defined in:
- lib/mp_api/item.rb
Instance Attribute Summary collapse
-
#category_id ⇒ Object
readonly
Returns the value of attribute category_id.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#unit_price ⇒ Object
readonly
Returns the value of attribute unit_price.
Instance Method Summary collapse
-
#initialize(id:, title:, description:, category_id: nil, quantity: nil, unit_price: nil) ⇒ Item
constructor
A new instance of Item.
- #to_api_hash ⇒ Object
Constructor Details
#initialize(id:, title:, description:, category_id: nil, quantity: nil, unit_price: nil) ⇒ Item
Returns a new instance of Item.
5 6 7 8 9 10 11 12 |
# File 'lib/mp_api/item.rb', line 5 def initialize(id:, title:, description:, category_id: nil, quantity: nil, unit_price: nil) @id = id @title = title @description = description @category_id = category_id @quantity = quantity @unit_price = unit_price end |
Instance Attribute Details
#category_id ⇒ Object (readonly)
Returns the value of attribute category_id.
4 5 6 |
# File 'lib/mp_api/item.rb', line 4 def category_id @category_id end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/mp_api/item.rb', line 4 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/mp_api/item.rb', line 4 def id @id end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
4 5 6 |
# File 'lib/mp_api/item.rb', line 4 def quantity @quantity end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/mp_api/item.rb', line 4 def title @title end |
#unit_price ⇒ Object (readonly)
Returns the value of attribute unit_price.
4 5 6 |
# File 'lib/mp_api/item.rb', line 4 def unit_price @unit_price end |
Instance Method Details
#to_api_hash ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mp_api/item.rb', line 14 def to_api_hash { id: id, title: title, description: description, category_id: category_id, quantity: quantity, unit_price: unit_price } end |