Class: Io::Flow::V0::Models::ShippingNotificationForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShippingNotificationForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
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.
Direct Known Subclasses
DetailedShippingNotificationForm, ShippingNotificationFormUndefinedType, SinglePackageShippingNotificationForm
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
-
#discriminator ⇒ Object
readonly
Returns the value of attribute discriminator.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(incoming = {}) ⇒ ShippingNotificationForm
constructor
A new instance of ShippingNotificationForm.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingNotificationForm
Returns a new instance of ShippingNotificationForm.
9581 9582 9583 9584 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9581 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator) || 'detailed_shipping_notification_form', String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
9579 9580 9581 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9579 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9594 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) else ShippingNotificationFormUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
9586 9587 9588 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9586 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' end |
#to_hash ⇒ Object
9590 9591 9592 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9590 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |