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



194
195
196
# File 'lib/portage/ucp/value_objects.rb', line 194

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item

Returns:

  • (Object)

    the current value of item



194
195
196
# File 'lib/portage/ucp/value_objects.rb', line 194

def item
  @item
end

#quantityObject (readonly)

Returns the value of attribute quantity

Returns:

  • (Object)

    the current value of quantity



194
195
196
# File 'lib/portage/ucp/value_objects.rb', line 194

def quantity
  @quantity
end

#totalsObject (readonly)

Returns the value of attribute totals

Returns:

  • (Object)

    the current value of totals



194
195
196
# File 'lib/portage/ucp/value_objects.rb', line 194

def totals
  @totals
end

Instance Method Details

#to_wire_hObject



195
196
197
198
# File 'lib/portage/ucp/value_objects.rb', line 195

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