Class: Io::Flow::V0::Models::BankAccountInfo

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

Returns a new instance of BankAccountInfo.



9986
9987
9988
9989
9990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9986

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

Instance Attribute Details

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



9984
9985
9986
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9984

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10000

def BankAccountInfo.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[bank_account_info] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::BANK_ACCOUNT_INFO_USA; BankAccountInfoUsa.new(hash)
    else BankAccountInfoUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



9992
9993
9994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9992

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

#to_hashObject



9996
9997
9998
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9996

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