class Razorpay::Entity
Entity
class is the base class for all Razorpay
objects This saves data in a hash internally, and makes it available via direct methods
Attributes
attributes[R]
Public Class Methods
new(attributes)
click to toggle source
# File lib/razorpay/entity.rb, line 10 def initialize(attributes) @attributes = attributes end
Public Instance Methods
method_missing(name)
click to toggle source
This method fakes attr_reader, but uses the @attributes hash as the source, instead of instance variables
Calls superclass method
# File lib/razorpay/entity.rb, line 17 def method_missing(name) if @attributes.key? name.to_s @attributes[name.to_s] else super end end
respond_to_missing?(method_name, include_private = false)
click to toggle source
Calls superclass method
# File lib/razorpay/entity.rb, line 25 def respond_to_missing?(method_name, include_private = false) @attributes.key?(method_name.to_s) || super end
to_json(*args)
click to toggle source
with_a_bang() { || ... }
click to toggle source
Mutates the entity in accordance with the block passed to this construct
Used to implement bang methods, by calling the non-bang method in the passed block
# File lib/razorpay/entity.rb, line 40 def with_a_bang mutated_entity = yield @attributes = mutated_entity.attributes mutated_entity end