Class: ApiBee::Proxy
- Inherits:
-
Object
show all
- Defined in:
- lib/api_bee/proxy.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(adapter, config, href = nil, opts = nil) ⇒ Proxy
Returns a new instance of Proxy.
7
8
9
10
11
12
|
# File 'lib/api_bee/proxy.rb', line 7
def initialize(adapter, config, href = nil, opts = nil)
@adapter = adapter
@config = config
@href = href
@opts = opts
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/api_bee/proxy.rb', line 38
def method_missing(method_name, *args, &block)
if _adapter_delegators.include?(method_name)
@adapter.send(method_name, *args, &block)
else
_node.send(method_name, *args, &block)
end
end
|
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
5
6
7
|
# File 'lib/api_bee/proxy.rb', line 5
def adapter
@adapter
end
|
Instance Method Details
#==(other) ⇒ Object
32
33
34
|
# File 'lib/api_bee/proxy.rb', line 32
def ==(other)
_node.to_data
end
|
#[](key) ⇒ Object
19
20
21
|
# File 'lib/api_bee/proxy.rb', line 19
def [](key)
_node[key]
end
|
#get(href, opts = {}) ⇒ Object
14
15
16
17
|
# File 'lib/api_bee/proxy.rb', line 14
def get(href, opts = {})
Proxy.new @adapter, @config, href, opts
end
|
#paginate(*args) ⇒ Object
27
28
29
30
|
# File 'lib/api_bee/proxy.rb', line 27
def paginate(*args)
@list ||= Node::List.new(@adapter, @config, {@config.uri_property_name => @href}, @href)
@list.paginate *args
end
|
#to_data ⇒ Object
23
24
25
|
# File 'lib/api_bee/proxy.rb', line 23
def to_data
_node.to_data
end
|