Class: Portage::Ucp::Total

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

Overview

One cost-breakdown entry (schemas/shopping/types/total.json). amount is a signed integer in the parent object's currency's minor units.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, amount:, display_text: nil) ⇒ Total

Returns a new instance of Total.



11
# File 'lib/portage/ucp/value_objects.rb', line 11

def initialize(type:, amount:, display_text: nil) = super

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount

Returns:

  • (Object)

    the current value of amount



10
11
12
# File 'lib/portage/ucp/value_objects.rb', line 10

def amount
  @amount
end

#display_textObject (readonly)

Returns the value of attribute display_text

Returns:

  • (Object)

    the current value of display_text



10
11
12
# File 'lib/portage/ucp/value_objects.rb', line 10

def display_text
  @display_text
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



10
11
12
# File 'lib/portage/ucp/value_objects.rb', line 10

def type
  @type
end

Instance Method Details

#to_wire_hObject



13
14
15
16
17
# File 'lib/portage/ucp/value_objects.rb', line 13

def to_wire_h
  h = { "type" => type, "amount" => amount }
  h["display_text"] = display_text if display_text
  h
end