Class: Io::Flow::V0::Models::ConfirmationDetails
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ConfirmationDetails
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
CardConfirmationSummary, ConfirmationDetailsUndefinedType, DirectDebit
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
-
#discriminator ⇒ Object
readonly
Returns the value of attribute discriminator.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(incoming = {}) ⇒ ConfirmationDetails
constructor
A new instance of ConfirmationDetails.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ConfirmationDetails
Returns a new instance of ConfirmationDetails.
10294 10295 10296 10297 10298 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10294 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discriminator], 'ConfirmationDetails') @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
10292 10293 10294 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10292 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10308 def ConfirmationDetails.from_json(hash) HttpClient::Preconditions.assert_class('hash', hash, Hash) discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip if discriminator.empty? raise "Union type[confirmation_details] requires a field named 'discriminator'" end case discriminator when Types::DIRECT_DEBIT; DirectDebit.new(hash) when Types::CARD_CONFIRMATION_SUMMARY; CardConfirmationSummary.new(hash) else ConfirmationDetailsUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
10300 10301 10302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10300 def subtype_to_hash raise 'Cannot serialize an instance of confirmation_details directly - must use one of the specific types: direct_debit, card_confirmation_summary' end |
#to_hash ⇒ Object
10304 10305 10306 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10304 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |