Class: Io::Flow::V0::Models::TransactionDetails
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TransactionDetails
show all
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
16261
16262
16263
16264
16265
|
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16261
def initialize(incoming={})
opts = HttpClient::Helper.symbolize_keys(incoming)
HttpClient::Preconditions.require_keys(opts, [:type], 'TransactionDetails')
@type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String)
end
|
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
16259
16260
16261
|
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16259
def type
@type
end
|
Class Method Details
.from_json(hash) ⇒ Object
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
|
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16275
def TransactionDetails.from_json(hash)
HttpClient::Preconditions.assert_class('hash', hash, Hash)
discriminator = HttpClient::Helper.symbolize_keys(hash)[:type].to_s.strip
if discriminator.empty?
raise "Union type[transaction_details] requires a field named 'type'"
end
case discriminator
when Types::TRANSACTION_DETAILS_CARD; TransactionDetailsCard.new(hash)
else TransactionDetailsUndefinedType.new(:type => discriminator)
end
end
|
Instance Method Details
#subtype_to_hash ⇒ Object
16267
16268
16269
|
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16267
def subtype_to_hash
raise 'Cannot serialize an instance of transaction_details directly - must use one of the specific types: transaction_details_card'
end
|
#to_hash ⇒ Object
16271
16272
16273
|
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16271
def to_hash
subtype_to_hash.merge(:type => @type)
end
|