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

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ LabelUpserted

Returns a new instance of LabelUpserted.



11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11980

def initialize(incoming={})
  super(:name => Event::Types::LABEL_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :label_id, :carrier_tracking_number, :flow_tracking_number, :data, :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)
  @flow_tracking_number = HttpClient::Preconditions.assert_class('flow_tracking_number', opts.delete(:flow_tracking_number), String)
  @data = HttpClient::Preconditions.assert_class('data', opts.delete(:data), 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)
  @commercial_invoice = (x = opts.delete(:commercial_invoice); x.nil? ? nil : HttpClient::Preconditions.assert_class('commercial_invoice', 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))
end

Instance Attribute Details

#carrierObject (readonly)

Returns the value of attribute carrier.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def carrier
  @carrier
end

#carrier_tracking_numberObject (readonly)

Returns the value of attribute carrier_tracking_number.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def carrier_tracking_number
  @carrier_tracking_number
end

#commercial_invoiceObject (readonly)

Returns the value of attribute commercial_invoice.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def commercial_invoice
  @commercial_invoice
end

#dataObject (readonly)

Returns the value of attribute data.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def data
  @data
end

#destinationObject (readonly)

Returns the value of attribute destination.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def destination
  @destination
end

#event_idObject (readonly)

Returns the value of attribute event_id.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def event_id
  @event_id
end

#flow_tracking_numberObject (readonly)

Returns the value of attribute flow_tracking_number.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def flow_tracking_number
  @flow_tracking_number
end

#label_idObject (readonly)

Returns the value of attribute label_id.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def label_id
  @label_id
end

#orderObject (readonly)

Returns the value of attribute order.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def order
  @order
end

#organizationObject (readonly)

Returns the value of attribute organization.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def organization
  @organization
end

#originObject (readonly)

Returns the value of attribute origin.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def origin
  @origin
end

#pdfObject (readonly)

Returns the value of attribute pdf.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def pdf
  @pdf
end

#pngObject (readonly)

Returns the value of attribute png.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def png
  @png
end

#serviceObject (readonly)

Returns the value of attribute service.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def service
  @service
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



11978
11979
11980
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11978

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



12005
12006
12007
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12005

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

#subtype_to_hashObject



12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12009

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :label_id => label_id,
    :carrier_tracking_number => carrier_tracking_number,
    :flow_tracking_number => flow_tracking_number,
    :data => data,
    :destination => destination,
    :origin => origin,
    :carrier => carrier,
    :service => service,
    :commercial_invoice => commercial_invoice,
    :pdf => pdf,
    :png => png,
    :order => order
  }
end

#to_jsonObject



12001
12002
12003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12001

def to_json
  JSON.dump(to_hash)
end