Class: WebPay::EventData

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

Returns a new instance of EventData.



1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
# File 'lib/webpay/data_types.rb', line 1376

def initialize(hash = {})
  hash = normalize_hash(hash)
  hash['object'] =
  case hash['object'].is_a?(Hash) && hash['object']['object']
  when 'charge'; WebPay::ChargeResponse.new(hash['object'])
  when 'customer'; WebPay::CustomerResponse.new(hash['object'])
  when 'shop'; WebPay::ShopResponse.new(hash['object'])
  when 'recursion'; WebPay::RecursionResponse.new(hash['object'])
  when 'account'; WebPay::AccountResponse.new(hash['object'])
  else; hash['object']
  end
  @attributes = hash
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



1369
1370
1371
# File 'lib/webpay/data_types.rb', line 1369

def attributes
  @attributes
end

Class Method Details

.fieldsObject



1371
1372
1373
# File 'lib/webpay/data_types.rb', line 1371

def self.fields
  ['object', 'previous_attributes']
end

Instance Method Details

#objectObject

attributes accessors



1393
1394
1395
# File 'lib/webpay/data_types.rb', line 1393

def object
  attributes['object']
end

#previous_attributesObject



1397
1398
1399
# File 'lib/webpay/data_types.rb', line 1397

def previous_attributes
  attributes['previous_attributes']
end