Method: WebPay::ChargeResponse#initialize

Defined in:
lib/webpay/data_types.rb

#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