Class: Io::Flow::V0::Models::CardAuthorizationActionResult

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 = {}) ⇒ CardAuthorizationActionResult

Returns a new instance of CardAuthorizationActionResult.



9575
9576
9577
9578
9579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9575

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

#typeObject (readonly)

Returns the value of attribute type.



9573
9574
9575
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9573

def type
  @type
end

Class Method Details

.from_json(hash) ⇒ Object



9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9589

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_hashObject



9581
9582
9583
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9581

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_hashObject



9585
9586
9587
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9585

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