Class: WebPay::TokenResponse

Inherits:
Entity
  • Object
show all
Defined in:
lib/webpay/data_types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#normalize_hash, #to_h, #to_s

Constructor Details

#initialize(hash = {}) ⇒ TokenResponse

Returns a new instance of TokenResponse.



1240
1241
1242
1243
1244
# File 'lib/webpay/data_types.rb', line 1240

def initialize(hash = {})
  hash = normalize_hash(hash)
  hash['card'] = WebPay::CardResponse.new(hash['card']) if hash['card'].is_a?(Hash)
  @attributes = hash
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



1233
1234
1235
# File 'lib/webpay/data_types.rb', line 1233

def attributes
  @attributes
end

Class Method Details

.fieldsObject



1235
1236
1237
# File 'lib/webpay/data_types.rb', line 1235

def self.fields
  ['id', 'object', 'livemode', 'card', 'created', 'used']
end

Instance Method Details

#cardObject



1261
1262
1263
# File 'lib/webpay/data_types.rb', line 1261

def card
  attributes['card']
end

#createdObject



1265
1266
1267
# File 'lib/webpay/data_types.rb', line 1265

def created
  attributes['created']
end

#idObject

attributes accessors



1249
1250
1251
# File 'lib/webpay/data_types.rb', line 1249

def id
  attributes['id']
end

#livemodeObject



1257
1258
1259
# File 'lib/webpay/data_types.rb', line 1257

def livemode
  attributes['livemode']
end

#objectObject



1253
1254
1255
# File 'lib/webpay/data_types.rb', line 1253

def object
  attributes['object']
end

#usedObject



1269
1270
1271
# File 'lib/webpay/data_types.rb', line 1269

def used
  attributes['used']
end