class Io::Flow::V0::Models::SummaryShippingNotificationForm

Form for minimal information needed for a client-facilitated shipment where the shipping label and fulfillment was not handled by Flow.

Attributes

carrier_tracking_number[R]
items[R]
key[R]
order_number[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 69383
def initialize(incoming={})
  super(:discriminator => ShippingNotificationForm::Types::SUMMARY_SHIPPING_NOTIFICATION_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:order_number, :items, :service, :carrier_tracking_number], 'SummaryShippingNotificationForm')
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LineItemForm) ? x : ::Io::Flow::V0::Models::LineItemForm.new(x)) }
  @service = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String)
  @carrier_tracking_number = HttpClient::Preconditions.assert_class('carrier_tracking_number', opts.delete(:carrier_tracking_number), String)
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', 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 69399
def copy(incoming={})
  SummaryShippingNotificationForm.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 69403
def subtype_to_hash
  {
    :order_number => order_number,
    :items => items.map { |o| o.to_hash },
    :service => service,
    :carrier_tracking_number => carrier_tracking_number,
    :key => key,
    :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 69395
def to_json
  JSON.dump(to_hash)
end