Class: Portage::Ucp::FulfillmentEvent

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

Overview

schemas/shopping/types/fulfillment_event.json — append-only shipment event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, occurred_at:, type:, line_items:, tracking_number: nil, tracking_url: nil, carrier: nil, description: nil) ⇒ FulfillmentEvent

Returns a new instance of FulfillmentEvent.



123
124
125
126
# File 'lib/portage/ucp/value_objects.rb', line 123

def initialize(id:, occurred_at:, type:, line_items:, tracking_number: nil, tracking_url: nil, carrier: nil,
               description: nil)
  super
end

Instance Attribute Details

#carrierObject (readonly)

Returns the value of attribute carrier

Returns:

  • (Object)

    the current value of carrier



121
122
123
# File 'lib/portage/ucp/value_objects.rb', line 121

def carrier
  @carrier
end

#descriptionObject (readonly)

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



121
122
123
# File 'lib/portage/ucp/value_objects.rb', line 121

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



121
122
123
# File 'lib/portage/ucp/value_objects.rb', line 121

def id
  @id
end

#line_itemsObject (readonly)

Returns the value of attribute line_items

Returns:

  • (Object)

    the current value of line_items



121
122
123
# File 'lib/portage/ucp/value_objects.rb', line 121

def line_items
  @line_items
end

#occurred_atObject (readonly)

Returns the value of attribute occurred_at

Returns:

  • (Object)

    the current value of occurred_at



121
122
123
# File 'lib/portage/ucp/value_objects.rb', line 121

def occurred_at
  @occurred_at
end

#tracking_numberObject (readonly)

Returns the value of attribute tracking_number

Returns:

  • (Object)

    the current value of tracking_number



121
122
123
# File 'lib/portage/ucp/value_objects.rb', line 121

def tracking_number
  @tracking_number
end

#tracking_urlObject (readonly)

Returns the value of attribute tracking_url

Returns:

  • (Object)

    the current value of tracking_url



121
122
123
# File 'lib/portage/ucp/value_objects.rb', line 121

def tracking_url
  @tracking_url
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



121
122
123
# File 'lib/portage/ucp/value_objects.rb', line 121

def type
  @type
end

Instance Method Details

#to_wire_hObject



128
129
130
131
132
133
134
135
# File 'lib/portage/ucp/value_objects.rb', line 128

def to_wire_h
  h = { "id" => id, "occurred_at" => occurred_at, "type" => type, "line_items" => line_items }
  h["tracking_number"] = tracking_number if tracking_number
  h["tracking_url"] = tracking_url if tracking_url
  h["carrier"] = carrier if carrier
  h["description"] = description if description
  h
end