Class: Io::Flow::V0::Models::DetailedShippingLabelForm

Inherits:
ShippingLabelForm show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from ShippingLabelForm

#discriminator

Instance Method Summary collapse

Methods inherited from ShippingLabelForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ DetailedShippingLabelForm

Returns a new instance of DetailedShippingLabelForm.



29564
29565
29566
29567
29568
29569
29570
29571
29572
29573
29574
29575
29576
29577
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29564

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], '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 = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, 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

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



29562
29563
29564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29562

def attributes
  @attributes
end

#delivered_dutyObject (readonly)

Returns the value of attribute delivered_duty.



29562
29563
29564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29562

def delivered_duty
  @delivered_duty
end

#destinationObject (readonly)

Returns the value of attribute destination.



29562
29563
29564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29562

def destination
  @destination
end

#directionObject (readonly)

Returns the value of attribute direction.



29562
29563
29564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29562

def direction
  @direction
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



29562
29563
29564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29562

def order_number
  @order_number
end

#originObject (readonly)

Returns the value of attribute origin.



29562
29563
29564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29562

def origin
  @origin
end

#packageObject (readonly)

Returns the value of attribute package.



29562
29563
29564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29562

def package
  @package
end

#serviceObject (readonly)

Returns the value of attribute service.



29562
29563
29564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29562

def service
  @service
end

#shipment_recipientObject (readonly)

Returns the value of attribute shipment_recipient.



29562
29563
29564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29562

def shipment_recipient
  @shipment_recipient
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29583
29584
29585
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29583

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

#subtype_to_hashObject



29587
29588
29589
29590
29591
29592
29593
29594
29595
29596
29597
29598
29599
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29587

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_jsonObject



29579
29580
29581
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29579

def to_json
  JSON.dump(to_hash)
end