class Io::Flow::V0::Models::ShippingLabelForm
Different models for forms to create shipping labels
Attributes
discriminator[R]
Public Class Methods
from_json(hash)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15511 def ShippingLabelForm.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_label_form] requires a field named 'discriminator'" end case discriminator when Types::DETAILED_SHIPPING_LABEL_FORM; DetailedShippingLabelForm.new(hash) when Types::SUMMARY_SHIPPING_LABEL_FORM; SummaryShippingLabelForm.new(hash) when Types::BRIDGE_SHIPPING_LABEL_FORM; BridgeShippingLabelForm.new(hash) else ShippingLabelFormUndefinedType.new(:discriminator => discriminator) end end
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15498 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator) || 'detailed_shipping_label_form', String) end
Public Instance Methods
subtype_to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15503 def subtype_to_hash raise 'Cannot serialize an instance of shipping_label_form directly - must use one of the specific types: detailed_shipping_label_form, summary_shipping_label_form, bridge_shipping_label_form' end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 15507 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end