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

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ TrackingLabelEventUpserted

Returns a new instance of TrackingLabelEventUpserted.



22258
22259
22260
22261
22262
22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22258

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 = HttpClient::Preconditions.assert_class('address', HttpClient::Helper.to_object(opts.delete(:address)), Hash)
  @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

#address ⇒ Object (readonly)

Returns the value of attribute address.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def address
  @address
end

#carrier ⇒ Object (readonly)

Returns the value of attribute carrier.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def carrier
  @carrier
end

#carrier_timestamp ⇒ Object (readonly)

Returns the value of attribute carrier_timestamp.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def carrier_timestamp
  @carrier_timestamp
end

#carrier_tracking_number ⇒ Object (readonly)

Returns the value of attribute carrier_tracking_number.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def carrier_tracking_number
  @carrier_tracking_number
end

#delivery_estimate ⇒ Object (readonly)

Returns the value of attribute delivery_estimate.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def delivery_estimate
  @delivery_estimate
end

#description ⇒ Object (readonly)

Returns the value of attribute description.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def description
  @description
end

#event_id ⇒ Object (readonly)

Returns the value of attribute event_id.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def event_id
  @event_id
end

#flow_tracking_number ⇒ Object (readonly)

Returns the value of attribute flow_tracking_number.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def flow_tracking_number
  @flow_tracking_number
end

#order_number ⇒ Object (readonly)

Returns the value of attribute order_number.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def order_number
  @order_number
end

#organization ⇒ Object (readonly)

Returns the value of attribute organization.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def organization
  @organization
end

#status ⇒ Object (readonly)

Returns the value of attribute status.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def status
  @status
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



22256
22257
22258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22256

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22280
22281
22282
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22280

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

#subtype_to_hash ⇒ Object



22284
22285
22286
22287
22288
22289
22290
22291
22292
22293
22294
22295
22296
22297
22298
22299
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22284

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :address => address,
    :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_json ⇒ Object



22276
22277
22278
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22276

def to_json
  JSON.dump(to_hash)
end