Sha256: 3dfd18e2eb8c70255096c95b88f354d1015ac138ec6a34cba6be81a0929f5a31
Contents?: true
Size: 732 Bytes
Versions: 3
Compression:
Stored size: 732 Bytes
Contents
require 'json' module Razorpay # Entity class is the base class for all Razorpay objects # This saves data in a hash internally, and makes it available # via direct methods class Entity def initialize(attributes) @attributes = attributes end # This method fakes attr_reader, but uses # the @attributes hash as the source, instead of # instance variables def method_missing(name) name = name.to_s raise NameError, "No such data member: #{name}" unless @attributes.key? name @attributes[name] end # Public: Convert the Entity object to JSON # Returns the JSON representation of the Entity (as a string) def to_json @attributes.to_json end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
razorpay-1.2.1 | lib/razorpay/entity.rb |
razorpay-1.2.0 | lib/razorpay/entity.rb |
razorpay-1.1.0 | lib/razorpay/entity.rb |