Class: Io::Flow::V0::Models::ThreedsChallengeAction

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Different version sets of 3ds challenge actions.

Defined Under Namespace

Modules: Types

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ThreedsChallengeAction

Returns a new instance of ThreedsChallengeAction.



15871
15872
15873
15874
15875
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15871

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

Instance Attribute Details

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



15869
15870
15871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15869

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15885

def ThreedsChallengeAction.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[threeds_challenge_action] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::THREEDS_TWO_CHALLENGE_REQUEST; ThreedsTwoChallengeRequest.new(hash)
    else ThreedsChallengeActionUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



15877
15878
15879
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15877

def subtype_to_hash
  raise 'Cannot serialize an instance of threeds_challenge_action directly - must use one of the specific types: threeds_two_challenge_request'
end

#to_hashObject



15881
15882
15883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15881

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