Class: Io::Flow::V0::Models::AuthorizationResultAction

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

Returns a new instance of AuthorizationResultAction.



9787
9788
9789
9790
9791
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9787

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

Instance Attribute Details

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



9785
9786
9787
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9785

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9801

def AuthorizationResultAction.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] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::AUTHORIZATION_RESULT_ACTION_GET; AuthorizationResultActionGet.new(hash)
    when Types::AUTHORIZATION_RESULT_ACTION_POST; AuthorizationResultActionPost.new(hash)
    when Types::AUTHORIZATION_RESULT_ACTION_WAIT; AuthorizationResultActionWait.new(hash)
    when Types::AUTHORIZATION_RESULT_ACTION_NATIVE; AuthorizationResultActionNative.new(hash)
    else AuthorizationResultActionUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



9793
9794
9795
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9793

def subtype_to_hash
  raise 'Cannot serialize an instance of authorization_result_action directly - must use one of the specific types: authorization_result_action_get, authorization_result_action_post, authorization_result_action_wait, authorization_result_action_native'
end

#to_hashObject



9797
9798
9799
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9797

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