Class: Io::Flow::V0::Models::ConsumerInvoiceLineForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ConsumerInvoiceLineForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
ConsumerInvoiceLineDiscountForm, ConsumerInvoiceLineFormUndefinedType, ConsumerInvoiceLineItemForm, ConsumerInvoiceLineShippingForm
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 = {}) ⇒ ConsumerInvoiceLineForm
constructor
A new instance of ConsumerInvoiceLineForm.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ConsumerInvoiceLineForm
Returns a new instance of ConsumerInvoiceLineForm.
10421 10422 10423 10424 10425 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10421 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discriminator], 'ConsumerInvoiceLineForm') @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
10419 10420 10421 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10419 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10435 def ConsumerInvoiceLineForm.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[consumer_invoice_line_form] requires a field named 'discriminator'" end case discriminator when Types::CONSUMER_INVOICE_LINE_ITEM_FORM; ConsumerInvoiceLineItemForm.new(hash) when Types::CONSUMER_INVOICE_LINE_DISCOUNT_FORM; ConsumerInvoiceLineDiscountForm.new(hash) when Types::CONSUMER_INVOICE_LINE_SHIPPING_FORM; ConsumerInvoiceLineShippingForm.new(hash) else ConsumerInvoiceLineFormUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
10427 10428 10429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10427 def subtype_to_hash raise 'Cannot serialize an instance of consumer_invoice_line_form directly - must use one of the specific types: consumer_invoice_line_item_form, consumer_invoice_line_discount_form, consumer_invoice_line_shipping_form' end |
#to_hash ⇒ Object
10431 10432 10433 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10431 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |