Class: Io::Flow::V0::Models::AuthorizationResultActionDetails

Inherits:
Object
  • Object
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

#initialize(incoming = {}) ⇒ AuthorizationResultActionDetails

Returns a new instance of AuthorizationResultActionDetails.



9857
9858
9859
9860
9861
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9857

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:discriminator], 'AuthorizationResultActionDetails')
  @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
end

Instance Attribute Details

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



9855
9856
9857
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9855

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9871

def AuthorizationResultActionDetails.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[authorization_result_action_details] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::ADYEN_NATIVE_ACTION_DETAILS; AdyenNativeActionDetails.new(hash)
    when Types::STRIPE_AUTHORIZATION_RESULT_ACTION_DETAILS; StripeAuthorizationResultActionDetails.new(hash)
    when Types::THREEDS_IDENTIFY_ACTION_DETAILS; ThreedsIdentifyActionDetails.new(hash)
    when Types::THREEDS_CHALLENGE_ACTION_DETAILS; ThreedsChallengeActionDetails.new(hash)
    when Types::APPLEPAY_SDK_CREATE_RESULT_ACTION_DETAILS; ApplepaySdkCreateResultActionDetails.new(hash)
    when Types::APPLEPAY_SDK_VALIDATE_RESULT_ACTION_DETAILS; ApplepaySdkValidateResultActionDetails.new(hash)
    when Types::KLARNA_SDK_AUTHORIZATION_RESULT_ACTION_DETAILS; KlarnaSdkAuthorizationResultActionDetails.new(hash)
    when Types::SELECT_ISSUER_OPTION_ACTION_DETAILS; SelectIssuerOptionActionDetails.new(hash)
    else AuthorizationResultActionDetailsUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



9863
9864
9865
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9863

def subtype_to_hash
  raise 'Cannot serialize an instance of authorization_result_action_details directly - must use one of the specific types: adyen_native_action_details, stripe_authorization_result_action_details, threeds_identify_action_details, threeds_challenge_action_details, applepay_sdk_create_result_action_details, applepay_sdk_validate_result_action_details, klarna_sdk_authorization_result_action_details, select_issuer_option_action_details'
end

#to_hashObject



9867
9868
9869
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9867

def to_hash
  subtype_to_hash.merge(:discriminator => @discriminator)
end