class Ingenico::Direct::SDK::Domain::CreatedTokenResponse

@attr [Ingenico::Direct::SDK::Domain::CardWithoutCvv] card @attr [Ingenico::Direct::SDK::Domain::ExternalTokenLinked] external_token_linked @attr [true/false] is_new_token @attr [String] token @attr [String] token_status

Attributes

card[RW]
external_token_linked[RW]
is_new_token[RW]
token[RW]
token_status[RW]

Public Instance Methods

from_hash(hash) click to toggle source
# File lib/ingenico/direct/sdk/domain/created_token_response.rb, line 35
def from_hash(hash)
  super
  if hash.key? 'card'
    raise TypeError, "value '%s' is not a Hash" % [hash['card']] unless hash['card'].is_a? Hash
    @card = Ingenico::Direct::SDK::Domain::CardWithoutCvv.new_from_hash(hash['card'])
  end
  if hash.key? 'externalTokenLinked'
    raise TypeError, "value '%s' is not a Hash" % [hash['externalTokenLinked']] unless hash['externalTokenLinked'].is_a? Hash
    @external_token_linked = Ingenico::Direct::SDK::Domain::ExternalTokenLinked.new_from_hash(hash['externalTokenLinked'])
  end
  @is_new_token = hash['isNewToken'] if hash.key? 'isNewToken'
  @token = hash['token'] if hash.key? 'token'
  @token_status = hash['tokenStatus'] if hash.key? 'tokenStatus'
end
to_h() click to toggle source

@return (Hash)

Calls superclass method Ingenico::Direct::SDK::DataObject#to_h
# File lib/ingenico/direct/sdk/domain/created_token_response.rb, line 25
def to_h
  hash = super
  hash['card'] = @card.to_h if @card
  hash['externalTokenLinked'] = @external_token_linked.to_h if @external_token_linked
  hash['isNewToken'] = @is_new_token unless @is_new_token.nil?
  hash['token'] = @token unless @token.nil?
  hash['tokenStatus'] = @token_status unless @token_status.nil?
  hash
end