Class: Portage::Ucp::LineItem

Inherits:
Data
  • Object
show all
Defined in:
lib/portage/ucp/value_objects.rb

Overview

schemas/shopping/types/line_item.json — id/item/quantity/totals, not a flat product_id/unit_price/total triple.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



34
35
36
# File 'lib/portage/ucp/value_objects.rb', line 34

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item

Returns:

  • (Object)

    the current value of item



34
35
36
# File 'lib/portage/ucp/value_objects.rb', line 34

def item
  @item
end

#quantityObject (readonly)

Returns the value of attribute quantity

Returns:

  • (Object)

    the current value of quantity



34
35
36
# File 'lib/portage/ucp/value_objects.rb', line 34

def quantity
  @quantity
end

#totalsObject (readonly)

Returns the value of attribute totals

Returns:

  • (Object)

    the current value of totals



34
35
36
# File 'lib/portage/ucp/value_objects.rb', line 34

def totals
  @totals
end

Instance Method Details

#to_wire_hObject



35
36
37
38
# File 'lib/portage/ucp/value_objects.rb', line 35

def to_wire_h
  { "id" => id, "item" => item.to_wire_h, "quantity" => quantity,
    "totals" => totals.map(&:to_wire_h) }
end