Class: Io::Flow::V0::Models::OrderUpserted
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#customer ⇒ Object
readonly
Returns the value of attribute customer.
-
#delivered_duty ⇒ Object
readonly
Returns the value of attribute delivered_duty.
-
#deliveries ⇒ Object
readonly
Returns the value of attribute deliveries.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#discount ⇒ Object
readonly
Returns the value of attribute discount.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#experience_id ⇒ Object
readonly
Returns the value of attribute experience_id.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#geo ⇒ Object
readonly
Returns the value of attribute geo.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#merchant_of_record ⇒ Object
readonly
Returns the value of attribute merchant_of_record.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#order_id ⇒ Object
readonly
Returns the value of attribute order_id.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#payments ⇒ Object
readonly
Returns the value of attribute payments.
-
#prices ⇒ Object
readonly
Returns the value of attribute prices.
-
#selections ⇒ Object
readonly
Returns the value of attribute selections.
-
#submitted_at ⇒ Object
readonly
Returns the value of attribute submitted_at.
-
#tax_registration ⇒ Object
readonly
Returns the value of attribute tax_registration.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Attributes inherited from Event
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OrderUpserted
constructor
A new instance of OrderUpserted.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Event
Constructor Details
#initialize(incoming = {}) ⇒ OrderUpserted
Returns a new instance of OrderUpserted.
39125 39126 39127 39128 39129 39130 39131 39132 39133 39134 39135 39136 39137 39138 39139 39140 39141 39142 39143 39144 39145 39146 39147 39148 39149 39150 39151 39152 39153 39154 39155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39125 def initialize(incoming={}) super(:discriminator => Event::Types::ORDER_UPSERTED) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :number, :environment, :experience_id, :expires_at, :customer, :selections, :items, :destination, :deliveries, :prices, :total], 'OrderUpserted') @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String) = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime) @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String) @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @environment = HttpClient::Preconditions.assert_class('environment', opts.delete(:environment), String) @experience_id = HttpClient::Preconditions.assert_class('experience_id', opts.delete(:experience_id), String) @expires_at = HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:expires_at)), DateTime) @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::OrderCustomer) ? x : ::Io::Flow::V0::Models::OrderCustomer.new(x)) @selections = HttpClient::Preconditions.assert_class('selections', opts.delete(:selections), Array).map { |v| HttpClient::Preconditions.assert_class('selections', v, String) } @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LocalizedLineItem) ? x : ::Io::Flow::V0::Models::LocalizedLineItem.new(x)) } @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::OrderAddress) ? x : ::Io::Flow::V0::Models::OrderAddress.new(x)) @deliveries = HttpClient::Preconditions.assert_class('deliveries', opts.delete(:deliveries), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Delivery) ? x : ::Io::Flow::V0::Models::Delivery.from_json(x)) } @prices = HttpClient::Preconditions.assert_class('prices', opts.delete(:prices), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x)) } @order_id = (x = opts.delete(:order_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_id', x, String)) @payments = (x = opts.delete(:payments); x.nil? ? nil : HttpClient::Preconditions.assert_class('payments', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderPayment) ? x : ::Io::Flow::V0::Models::OrderPayment.new(x)) }) @discount = (x = opts.delete(:discount); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))) @delivered_duty = (x = opts.delete(:delivered_duty); x.nil? ? nil : HttpClient::Preconditions.assert_class('delivered_duty', x, String)) @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::LocalizedTotal) ? x : ::Io::Flow::V0::Models::LocalizedTotal.new(x)) @created_at = (x = opts.delete(:created_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @updated_at = (x = opts.delete(:updated_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('updated_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @submitted_at = (x = opts.delete(:submitted_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('submitted_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @lines = (x = opts.delete(:lines); x.nil? ? nil : HttpClient::Preconditions.assert_class('lines', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Line) ? x : ::Io::Flow::V0::Models::Line.new(x)) }) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) @geo = (x = opts.delete(:geo); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderGeo) ? x : ::Io::Flow::V0::Models::OrderGeo.new(x))) @merchant_of_record = (x = opts.delete(:merchant_of_record); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderMerchantOfRecord) ? x : ::Io::Flow::V0::Models::OrderMerchantOfRecord.apply(x))) @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.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def attributes @attributes end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def created_at @created_at end |
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def customer @customer end |
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def delivered_duty @delivered_duty end |
#deliveries ⇒ Object (readonly)
Returns the value of attribute deliveries.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def deliveries @deliveries end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def destination @destination end |
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def discount @discount end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def environment @environment end |
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def event_id @event_id end |
#experience_id ⇒ Object (readonly)
Returns the value of attribute experience_id.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def experience_id @experience_id end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def expires_at @expires_at end |
#geo ⇒ Object (readonly)
Returns the value of attribute geo.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def geo @geo end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def items @items end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def lines @lines end |
#merchant_of_record ⇒ Object (readonly)
Returns the value of attribute merchant_of_record.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def merchant_of_record @merchant_of_record end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def number @number end |
#order_id ⇒ Object (readonly)
Returns the value of attribute order_id.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def order_id @order_id end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def organization @organization end |
#payments ⇒ Object (readonly)
Returns the value of attribute payments.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def payments @payments end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def prices @prices end |
#selections ⇒ Object (readonly)
Returns the value of attribute selections.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def selections @selections end |
#submitted_at ⇒ Object (readonly)
Returns the value of attribute submitted_at.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def submitted_at @submitted_at end |
#tax_registration ⇒ Object (readonly)
Returns the value of attribute tax_registration.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def tax_registration @tax_registration end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def total @total end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
39123 39124 39125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39123 def updated_at @updated_at end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
39161 39162 39163 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39161 def copy(incoming={}) OrderUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
39165 39166 39167 39168 39169 39170 39171 39172 39173 39174 39175 39176 39177 39178 39179 39180 39181 39182 39183 39184 39185 39186 39187 39188 39189 39190 39191 39192 39193 39194 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39165 def subtype_to_hash { :event_id => event_id, :timestamp => , :organization => organization, :number => number, :environment => environment, :experience_id => experience_id, :expires_at => expires_at, :customer => customer.to_hash, :selections => selections, :items => items.map { |o| o.to_hash }, :destination => destination.to_hash, :deliveries => deliveries.map { |o| o.to_hash }, :prices => prices.map { |o| o.to_hash }, :order_id => order_id, :payments => payments.nil? ? nil : payments.map { |o| o.to_hash }, :discount => discount.nil? ? nil : discount.to_hash, :delivered_duty => delivered_duty, :total => total.to_hash, :created_at => created_at, :updated_at => updated_at, :submitted_at => submitted_at, :lines => lines.nil? ? nil : lines.map { |o| o.to_hash }, :attributes => attributes.nil? ? nil : attributes, :geo => geo.nil? ? nil : geo.to_hash, :merchant_of_record => merchant_of_record.nil? ? nil : merchant_of_record.value, :tax_registration => tax_registration.nil? ? nil : tax_registration.to_hash } end |
#to_json ⇒ Object
39157 39158 39159 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39157 def to_json JSON.dump(to_hash) end |