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.
13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13748 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.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def customer @customer end |
#deliveries ⇒ Object (readonly)
Returns the value of attribute deliveries.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def deliveries @deliveries end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def destination @destination end |
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def discount @discount end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def environment @environment end |
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def event_id @event_id end |
#experience_id ⇒ Object (readonly)
Returns the value of attribute experience_id.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def experience_id @experience_id end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def expires_at @expires_at end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def items @items end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def number @number end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def organization @organization end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def prices @prices end |
#selections ⇒ Object (readonly)
Returns the value of attribute selections.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def selections @selections end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
13746 13747 13748 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13746 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
13773 13774 13775 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13773 def copy(incoming={}) OrderUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13777 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
13769 13770 13771 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13769 def to_json JSON.dump(to_hash) end |