class Io::Flow::V0::Models::OnlineAuthorizationDetails

Attributes

discriminator[R]

Public Class Methods

from_json(hash) click to toggle source
# 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
new(incoming={}) click to toggle source
# 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

Public Instance Methods

subtype_to_hash() click to toggle source
# 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() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 13003
def to_hash
  subtype_to_hash.merge(:discriminator => @discriminator)
end