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.



9230
9231
9232
9233
9234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9230

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.



9228
9229
9230
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9228

def type
  @type
end

Class Method Details

.from_json(hash) ⇒ Object



9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9244

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



9236
9237
9238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9236

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



9240
9241
9242
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9240

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