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.



22121
22122
22123
22124
22125
22126
22127
22128
22129
22130
22131
22132
22133
22134
22135
22136
22137
22138
22139
22140
22141
22142
22143
22144
22145
22146
22147
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22121

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 = HttpClient::Preconditions.assert_class('destination', HttpClient::Helper.to_object(opts.delete(:destination)), Hash)
  @origin = HttpClient::Preconditions.assert_class('origin', HttpClient::Helper.to_object(opts.delete(:origin)), Hash)
  @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))
  @direction = (x = opts.delete(:direction); x.nil? ? nil : HttpClient::Preconditions.assert_class('direction', x, String))
  @package = (x = opts.delete(:package); x.nil? ? nil : HttpClient::Preconditions.assert_class('package', HttpClient::Helper.to_object(x), Hash))
  @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.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def carrier
  @carrier
end

#carrier_tracking_numberObject (readonly)

Returns the value of attribute carrier_tracking_number.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def carrier_tracking_number
  @carrier_tracking_number
end

#carrier_tracking_number_urlObject (readonly)

Returns the value of attribute carrier_tracking_number_url.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def carrier_tracking_number_url
  @carrier_tracking_number_url
end

#center_keyObject (readonly)

Returns the value of attribute center_key.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def center_key
  @center_key
end

#commercial_invoiceObject (readonly)

Returns the value of attribute commercial_invoice.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def commercial_invoice
  @commercial_invoice
end

#destinationObject (readonly)

Returns the value of attribute destination.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def destination
  @destination
end

#directionObject (readonly)

Returns the value of attribute direction.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def direction
  @direction
end

#event_idObject (readonly)

Returns the value of attribute event_id.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def event_id
  @event_id
end

#flow_tracking_numberObject (readonly)

Returns the value of attribute flow_tracking_number.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def flow_tracking_number
  @flow_tracking_number
end

#flow_tracking_number_urlObject (readonly)

Returns the value of attribute flow_tracking_number_url.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def flow_tracking_number_url
  @flow_tracking_number_url
end

#fulfillment_keyObject (readonly)

Returns the value of attribute fulfillment_key.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def fulfillment_key
  @fulfillment_key
end

#label_idObject (readonly)

Returns the value of attribute label_id.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def label_id
  @label_id
end

#orderObject (readonly)

Returns the value of attribute order.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def order
  @order
end

#order_identifierObject (readonly)

Returns the value of attribute order_identifier.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def order_identifier
  @order_identifier
end

#organizationObject (readonly)

Returns the value of attribute organization.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def organization
  @organization
end

#originObject (readonly)

Returns the value of attribute origin.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def origin
  @origin
end

#packageObject (readonly)

Returns the value of attribute package.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def package
  @package
end

#pdfObject (readonly)

Returns the value of attribute pdf.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def pdf
  @pdf
end

#pngObject (readonly)

Returns the value of attribute png.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def png
  @png
end

#serviceObject (readonly)

Returns the value of attribute service.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def service
  @service
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def timestamp
  @timestamp
end

#zplObject (readonly)

Returns the value of attribute zpl.



22119
22120
22121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22119

def zpl
  @zpl
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22153
22154
22155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22153

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

#subtype_to_hashObject



22157
22158
22159
22160
22161
22162
22163
22164
22165
22166
22167
22168
22169
22170
22171
22172
22173
22174
22175
22176
22177
22178
22179
22180
22181
22182
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22157

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,
    :origin => origin,
    :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,
    :direction => direction,
    :package => package,
    :order_identifier => order_identifier,
    :fulfillment_key => fulfillment_key
  }
end

#to_jsonObject



22149
22150
22151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22149

def to_json
  JSON.dump(to_hash)
end