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.



18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18545

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))
end

Instance Attribute Details

#carrierObject (readonly)

Returns the value of attribute carrier.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def carrier
  @carrier
end

#carrier_tracking_numberObject (readonly)

Returns the value of attribute carrier_tracking_number.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def carrier_tracking_number
  @carrier_tracking_number
end

#carrier_tracking_number_urlObject (readonly)

Returns the value of attribute carrier_tracking_number_url.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def carrier_tracking_number_url
  @carrier_tracking_number_url
end

#commercial_invoiceObject (readonly)

Returns the value of attribute commercial_invoice.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def commercial_invoice
  @commercial_invoice
end

#destinationObject (readonly)

Returns the value of attribute destination.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def destination
  @destination
end

#event_idObject (readonly)

Returns the value of attribute event_id.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def event_id
  @event_id
end

#flow_tracking_numberObject (readonly)

Returns the value of attribute flow_tracking_number.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def flow_tracking_number
  @flow_tracking_number
end

#flow_tracking_number_urlObject (readonly)

Returns the value of attribute flow_tracking_number_url.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def flow_tracking_number_url
  @flow_tracking_number_url
end

#label_idObject (readonly)

Returns the value of attribute label_id.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def label_id
  @label_id
end

#orderObject (readonly)

Returns the value of attribute order.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def order
  @order
end

#organizationObject (readonly)

Returns the value of attribute organization.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def organization
  @organization
end

#originObject (readonly)

Returns the value of attribute origin.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def origin
  @origin
end

#pdfObject (readonly)

Returns the value of attribute pdf.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def pdf
  @pdf
end

#pngObject (readonly)

Returns the value of attribute png.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def png
  @png
end

#serviceObject (readonly)

Returns the value of attribute service.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def service
  @service
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def timestamp
  @timestamp
end

#zplObject (readonly)

Returns the value of attribute zpl.



18543
18544
18545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18543

def zpl
  @zpl
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18572
18573
18574
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18572

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

#subtype_to_hashObject



18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18576

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
  }
end

#to_jsonObject



18568
18569
18570
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18568

def to_json
  JSON.dump(to_hash)
end