Class: Wowzer::Resource
- Inherits:
-
Object
show all
- Defined in:
- lib/wowzer/resource.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(resource) ⇒ 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
absolute_resource_embedded.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 = find_by_embedded(id) || find_by_link(id)
raise ResourceNotFound unless resource
resource
end
|