Class: Spreedly::Subscriptions::Resource
- Inherits:
-
Object
- Object
- Spreedly::Subscriptions::Resource
- Defined in:
- lib/spreedly/subscriptions.rb,
lib/spreedly/subscriptions/mock.rb
Overview
:nodoc: all
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(params = {}) ⇒ Resource
constructor
A new instance of Resource.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Resource
Returns a new instance of Resource.
67 68 69 |
# File 'lib/spreedly/subscriptions.rb', line 67 def initialize(data) @data = data end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/spreedly/subscriptions.rb', line 75 def method_missing(method, *args, &block) if method.to_s =~ /\?$/ send(method.to_s[0..-2]) elsif @data.include?(method.to_s) @data[method.to_s] else super end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
26 27 28 |
# File 'lib/spreedly/subscriptions/mock.rb', line 26 def attributes @attributes end |
Class Method Details
.attributes ⇒ Object
18 19 20 |
# File 'lib/spreedly/subscriptions/mock.rb', line 18 def self.attributes @attributes ||= {} end |
.attributes=(value) ⇒ Object
22 23 24 |
# File 'lib/spreedly/subscriptions/mock.rb', line 22 def self.attributes=(value) @attributes = value end |
Instance Method Details
#id ⇒ Object
71 72 73 |
# File 'lib/spreedly/subscriptions.rb', line 71 def id @data["id"] end |