Class: WebPay::TokenRequestCreate
- Inherits:
-
Entity
- Object
- Entity
- WebPay::TokenRequestCreate
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
Returns a new instance of TokenRequestCreate.
1249
1250
1251
1252
1253
|
# File 'lib/webpay/data_types.rb', line 1249
def initialize(hash = {})
hash = normalize_hash(hash)
hash['card'] = WebPay::CardRequest.new(hash['card']) if hash['card'].is_a?(Hash)
@attributes = hash
end
|
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
1231
1232
1233
|
# File 'lib/webpay/data_types.rb', line 1231
def attributes
@attributes
end
|
Class Method Details
.create(params) ⇒ Object
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
|
# File 'lib/webpay/data_types.rb', line 1238
def self.create(params)
return params if params.is_a?(self)
hash = case params
when Hash; params
when WebPay::CardRequest; {'card' => params}
else
raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
end
self.new(hash)
end
|
.fields ⇒ Object
1233
1234
1235
|
# File 'lib/webpay/data_types.rb', line 1233
def self.fields
['card', 'customer', 'uuid']
end
|
Instance Method Details
#card ⇒ Object
1271
1272
1273
|
# File 'lib/webpay/data_types.rb', line 1271
def card
attributes['card']
end
|
#card=(value) ⇒ Object
1275
1276
1277
1278
|
# File 'lib/webpay/data_types.rb', line 1275
def card=(value)
value = WebPay::CardRequest.new(value) if value.is_a?(Hash)
attributes['card'] = value
end
|
#customer ⇒ Object
1280
1281
1282
|
# File 'lib/webpay/data_types.rb', line 1280
def customer
attributes['customer']
end
|
#customer=(value) ⇒ Object
1284
1285
1286
|
# File 'lib/webpay/data_types.rb', line 1284
def customer=(value)
attributes['customer'] = value
end
|
#query_params ⇒ Object
1264
1265
1266
1267
|
# File 'lib/webpay/data_types.rb', line 1264
def query_params
result = {}
return result
end
|
#request_body ⇒ Object
1256
1257
1258
1259
1260
1261
1262
|
# File 'lib/webpay/data_types.rb', line 1256
def request_body
result = {}
copy_if_exists(@attributes, result, 'card', 'request_body');
copy_if_exists(@attributes, result, 'customer', 'request_body');
copy_if_exists(@attributes, result, 'uuid', 'request_body');
result
end
|
#uuid ⇒ Object
1288
1289
1290
|
# File 'lib/webpay/data_types.rb', line 1288
def uuid
attributes['uuid']
end
|
#uuid=(value) ⇒ Object
1292
1293
1294
|
# File 'lib/webpay/data_types.rb', line 1292
def uuid=(value)
attributes['uuid'] = value
end
|