Class: Wowzer::Resource
- Inherits:
-
Object
- Object
- Wowzer::Resource
- Defined in:
- lib/wowzer/resource.rb
Direct Known Subclasses
Application, ApplicationResponse, Candidate, Interview, Notification
Instance Attribute Summary collapse
-
#resource ⇒ Object
Returns the value of attribute resource.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(resource) ⇒ Resource
constructor
A new instance of Resource.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(resource) ⇒ Resource
Returns a new instance of Resource.
6 7 8 |
# File 'lib/wowzer/resource.rb', line 6 def initialize(resource) self.resource = resource end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/wowzer/resource.rb', line 24 def method_missing(method, *args, &block) if resource.attributes.respond_to?(method) resource.attributes.send(method, *args, &block) else super end end |
Instance Attribute Details
#resource ⇒ Object
Returns the value of attribute resource.
4 5 6 |
# File 'lib/wowzer/resource.rb', line 4 def resource @resource end |
Class Method Details
.all ⇒ Object
14 15 16 |
# File 'lib/wowzer/resource.rb', line 14 def self.all .map{|resource| new(resource)} end |
.client ⇒ Object
10 11 12 |
# File 'lib/wowzer/resource.rb', line 10 def self.client Wowzer::client end |
.find(id) ⇒ Object
18 19 20 21 22 |
# File 'lib/wowzer/resource.rb', line 18 def self.find(id) resource = (id) || find_by_link(id) raise ResourceNotFound unless resource resource end |