Class: WebPay::ChargeResponse

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

Returns a new instance of ChargeResponse.



351
352
353
354
355
356
# File 'lib/webpay/data_types.rb', line 351

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

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



344
345
346
# File 'lib/webpay/data_types.rb', line 344

def attributes
  @attributes
end

Class Method Details

.fieldsObject



346
347
348
# File 'lib/webpay/data_types.rb', line 346

def self.fields
  ['id', 'object', 'livemode', 'amount', 'card', 'created', 'currency', 'paid', 'captured', 'refunded', 'amount_refunded', 'customer', 'recursion', 'shop', 'description', 'failure_message', 'expire_time', 'fees']
end

Instance Method Details

#amountObject



373
374
375
# File 'lib/webpay/data_types.rb', line 373

def amount
  attributes['amount']
end

#amount_refundedObject



401
402
403
# File 'lib/webpay/data_types.rb', line 401

def amount_refunded
  attributes['amount_refunded']
end

#capturedObject



393
394
395
# File 'lib/webpay/data_types.rb', line 393

def captured
  attributes['captured']
end

#cardObject



377
378
379
# File 'lib/webpay/data_types.rb', line 377

def card
  attributes['card']
end

#createdObject



381
382
383
# File 'lib/webpay/data_types.rb', line 381

def created
  attributes['created']
end

#currencyObject



385
386
387
# File 'lib/webpay/data_types.rb', line 385

def currency
  attributes['currency']
end

#customerObject



405
406
407
# File 'lib/webpay/data_types.rb', line 405

def customer
  attributes['customer']
end

#descriptionObject



417
418
419
# File 'lib/webpay/data_types.rb', line 417

def description
  attributes['description']
end

#expire_timeObject



425
426
427
# File 'lib/webpay/data_types.rb', line 425

def expire_time
  attributes['expire_time']
end

#failure_messageObject



421
422
423
# File 'lib/webpay/data_types.rb', line 421

def failure_message
  attributes['failure_message']
end

#feesObject



429
430
431
# File 'lib/webpay/data_types.rb', line 429

def fees
  attributes['fees']
end

#idObject

attributes accessors



361
362
363
# File 'lib/webpay/data_types.rb', line 361

def id
  attributes['id']
end

#livemodeObject



369
370
371
# File 'lib/webpay/data_types.rb', line 369

def livemode
  attributes['livemode']
end

#objectObject



365
366
367
# File 'lib/webpay/data_types.rb', line 365

def object
  attributes['object']
end


389
390
391
# File 'lib/webpay/data_types.rb', line 389

def paid
  attributes['paid']
end

#recursionObject



409
410
411
# File 'lib/webpay/data_types.rb', line 409

def recursion
  attributes['recursion']
end

#refundedObject



397
398
399
# File 'lib/webpay/data_types.rb', line 397

def refunded
  attributes['refunded']
end

#shopObject



413
414
415
# File 'lib/webpay/data_types.rb', line 413

def shop
  attributes['shop']
end