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.



257
258
259
260
261
262
# File 'lib/webpay/data_types.rb', line 257

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.



250
251
252
# File 'lib/webpay/data_types.rb', line 250

def attributes
  @attributes
end

Class Method Details

.fieldsObject



252
253
254
# File 'lib/webpay/data_types.rb', line 252

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



279
280
281
# File 'lib/webpay/data_types.rb', line 279

def amount
  attributes['amount']
end

#amount_refundedObject



307
308
309
# File 'lib/webpay/data_types.rb', line 307

def amount_refunded
  attributes['amount_refunded']
end

#capturedObject



299
300
301
# File 'lib/webpay/data_types.rb', line 299

def captured
  attributes['captured']
end

#cardObject



283
284
285
# File 'lib/webpay/data_types.rb', line 283

def card
  attributes['card']
end

#createdObject



287
288
289
# File 'lib/webpay/data_types.rb', line 287

def created
  attributes['created']
end

#currencyObject



291
292
293
# File 'lib/webpay/data_types.rb', line 291

def currency
  attributes['currency']
end

#customerObject



311
312
313
# File 'lib/webpay/data_types.rb', line 311

def customer
  attributes['customer']
end

#descriptionObject



323
324
325
# File 'lib/webpay/data_types.rb', line 323

def description
  attributes['description']
end

#expire_timeObject



331
332
333
# File 'lib/webpay/data_types.rb', line 331

def expire_time
  attributes['expire_time']
end

#failure_messageObject



327
328
329
# File 'lib/webpay/data_types.rb', line 327

def failure_message
  attributes['failure_message']
end

#feesObject



335
336
337
# File 'lib/webpay/data_types.rb', line 335

def fees
  attributes['fees']
end

#idObject

attributes accessors



267
268
269
# File 'lib/webpay/data_types.rb', line 267

def id
  attributes['id']
end

#livemodeObject



275
276
277
# File 'lib/webpay/data_types.rb', line 275

def livemode
  attributes['livemode']
end

#objectObject



271
272
273
# File 'lib/webpay/data_types.rb', line 271

def object
  attributes['object']
end


295
296
297
# File 'lib/webpay/data_types.rb', line 295

def paid
  attributes['paid']
end

#recursionObject



315
316
317
# File 'lib/webpay/data_types.rb', line 315

def recursion
  attributes['recursion']
end

#refundedObject



303
304
305
# File 'lib/webpay/data_types.rb', line 303

def refunded
  attributes['refunded']
end

#shopObject



319
320
321
# File 'lib/webpay/data_types.rb', line 319

def shop
  attributes['shop']
end