Class: Io::Flow::V0::Models::LabelUpserted

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

Returns a new instance of LabelUpserted.



37100
37101
37102
37103
37104
37105
37106
37107
37108
37109
37110
37111
37112
37113
37114
37115
37116
37117
37118
37119
37120
37121
37122
37123
37124
37125
37126
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37100

def initialize(incoming={})
  super(:discriminator => Event::Types::LABEL_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :label_id, :carrier_tracking_number, :commercial_invoice, :flow_tracking_number, :destination, :origin, :carrier, :service], 'LabelUpserted')
  @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)
  @label_id = HttpClient::Preconditions.assert_class('label_id', opts.delete(:label_id), String)
  @carrier_tracking_number = HttpClient::Preconditions.assert_class('carrier_tracking_number', opts.delete(:carrier_tracking_number), String)
  @commercial_invoice = HttpClient::Preconditions.assert_class('commercial_invoice', opts.delete(:commercial_invoice), 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)
  @zpl = (x = opts.delete(:zpl); x.nil? ? nil : HttpClient::Preconditions.assert_class('zpl', x, String))
  @pdf = (x = opts.delete(:pdf); x.nil? ? nil : HttpClient::Preconditions.assert_class('pdf', x, String))
  @png = (x = opts.delete(:png); x.nil? ? nil : HttpClient::Preconditions.assert_class('png', x, String))
  @order = (x = opts.delete(:order); x.nil? ? nil : HttpClient::Preconditions.assert_class('order', x, String))
  @carrier_tracking_number_url = (x = opts.delete(:carrier_tracking_number_url); x.nil? ? nil : HttpClient::Preconditions.assert_class('carrier_tracking_number_url', x, String))
  @flow_tracking_number_url = (x = opts.delete(:flow_tracking_number_url); x.nil? ? nil : HttpClient::Preconditions.assert_class('flow_tracking_number_url', x, String))
  @center_key = (x = opts.delete(:center_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('center_key', x, String))
  @recipient = (x = opts.delete(:recipient); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShipmentRecipient) ? x : ::Io::Flow::V0::Models::ShipmentRecipient.apply(x)))
  @package = (x = opts.delete(:package); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingLabelPackage) ? x : ::Io::Flow::V0::Models::ShippingLabelPackage.new(x)))
  @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))
end

Instance Attribute Details

#carrierObject (readonly)

Returns the value of attribute carrier.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def carrier
  @carrier
end

#carrier_tracking_numberObject (readonly)

Returns the value of attribute carrier_tracking_number.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def carrier_tracking_number
  @carrier_tracking_number
end

#carrier_tracking_number_urlObject (readonly)

Returns the value of attribute carrier_tracking_number_url.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def carrier_tracking_number_url
  @carrier_tracking_number_url
end

#center_keyObject (readonly)

Returns the value of attribute center_key.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def center_key
  @center_key
end

#commercial_invoiceObject (readonly)

Returns the value of attribute commercial_invoice.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def commercial_invoice
  @commercial_invoice
end

#destinationObject (readonly)

Returns the value of attribute destination.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def destination
  @destination
end

#event_idObject (readonly)

Returns the value of attribute event_id.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def event_id
  @event_id
end

#flow_tracking_numberObject (readonly)

Returns the value of attribute flow_tracking_number.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def flow_tracking_number
  @flow_tracking_number
end

#flow_tracking_number_urlObject (readonly)

Returns the value of attribute flow_tracking_number_url.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def flow_tracking_number_url
  @flow_tracking_number_url
end

#fulfillment_keyObject (readonly)

Returns the value of attribute fulfillment_key.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def fulfillment_key
  @fulfillment_key
end

#label_idObject (readonly)

Returns the value of attribute label_id.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def label_id
  @label_id
end

#orderObject (readonly)

Returns the value of attribute order.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def order
  @order
end

#order_identifierObject (readonly)

Returns the value of attribute order_identifier.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def order_identifier
  @order_identifier
end

#organizationObject (readonly)

Returns the value of attribute organization.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def organization
  @organization
end

#originObject (readonly)

Returns the value of attribute origin.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def origin
  @origin
end

#packageObject (readonly)

Returns the value of attribute package.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def package
  @package
end

#pdfObject (readonly)

Returns the value of attribute pdf.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def pdf
  @pdf
end

#pngObject (readonly)

Returns the value of attribute png.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def png
  @png
end

#recipientObject (readonly)

Returns the value of attribute recipient.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def recipient
  @recipient
end

#serviceObject (readonly)

Returns the value of attribute service.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def service
  @service
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def timestamp
  @timestamp
end

#zplObject (readonly)

Returns the value of attribute zpl.



37098
37099
37100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37098

def zpl
  @zpl
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37132
37133
37134
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37132

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

#subtype_to_hashObject



37136
37137
37138
37139
37140
37141
37142
37143
37144
37145
37146
37147
37148
37149
37150
37151
37152
37153
37154
37155
37156
37157
37158
37159
37160
37161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37136

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :label_id => label_id,
    :carrier_tracking_number => carrier_tracking_number,
    :commercial_invoice => commercial_invoice,
    :flow_tracking_number => flow_tracking_number,
    :destination => destination.to_hash,
    :origin => origin.to_hash,
    :carrier => carrier,
    :service => service,
    :zpl => zpl,
    :pdf => pdf,
    :png => png,
    :order => order,
    :carrier_tracking_number_url => carrier_tracking_number_url,
    :flow_tracking_number_url => flow_tracking_number_url,
    :center_key => center_key,
    :recipient => recipient.nil? ? nil : recipient.value,
    :package => package.nil? ? nil : package.to_hash,
    :order_identifier => order_identifier,
    :fulfillment_key => fulfillment_key
  }
end

#to_jsonObject



37128
37129
37130
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37128

def to_json
  JSON.dump(to_hash)
end