class Io::Flow::V0::Models::DetailedShippingLabelForm

Attributes

attributes[R]
delivered_duty[R]
destination[R]
direction[R]
order_number[R]
origin[R]
package[R]
service[R]
shipment_recipient[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 39487
def initialize(incoming={})
  super(:discriminator => ShippingLabelForm::Types::DETAILED_SHIPPING_LABEL_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:destination, :origin, :package, :order_number], 'DetailedShippingLabelForm')
  @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))
  @package = (x = opts.delete(:package); x.is_a?(::Io::Flow::V0::Models::ShippingLabelPackage) ? x : ::Io::Flow::V0::Models::ShippingLabelPackage.new(x))
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
  @delivered_duty = (x = opts.delete(:delivered_duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x)))
  @direction = (x = opts.delete(:direction); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Direction) ? x : ::Io::Flow::V0::Models::Direction.apply(x)))
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @service = (x = opts.delete(:service); x.nil? ? nil : HttpClient::Preconditions.assert_class('service', x, String))
  @shipment_recipient = (x = opts.delete(:shipment_recipient); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShipmentRecipient) ? x : ::Io::Flow::V0::Models::ShipmentRecipient.apply(x)))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 39506
def copy(incoming={})
  DetailedShippingLabelForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 39510
def subtype_to_hash
  {
    :destination => destination.to_hash,
    :origin => origin.to_hash,
    :package => package.to_hash,
    :attributes => attributes.nil? ? nil : attributes,
    :delivered_duty => delivered_duty.nil? ? nil : delivered_duty.value,
    :direction => direction.nil? ? nil : direction.value,
    :order_number => order_number,
    :service => service,
    :shipment_recipient => shipment_recipient.nil? ? nil : shipment_recipient.value
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 39502
def to_json
  JSON.dump(to_hash)
end