Class: Io::Flow::V0::Models::TransactionUpserted
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#transaction ⇒ Object
readonly
Returns the value of attribute transaction.
Attributes inherited from Event
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TransactionUpserted
constructor
A new instance of TransactionUpserted.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Event
Constructor Details
#initialize(incoming = {}) ⇒ TransactionUpserted
Returns a new instance of TransactionUpserted.
71952 71953 71954 71955 71956 71957 71958 71959 71960 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71952 def initialize(incoming={}) super(:discriminator => Event::Types::TRANSACTION_UPSERTED) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :transaction], 'TransactionUpserted') @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String) @timestamp = 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) @transaction = (x = opts.delete(:transaction); x.is_a?(::Io::Flow::V0::Models::Transaction) ? x : ::Io::Flow::V0::Models::Transaction.new(x)) end |
Instance Attribute Details
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
71950 71951 71952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71950 def event_id @event_id end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
71950 71951 71952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71950 def organization @organization end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
71950 71951 71952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71950 def @timestamp end |
#transaction ⇒ Object (readonly)
Returns the value of attribute transaction.
71950 71951 71952 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71950 def transaction @transaction end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
71966 71967 71968 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71966 def copy(incoming={}) TransactionUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
71970 71971 71972 71973 71974 71975 71976 71977 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71970 def subtype_to_hash { :event_id => event_id, :timestamp => , :organization => organization, :transaction => transaction.to_hash } end |
#to_json ⇒ Object
71962 71963 71964 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71962 def to_json JSON.dump(to_hash) end |