class Io::Flow::V0::Models::ShippingNotificationForm

Form for information about a client-facilitated shipment where the shipping label and fulfillment was not handled by Flow. For merchant-of-record and tracking purposes, clients doing their own shipping will need to notify Flow of shipped packages.

Attributes

discriminator[R]

Public Class Methods

from_json(hash) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15578
def ShippingNotificationForm.from_json(hash)
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
  discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
  if discriminator.empty?
    raise "Union type[shipping_notification_form] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::DETAILED_SHIPPING_NOTIFICATION_FORM; DetailedShippingNotificationForm.new(hash)
    when Types::SINGLE_PACKAGE_SHIPPING_NOTIFICATION_FORM; SinglePackageShippingNotificationForm.new(hash)
    when Types::SUMMARY_SHIPPING_NOTIFICATION_FORM; SummaryShippingNotificationForm.new(hash)
    else ShippingNotificationFormUndefinedType.new(:discriminator => discriminator)
  end
end
new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15565
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator) || 'detailed_shipping_notification_form', String)
end

Public Instance Methods

subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15570
def subtype_to_hash
  raise 'Cannot serialize an instance of shipping_notification_form directly - must use one of the specific types: detailed_shipping_notification_form, single_package_shipping_notification_form, summary_shipping_notification_form'
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15574
def to_hash
  subtype_to_hash.merge(:discriminator => @discriminator)
end