Class: Portage::Ucp::Cart

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

Overview

schemas/shopping/cart.json — requires ucp/id/line_items/currency/totals. The "ucp" envelope is added centrally by Portage::Ucp::WireEnvelope, not stored on the value object itself.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#currencyObject (readonly)

Returns the value of attribute currency

Returns:

  • (Object)

    the current value of currency



55
56
57
# File 'lib/portage/ucp/value_objects.rb', line 55

def currency
  @currency
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



55
56
57
# File 'lib/portage/ucp/value_objects.rb', line 55

def id
  @id
end

#line_itemsObject (readonly)

Returns the value of attribute line_items

Returns:

  • (Object)

    the current value of line_items



55
56
57
# File 'lib/portage/ucp/value_objects.rb', line 55

def line_items
  @line_items
end

#totalsObject (readonly)

Returns the value of attribute totals

Returns:

  • (Object)

    the current value of totals



55
56
57
# File 'lib/portage/ucp/value_objects.rb', line 55

def totals
  @totals
end

Instance Method Details

#to_wire_hObject



56
57
58
59
# File 'lib/portage/ucp/value_objects.rb', line 56

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