Class: Io::Flow::V0::Models::CardAuthorizationActionResult
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CardAuthorizationActionResult
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
AuthorizationActionResultAdyenV3, AuthorizationActionResultAdyenV4, CardAuthorizationActionResultUndefinedType
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(incoming = {}) ⇒ CardAuthorizationActionResult
constructor
A new instance of CardAuthorizationActionResult.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CardAuthorizationActionResult
Returns a new instance of CardAuthorizationActionResult.
10109 10110 10111 10112 10113 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10109 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type], 'CardAuthorizationActionResult') @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
10107 10108 10109 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10107 def type @type end |
Class Method Details
.from_json(hash) ⇒ Object
10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10123 def CardAuthorizationActionResult.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[card_authorization_action_result] requires a field named 'type'" end case discriminator when Types::AUTHORIZATION_ACTION_RESULT_ADYEN_V3; AuthorizationActionResultAdyenV3.new(hash) when Types::AUTHORIZATION_ACTION_RESULT_ADYEN_V4; AuthorizationActionResultAdyenV4.new(hash) else CardAuthorizationActionResultUndefinedType.new(:type => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
10115 10116 10117 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10115 def subtype_to_hash raise 'Cannot serialize an instance of card_authorization_action_result directly - must use one of the specific types: authorization_action_result_adyen_v3, authorization_action_result_adyen_v4' end |
#to_hash ⇒ Object
10119 10120 10121 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10119 def to_hash subtype_to_hash.merge(:type => @type) end |