Class: Zaikio::Hub::RequestWrapper
- Inherits:
-
Object
- Object
- Zaikio::Hub::RequestWrapper
show all
- Defined in:
- lib/zaikio/hub/client.rb
Instance Method Summary
collapse
Constructor Details
#initialize(result, client) ⇒ RequestWrapper
Returns a new instance of RequestWrapper.
6
7
8
9
|
# File 'lib/zaikio/hub/client.rb', line 6
def initialize(result, client)
@result = result
@client = client
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/zaikio/hub/client.rb', line 15
def method_missing(method_name, *args, &block)
result = @client.with_auth { @result.public_send(method_name, *args, &block) }
if result.is_a?(Spyke::Base) || result.is_a?(Spyke::Relation)
RequestWrapper.new(result, @client)
else
result
end
end
|
Instance Method Details
#each_page ⇒ Object
25
26
27
28
29
30
|
# File 'lib/zaikio/hub/client.rb', line 25
def each_page
super() do |page|
page = RequestWrapper.new(page, @client)
yield(page)
end
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
11
12
13
|
# File 'lib/zaikio/hub/client.rb', line 11
def respond_to_missing?(method_name, include_private = false)
@result.respond_to?(method_name, include_private) || super
end
|