Class: Io::Flow::V0::Models::PaymentMethodDataAuthorizeKlarnaResult

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

Returns a new instance of PaymentMethodDataAuthorizeKlarnaResult.



12999
13000
13001
13002
13003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12999

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

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



12997
12998
12999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12997

def type
  @type
end

Class Method Details

.from_json(hash) ⇒ Object



13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13013

def PaymentMethodDataAuthorizeKlarnaResult.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[payment_method_data_authorize_klarna_result] requires a field named 'type'"
  end
  case discriminator
    when Types::PAYMENT_METHOD_DATA_AUTHORIZE_KLARNA_RESULT_SUCCESS; PaymentMethodDataAuthorizeKlarnaResultSuccess.new(hash)
    when Types::PAYMENT_METHOD_DATA_AUTHORIZE_KLARNA_RESULT_FAILURE; PaymentMethodDataAuthorizeKlarnaResultFailure.new(hash)
    else PaymentMethodDataAuthorizeKlarnaResultUndefinedType.new(:type => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



13005
13006
13007
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13005

def subtype_to_hash
  raise 'Cannot serialize an instance of payment_method_data_authorize_klarna_result directly - must use one of the specific types: payment_method_data_authorize_klarna_result_success, payment_method_data_authorize_klarna_result_failure'
end

#to_hashObject



13009
13010
13011
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13009

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