Class: Io::Flow::V0::Models::NotificationUpserted

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 = {}) ⇒ NotificationUpserted

Returns a new instance of NotificationUpserted.



39357
39358
39359
39360
39361
39362
39363
39364
39365
39366
39367
39368
39369
39370
39371
39372
39373
39374
39375
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39357

def initialize(incoming={})
  super(:discriminator => Event::Types::NOTIFICATION_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :notification_id, :carrier_tracking_number, :flow_tracking_number, :destination, :origin, :carrier, :service, :order, :package], 'NotificationUpserted')
  @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)
  @notification_id = HttpClient::Preconditions.assert_class('notification_id', opts.delete(:notification_id), String)
  @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)
  @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))
  @origin = (x = opts.delete(:origin); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))
  @carrier = HttpClient::Preconditions.assert_class('carrier', opts.delete(:carrier), String)
  @service = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String)
  @order = HttpClient::Preconditions.assert_class('order', opts.delete(:order), String)
  @order_identifier = (x = opts.delete(:order_identifier); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_identifier', x, String))
  @fulfillment_key = (x = opts.delete(:fulfillment_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('fulfillment_key', x, String))
  @package = (x = opts.delete(:package); x.is_a?(::Io::Flow::V0::Models::ShippingLabelPackage) ? x : ::Io::Flow::V0::Models::ShippingLabelPackage.new(x))
end

Instance Attribute Details

#carrierObject (readonly)

Returns the value of attribute carrier.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def carrier
  @carrier
end

#carrier_tracking_numberObject (readonly)

Returns the value of attribute carrier_tracking_number.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def carrier_tracking_number
  @carrier_tracking_number
end

#destinationObject (readonly)

Returns the value of attribute destination.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def destination
  @destination
end

#event_idObject (readonly)

Returns the value of attribute event_id.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def event_id
  @event_id
end

#flow_tracking_numberObject (readonly)

Returns the value of attribute flow_tracking_number.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def flow_tracking_number
  @flow_tracking_number
end

#fulfillment_keyObject (readonly)

Returns the value of attribute fulfillment_key.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def fulfillment_key
  @fulfillment_key
end

#notification_idObject (readonly)

Returns the value of attribute notification_id.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def notification_id
  @notification_id
end

#orderObject (readonly)

Returns the value of attribute order.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def order
  @order
end

#order_identifierObject (readonly)

Returns the value of attribute order_identifier.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def order_identifier
  @order_identifier
end

#organizationObject (readonly)

Returns the value of attribute organization.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def organization
  @organization
end

#originObject (readonly)

Returns the value of attribute origin.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def origin
  @origin
end

#packageObject (readonly)

Returns the value of attribute package.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def package
  @package
end

#serviceObject (readonly)

Returns the value of attribute service.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def service
  @service
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



39355
39356
39357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39355

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39381
39382
39383
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39381

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

#subtype_to_hashObject



39385
39386
39387
39388
39389
39390
39391
39392
39393
39394
39395
39396
39397
39398
39399
39400
39401
39402
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39385

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :notification_id => notification_id,
    :carrier_tracking_number => carrier_tracking_number,
    :flow_tracking_number => flow_tracking_number,
    :destination => destination.to_hash,
    :origin => origin.to_hash,
    :carrier => carrier,
    :service => service,
    :order => order,
    :order_identifier => order_identifier,
    :fulfillment_key => fulfillment_key,
    :package => package.to_hash
  }
end

#to_jsonObject



39377
39378
39379
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39377

def to_json
  JSON.dump(to_hash)
end