Class: LoL::Search
- Inherits:
-
Object
- Object
- LoL::Search
- Defined in:
- lib/captainteemo/search.rb
Instance Method Summary collapse
-
#fetch ⇒ Object
Sends back main data.
-
#fetch_resource ⇒ Object
Send back whole response.
-
#fetch_response ⇒ Object
Send back whole response.
-
#initialize(resource = nil) ⇒ Search
constructor
A new instance of Search.
- #query(platform, query) ⇒ Object
- #resource(resource) ⇒ Object
Constructor Details
#initialize(resource = nil) ⇒ Search
Returns a new instance of Search.
3 4 5 6 7 |
# File 'lib/captainteemo/search.rb', line 3 def initialize(resource=nil) @params = {} @resource = resource.nil? ? '/player/euw/' : resource self end |
Instance Method Details
#fetch ⇒ Object
Sends back main data
23 24 25 |
# File 'lib/captainteemo/search.rb', line 23 def fetch() fetch_response['data'] end |
#fetch_resource ⇒ Object
Send back whole response
34 35 36 37 |
# File 'lib/captainteemo/search.rb', line 34 def fetch_resource response = Api.get(@resource) response.to_hash end |
#fetch_response ⇒ Object
Send back whole response
28 29 30 31 |
# File 'lib/captainteemo/search.rb', line 28 def fetch_response response = Api.get(@resource + @platform + @query) response.to_hash end |
#query(platform, query) ⇒ Object
9 10 11 12 13 |
# File 'lib/captainteemo/search.rb', line 9 def query(platform, query) @platform = "#{platform}/" @query = "#{query}" self end |
#resource(resource) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/captainteemo/search.rb', line 15 def resource(resource) if resource == 'player' then @resource = '/player/' end self end |