class Hyperwallet::HyperwalletObject
Attributes
values[R]
Public Class Methods
attributes()
click to toggle source
# File lib/hyperwallet/hyperwallet_object.rb, line 25 def self.attributes [] end
construct_from(values)
click to toggle source
# File lib/hyperwallet/hyperwallet_object.rb, line 33 def self.construct_from(values) object = self.new(values) end
convert_to_hyperwallet_object(resp, type = nil, relation = nil)
click to toggle source
# File lib/hyperwallet/hyperwallet_object.rb, line 13 def self.convert_to_hyperwallet_object(resp, type = nil, relation = nil) case resp when Array resp.map { |r| convert_to_hyperwallet_object(r, type, relation) } when Hash object_class = (relation.nil? ? type : type.relations[relation]) || HyperwalletObject object_class.construct_from(resp) else resp end end
new(values)
click to toggle source
# File lib/hyperwallet/hyperwallet_object.rb, line 5 def initialize(values) @values = {} (self.class.attributes + values.keys).each do |k| attr = Util.symbolize_attribute(k) @values[attr] = HyperwalletObject.convert_to_hyperwallet_object(values[k], self.class, attr) end end
relations()
click to toggle source
# File lib/hyperwallet/hyperwallet_object.rb, line 29 def self.relations {} end
Public Instance Methods
method_missing(name, *args, &block)
click to toggle source
Calls superclass method
# File lib/hyperwallet/hyperwallet_object.rb, line 37 def method_missing(name, *args, &block) if @values.has_key?(name) @values[name] else super end end
respond_to_missing?(name, *args)
click to toggle source
Calls superclass method
# File lib/hyperwallet/hyperwallet_object.rb, line 45 def respond_to_missing?(name, *args) @values.has_key?(name) || super end