Class: Io::Flow::V0::Models::OnlineAuthorizationDetails
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OnlineAuthorizationDetails
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
CryptopayAuthorizationDetails, InlineAuthorizationDetails, OnlineAuthorizationDetailsUndefinedType, PaypalAuthorizationDetails, RedirectAuthorizationDetails
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 = {}) ⇒ OnlineAuthorizationDetails
constructor
A new instance of OnlineAuthorizationDetails.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OnlineAuthorizationDetails
Returns a new instance of OnlineAuthorizationDetails.
12993 12994 12995 12996 12997 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12993 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discriminator], 'OnlineAuthorizationDetails') @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
12991 12992 12993 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12991 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13007 def OnlineAuthorizationDetails.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[online_authorization_details] requires a field named 'discriminator'" end case discriminator when Types::CRYPTOPAY_AUTHORIZATION_DETAILS; CryptopayAuthorizationDetails.new(hash) when Types::PAYPAL_AUTHORIZATION_DETAILS; PaypalAuthorizationDetails.new(hash) when Types::REDIRECT_AUTHORIZATION_DETAILS; RedirectAuthorizationDetails.new(hash) when Types::INLINE_AUTHORIZATION_DETAILS; InlineAuthorizationDetails.new(hash) else OnlineAuthorizationDetailsUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
12999 13000 13001 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12999 def subtype_to_hash raise 'Cannot serialize an instance of online_authorization_details directly - must use one of the specific types: cryptopay_authorization_details, paypal_authorization_details, redirect_authorization_details, inline_authorization_details' end |
#to_hash ⇒ Object
13003 13004 13005 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13003 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |