Class: Minfraud::Components::Base
- Inherits:
-
Object
- Object
- Minfraud::Components::Base
- Defined in:
- lib/minfraud/components/base.rb
Overview
Note: This class is used as a parent class for all other components It defines a method which is used for basic JSON representation of PORO objects
Direct Known Subclasses
Account, Addressable, CreditCard, Device, Email, Event, Order, Payment, ShoppingCart, ShoppingCartItem
Instance Method Summary collapse
-
#to_json ⇒ Hash
A JSON representation of component attributes.
Instance Method Details
#to_json ⇒ Hash
Returns a JSON representation of component attributes.
7 8 9 10 |
# File 'lib/minfraud/components/base.rb', line 7 def to_json instance_variables.inject({}) { |mem, e| mem.merge!(e.to_s.gsub(/@/, '') => instance_variable_get(e).to_s) } .delete_if { |_, v| v.empty? } end |