Class: Portage::Ucp::Item
- Inherits:
-
Data
- Object
- Data
- Portage::Ucp::Item
- Defined in:
- lib/portage/ucp/value_objects.rb
Overview
Product identity on a line item (schemas/shopping/types/item.json). price
is a bare integer minor-unit amount — the parent object's currency applies.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image_url ⇒ Object
readonly
Returns the value of attribute image_url.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(id:, title:, price:, image_url: nil) ⇒ Item
constructor
A new instance of Item.
- #to_wire_h ⇒ Object
Constructor Details
#initialize(id:, title:, price:, image_url: nil) ⇒ Item
Returns a new instance of Item.
23 |
# File 'lib/portage/ucp/value_objects.rb', line 23 def initialize(id:, title:, price:, image_url: nil) = super |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id
22 23 24 |
# File 'lib/portage/ucp/value_objects.rb', line 22 def id @id end |
#image_url ⇒ Object (readonly)
Returns the value of attribute image_url
22 23 24 |
# File 'lib/portage/ucp/value_objects.rb', line 22 def image_url @image_url end |
#price ⇒ Object (readonly)
Returns the value of attribute price
22 23 24 |
# File 'lib/portage/ucp/value_objects.rb', line 22 def price @price end |
#title ⇒ Object (readonly)
Returns the value of attribute title
22 23 24 |
# File 'lib/portage/ucp/value_objects.rb', line 22 def title @title end |
Instance Method Details
#to_wire_h ⇒ Object
25 26 27 28 29 |
# File 'lib/portage/ucp/value_objects.rb', line 25 def to_wire_h h = { "id" => id, "title" => title, "price" => price } h["image_url"] = image_url if image_url h end |