class Io::Flow::V0::Models::ShippingLabel

Represents information about a carrier-generated shipping label used by a shipper to transport a package from a given origin to destination

Attributes

attributes[R]
carrier_tracking_number[R]
carrier_tracking_number_url[R]
cost[R]
cost_estimate_source[R]
created_at[R]
destination[R]
flow_tracking_number[R]
flow_tracking_number_url[R]
fulfillment_key[R]
hop[R]
id[R]
invoice[R]
label[R]
label_request_method[R]
label_trigger_method[R]
order[R]
order_identifier[R]
origin[R]
package[R]
reference_id[R]
return_[R]
service[R]
shipment_recipient[R]
updated_at[R]
window[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 66414
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :carrier_tracking_number, :carrier_tracking_number_url, :destination, :flow_tracking_number, :flow_tracking_number_url, :origin, :service, :window, :shipment_recipient], 'ShippingLabel')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @hop = (x = opts.delete(:hop); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingLabelHopSummary) ? x : ::Io::Flow::V0::Models::ShippingLabelHopSummary.new(x)))
  @reference_id = (x = opts.delete(:reference_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('reference_id', x, String))
  @attributes = HttpClient::Preconditions.assert_class('attributes', (x = opts.delete(:attributes); x.nil? ? {} : x), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }
  @carrier_tracking_number = HttpClient::Preconditions.assert_class('carrier_tracking_number', opts.delete(:carrier_tracking_number), String)
  @carrier_tracking_number_url = HttpClient::Preconditions.assert_class('carrier_tracking_number_url', opts.delete(:carrier_tracking_number_url), String)
  @cost_estimate_source = (x = opts.delete(:cost_estimate_source); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CostEstimateSource) ? x : ::Io::Flow::V0::Models::CostEstimateSource.apply(x)))
  @cost = (x = opts.delete(:cost); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)))
  @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))
  @flow_tracking_number = HttpClient::Preconditions.assert_class('flow_tracking_number', opts.delete(:flow_tracking_number), String)
  @flow_tracking_number_url = HttpClient::Preconditions.assert_class('flow_tracking_number_url', opts.delete(:flow_tracking_number_url), String)
  @origin = (x = opts.delete(:origin); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))
  @service = (x = opts.delete(:service); x.is_a?(::Io::Flow::V0::Models::ServiceSummary) ? x : ::Io::Flow::V0::Models::ServiceSummary.new(x))
  @window = (x = opts.delete(:window); x.is_a?(::Io::Flow::V0::Models::DatetimeRange) ? x : ::Io::Flow::V0::Models::DatetimeRange.new(x))
  @label = (x = opts.delete(:label); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingLabelDocument) ? x : ::Io::Flow::V0::Models::ShippingLabelDocument.new(x)))
  @invoice = (x = opts.delete(:invoice); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingLabelDocument) ? x : ::Io::Flow::V0::Models::ShippingLabelDocument.new(x)))
  @return_ = (x = opts.delete(:return); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingLabelDocument) ? x : ::Io::Flow::V0::Models::ShippingLabelDocument.new(x)))
  @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LabelOrderSummary) ? x : ::Io::Flow::V0::Models::LabelOrderSummary.new(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))
  @shipment_recipient = (x = opts.delete(:shipment_recipient); x.is_a?(::Io::Flow::V0::Models::ShipmentRecipient) ? x : ::Io::Flow::V0::Models::ShipmentRecipient.apply(x))
  @label_request_method = (x = opts.delete(:label_request_method); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LabelRequestMethod) ? x : ::Io::Flow::V0::Models::LabelRequestMethod.apply(x)))
  @label_trigger_method = (x = opts.delete(:label_trigger_method); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LabelTriggerMethod) ? x : ::Io::Flow::V0::Models::LabelTriggerMethod.apply(x)))
  @created_at = (x = opts.delete(:created_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @updated_at = (x = opts.delete(:updated_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('updated_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 66449
def copy(incoming={})
  ShippingLabel.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 66453
def to_hash
  {
    :id => id,
    :hop => hop.nil? ? nil : hop.to_hash,
    :reference_id => reference_id,
    :attributes => attributes,
    :carrier_tracking_number => carrier_tracking_number,
    :carrier_tracking_number_url => carrier_tracking_number_url,
    :cost_estimate_source => cost_estimate_source.nil? ? nil : cost_estimate_source.value,
    :cost => cost.nil? ? nil : cost.to_hash,
    :destination => destination.to_hash,
    :flow_tracking_number => flow_tracking_number,
    :flow_tracking_number_url => flow_tracking_number_url,
    :origin => origin.to_hash,
    :service => service.to_hash,
    :window => window.to_hash,
    :label => label.nil? ? nil : label.to_hash,
    :invoice => invoice.nil? ? nil : invoice.to_hash,
    :return => return_.nil? ? nil : return_.to_hash,
    :order => order.nil? ? nil : order.to_hash,
    :package => package.nil? ? nil : package.to_hash,
    :order_identifier => order_identifier,
    :fulfillment_key => fulfillment_key,
    :shipment_recipient => shipment_recipient.value,
    :label_request_method => label_request_method.nil? ? nil : label_request_method.value,
    :label_trigger_method => label_trigger_method.nil? ? nil : label_trigger_method.value,
    :created_at => created_at,
    :updated_at => updated_at
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 66445
def to_json
  JSON.dump(to_hash)
end