Class: Io::Flow::V0::Models::TrackingLabelEventUpserted

Inherits:
Event
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ TrackingLabelEventUpserted

Returns a new instance of TrackingLabelEventUpserted.



42109
42110
42111
42112
42113
42114
42115
42116
42117
42118
42119
42120
42121
42122
42123
42124
42125
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42109

def initialize(incoming={})
  super(:discriminator => Event::Types::TRACKING_LABEL_EVENT_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :address, :carrier, :carrier_timestamp, :carrier_tracking_number, :flow_tracking_number, :status], 'TrackingLabelEventUpserted')
  @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))
  @carrier = HttpClient::Preconditions.assert_class('carrier', opts.delete(:carrier), String)
  @carrier_timestamp = HttpClient::Preconditions.assert_class('carrier_timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:carrier_timestamp)), DateTime)
  @carrier_tracking_number = HttpClient::Preconditions.assert_class('carrier_tracking_number', opts.delete(:carrier_tracking_number), String)
  @flow_tracking_number = HttpClient::Preconditions.assert_class('flow_tracking_number', opts.delete(:flow_tracking_number), String)
  @status = HttpClient::Preconditions.assert_class('status', opts.delete(:status), String)
  @delivery_estimate = (x = opts.delete(:delivery_estimate); x.nil? ? nil : HttpClient::Preconditions.assert_class('delivery_estimate', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
  @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def address
  @address
end

#carrierObject (readonly)

Returns the value of attribute carrier.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def carrier
  @carrier
end

#carrier_timestampObject (readonly)

Returns the value of attribute carrier_timestamp.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def carrier_timestamp
  @carrier_timestamp
end

#carrier_tracking_numberObject (readonly)

Returns the value of attribute carrier_tracking_number.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def carrier_tracking_number
  @carrier_tracking_number
end

#delivery_estimateObject (readonly)

Returns the value of attribute delivery_estimate.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def delivery_estimate
  @delivery_estimate
end

#descriptionObject (readonly)

Returns the value of attribute description.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def description
  @description
end

#event_idObject (readonly)

Returns the value of attribute event_id.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def event_id
  @event_id
end

#flow_tracking_numberObject (readonly)

Returns the value of attribute flow_tracking_number.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def flow_tracking_number
  @flow_tracking_number
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def order_number
  @order_number
end

#organizationObject (readonly)

Returns the value of attribute organization.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def organization
  @organization
end

#statusObject (readonly)

Returns the value of attribute status.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def status
  @status
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



42107
42108
42109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42107

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



42131
42132
42133
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42131

def copy(incoming={})
  TrackingLabelEventUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



42135
42136
42137
42138
42139
42140
42141
42142
42143
42144
42145
42146
42147
42148
42149
42150
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42135

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :address => address.to_hash,
    :carrier => carrier,
    :carrier_timestamp => carrier_timestamp,
    :carrier_tracking_number => carrier_tracking_number,
    :flow_tracking_number => flow_tracking_number,
    :status => status,
    :delivery_estimate => delivery_estimate,
    :description => description,
    :order_number => order_number
  }
end

#to_jsonObject



42127
42128
42129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 42127

def to_json
  JSON.dump(to_hash)
end