Module: RiotAPI::Requester
- Defined in:
- lib/riot_api/requester.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/riot_api/requester.rb', line 18
def method_missing(meth, *args, &block)
if meth.to_s =~ /^find_(.+)$/
call($1, *args, &block)
else
super
end
end
|
Instance Method Details
#call(action, *args, &block) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/riot_api/requester.rb', line 8
def call(action, *args, &block)
if action =~ /by_(.+)$/
url = self.send action, *args[0]
else
url = self.send action
end
response = conn.get url + "?api_key=#{API.key}"
response.body
end
|
#conn ⇒ Object
4
5
6
|
# File 'lib/riot_api/requester.rb', line 4
def conn
@conn ||= Faraday.new
end
|