Class: Io::Flow::V0::Models::ConsumerInvoice
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ConsumerInvoice
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
The consumer invoice represents the details of a set of items from a given order. This may represent either the full order or a partial fulfillment.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#billing_address ⇒ Object
readonly
Returns the value of attribute billing_address.
-
#center ⇒ Object
readonly
Returns the value of attribute center.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#documents ⇒ Object
readonly
Returns the value of attribute documents.
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#payments ⇒ Object
readonly
Returns the value of attribute payments.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tax_registration ⇒ Object
readonly
Returns the value of attribute tax_registration.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ConsumerInvoice
constructor
A new instance of ConsumerInvoice.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ConsumerInvoice
Returns a new instance of ConsumerInvoice.
21077 21078 21079 21080 21081 21082 21083 21084 21085 21086 21087 21088 21089 21090 21091 21092 21093 21094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21077 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :status, :date, :key, :order, :entity, :payments, :destination, :lines, :documents, :attributes], 'ConsumerInvoice') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceStatus) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceStatus.apply(x)) @date = HttpClient::Preconditions.assert_class('date', HttpClient::Helper.to_date_time_iso8601(opts.delete(:date)), DateTime) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceOrderSummary) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceOrderSummary.new(x)) @entity = (x = opts.delete(:entity); x.is_a?(::Io::Flow::V0::Models::MerchantOfRecordEntity) ? x : ::Io::Flow::V0::Models::MerchantOfRecordEntity.new(x)) @payments = HttpClient::Preconditions.assert_class('payments', opts.delete(:payments), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoicePayment) ? x : ::Io::Flow::V0::Models::ConsumerInvoicePayment.new(x)) } @center = (x = opts.delete(:center); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceCenterReference) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceCenterReference.new(x))) @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::OrderAddress) ? x : ::Io::Flow::V0::Models::OrderAddress.new(x)) @billing_address = (x = opts.delete(:billing_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.new(x))) @lines = HttpClient::Preconditions.assert_class('lines', opts.delete(:lines), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceLine) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceLine.from_json(x)) } @documents = HttpClient::Preconditions.assert_class('documents', opts.delete(:documents), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ConsumerInvoiceDocument) ? x : ::Io::Flow::V0::Models::ConsumerInvoiceDocument.new(x)) } @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } @tax_registration = (x = opts.delete(:tax_registration); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::TaxRegistration) ? x : ::Io::Flow::V0::Models::TaxRegistration.new(x))) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def attributes @attributes end |
#billing_address ⇒ Object (readonly)
Returns the value of attribute billing_address.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def billing_address @billing_address end |
#center ⇒ Object (readonly)
Returns the value of attribute center.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def center @center end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def date @date end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def destination @destination end |
#documents ⇒ Object (readonly)
Returns the value of attribute documents.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def documents @documents end |
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def entity @entity end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def key @key end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def lines @lines end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def order @order end |
#payments ⇒ Object (readonly)
Returns the value of attribute payments.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def payments @payments end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def status @status end |
#tax_registration ⇒ Object (readonly)
Returns the value of attribute tax_registration.
21075 21076 21077 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21075 def tax_registration @tax_registration end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
21100 21101 21102 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21100 def copy(incoming={}) ConsumerInvoice.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
21104 21105 21106 21107 21108 21109 21110 21111 21112 21113 21114 21115 21116 21117 21118 21119 21120 21121 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21104 def to_hash { :id => id, :status => status.value, :date => date, :key => key, :order => order.to_hash, :entity => entity.to_hash, :payments => payments.map { |o| o.to_hash }, :center => center.nil? ? nil : center.to_hash, :destination => destination.to_hash, :billing_address => billing_address.nil? ? nil : billing_address.to_hash, :lines => lines.map { |o| o.to_hash }, :documents => documents.map { |o| o.to_hash }, :attributes => attributes, :tax_registration => tax_registration.nil? ? nil : tax_registration.to_hash } end |
#to_json ⇒ Object
21096 21097 21098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21096 def to_json JSON.dump(to_hash) end |