class Spreedly::Subscriptions::Resource
Attributes
attributes[R]
Public Class Methods
attributes()
click to toggle source
# File lib/spreedly/subscriptions/mock.rb, line 18 def self.attributes @attributes ||= {} end
attributes=(value)
click to toggle source
# File lib/spreedly/subscriptions/mock.rb, line 22 def self.attributes=(value) @attributes = value end
new(params={})
click to toggle source
# File lib/spreedly/subscriptions/mock.rb, line 27 def initialize(params={}) @attributes = self.class.attributes.inject({}){|a,(k,v)| a[k.to_sym] = v.call; a} params.each {|k,v| @attributes[k.to_sym] = v } end
Public Instance Methods
id()
click to toggle source
# File lib/spreedly/subscriptions/mock.rb, line 32 def id @attributes[:id] end
method_missing(method, *args)
click to toggle source
Calls superclass method
# File lib/spreedly/subscriptions/mock.rb, line 36 def method_missing(method, *args) if method.to_s =~ /\?$/ send(method.to_s[0..-2], *args) elsif @attributes.include?(method) @attributes[method] else super end end