Module: Decathlon::Sports
- Defined in:
- lib/decathlon/sports.rb,
lib/decathlon/sports/sport.rb,
lib/decathlon/sports/version.rb,
lib/decathlon/sports/recommendation.rb
Defined Under Namespace
Modules: Recommendations
Constant Summary collapse
- VERSION =
'0.2.0'.freeze
Class Method Summary collapse
- .all(url: "#{API_URL}/sports", params: {}, headers: {}) ⇒ Object
- .call(url: API_URL, params: {}, headers: {}) ⇒ Object
- .find(id, params: {}, headers: {}) ⇒ Object
- .isearch(query, params: {}, headers: {}) ⇒ Object
- .search(query, params: {}, headers: {}) ⇒ Object
Instance Method Summary collapse
Class Method Details
.all(url: "#{API_URL}/sports", params: {}, headers: {}) ⇒ Object
13 14 15 |
# File 'lib/decathlon/sports/sport.rb', line 13 def self.all(url: "#{API_URL}/sports", params: {}, headers: {}) call(url: url, params: params, headers: headers) end |
.call(url: API_URL, params: {}, headers: {}) ⇒ Object
8 9 10 11 |
# File 'lib/decathlon/sports/sport.rb', line 8 def self.call(url: API_URL, params: {}, headers: {}) response = Faraday.get(url, params, headers) JSON.parse(response.body) end |
.find(id, params: {}, headers: {}) ⇒ Object
17 18 19 |
# File 'lib/decathlon/sports/sport.rb', line 17 def self.find(id, params: {}, headers: {}) call(url: "#{API_URL}/sports/#{id}", params: params, headers: headers) end |
.isearch(query, params: {}, headers: {}) ⇒ Object
25 26 27 |
# File 'lib/decathlon/sports/sport.rb', line 25 def self.isearch(query, params: {}, headers: {}) call(url: "#{API_URL}/sports/search/#{query}", params: params, headers: headers) end |
.search(query, params: {}, headers: {}) ⇒ Object
21 22 23 |
# File 'lib/decathlon/sports/sport.rb', line 21 def self.search(query, params: {}, headers: {}) call(url: "#{API_URL}/sports?q=#{query}", params: params, headers: headers) end |