Class: Io::Flow::V0::Models::OrderUpserted
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#customer ⇒ Object
readonly
Returns the value of attribute customer.
-
#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.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#prices ⇒ Object
readonly
Returns the value of attribute prices.
-
#selections ⇒ Object
readonly
Returns the value of attribute selections.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
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.
13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13202 def initialize(incoming={}) super(:name => 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 = HttpClient::Preconditions.assert_class('customer', HttpClient::Helper.to_object(opts.delete(:customer)), Hash) @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| HttpClient::Preconditions.assert_class('items', HttpClient::Helper.to_object(v), Hash) } @destination = HttpClient::Preconditions.assert_class('destination', HttpClient::Helper.to_object(opts.delete(:destination)), Hash) @deliveries = HttpClient::Preconditions.assert_class('deliveries', opts.delete(:deliveries), Array).map { |v| HttpClient::Preconditions.assert_class('deliveries', HttpClient::Helper.to_object(v), Hash) } @prices = HttpClient::Preconditions.assert_class('prices', opts.delete(:prices), Array).map { |v| HttpClient::Preconditions.assert_class('prices', HttpClient::Helper.to_object(v), Hash) } @discount = (x = opts.delete(:discount); x.nil? ? nil : HttpClient::Preconditions.assert_class('discount', HttpClient::Helper.to_object(x), Hash)) @total = HttpClient::Preconditions.assert_class('total', HttpClient::Helper.to_object(opts.delete(:total)), Hash) end |
Instance Attribute Details
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def customer @customer end |
#deliveries ⇒ Object (readonly)
Returns the value of attribute deliveries.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def deliveries @deliveries end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def destination @destination end |
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def discount @discount end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def environment @environment end |
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def event_id @event_id end |
#experience_id ⇒ Object (readonly)
Returns the value of attribute experience_id.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def experience_id @experience_id end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def expires_at @expires_at end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def items @items end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def number @number end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def organization @organization end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def prices @prices end |
#selections ⇒ Object (readonly)
Returns the value of attribute selections.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def selections @selections end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
13200 13201 13202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13200 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
13227 13228 13229 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13227 def copy(incoming={}) OrderUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13231 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, :selections => selections, :items => items, :destination => destination, :deliveries => deliveries, :prices => prices, :discount => discount, :total => total } end |
#to_json ⇒ Object
13223 13224 13225 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13223 def to_json JSON.dump(to_hash) end |