Class: Io::Flow::V0::Models::DetailedShippingNotificationForm

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

Overview

Detailed form for information about a client-facilitated shipment where the shipping label and fulfillment was not handled by Flow.

Instance Attribute Summary collapse

Attributes inherited from ShippingNotificationForm

#discriminator

Instance Method Summary collapse

Methods inherited from ShippingNotificationForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ DetailedShippingNotificationForm

Returns a new instance of DetailedShippingNotificationForm.



39532
39533
39534
39535
39536
39537
39538
39539
39540
39541
39542
39543
39544
39545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39532

def initialize(incoming={})
  super(:discriminator => ShippingNotificationForm::Types::DETAILED_SHIPPING_NOTIFICATION_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:carrier_tracking_number, :destination, :order_number, :package, :service], 'DetailedShippingNotificationForm')
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
  @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 })
  @carrier_tracking_number = HttpClient::Preconditions.assert_class('carrier_tracking_number', opts.delete(:carrier_tracking_number), String)
  @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @package = (x = opts.delete(:package); x.is_a?(::Io::Flow::V0::Models::ShippingLabelPackage) ? x : ::Io::Flow::V0::Models::ShippingLabelPackage.new(x))
  @service = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String)
  @origin = (x = opts.delete(:origin); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)))
  @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.



39530
39531
39532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39530

def attributes
  @attributes
end

#carrier_tracking_numberObject (readonly)

Returns the value of attribute carrier_tracking_number.



39530
39531
39532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39530

def carrier_tracking_number
  @carrier_tracking_number
end

#destinationObject (readonly)

Returns the value of attribute destination.



39530
39531
39532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39530

def destination
  @destination
end

#keyObject (readonly)

Returns the value of attribute key.



39530
39531
39532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39530

def key
  @key
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



39530
39531
39532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39530

def order_number
  @order_number
end

#originObject (readonly)

Returns the value of attribute origin.



39530
39531
39532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39530

def origin
  @origin
end

#packageObject (readonly)

Returns the value of attribute package.



39530
39531
39532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39530

def package
  @package
end

#serviceObject (readonly)

Returns the value of attribute service.



39530
39531
39532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39530

def service
  @service
end

#shipment_recipientObject (readonly)

Returns the value of attribute shipment_recipient.



39530
39531
39532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39530

def shipment_recipient
  @shipment_recipient
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



39551
39552
39553
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39551

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

#subtype_to_hashObject



39555
39556
39557
39558
39559
39560
39561
39562
39563
39564
39565
39566
39567
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39555

def subtype_to_hash
  {
    :key => key,
    :attributes => attributes.nil? ? nil : attributes,
    :carrier_tracking_number => carrier_tracking_number,
    :destination => destination.to_hash,
    :order_number => order_number,
    :package => package.to_hash,
    :service => service,
    :origin => origin.nil? ? nil : origin.to_hash,
    :shipment_recipient => shipment_recipient.nil? ? nil : shipment_recipient.value
  }
end

#to_jsonObject



39547
39548
39549
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39547

def to_json
  JSON.dump(to_hash)
end