Class: Lolxin::Match
- Inherits:
-
Object
- Object
- Lolxin::Match
- Defined in:
- lib/lolxin/api/match.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
Instance Method Summary collapse
- #by_account(account_id, recent = false) ⇒ Object
- #by_match(match_id) ⇒ Object
-
#initialize(options = {}) ⇒ Match
constructor
TODO: many endpoints to change and many DTOs to add.
- #matches(match_id) ⇒ Object
- #tournament_code(tournament_code, match_id) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Match
TODO: many endpoints to change and many DTOs to add
6 7 8 9 |
# File 'lib/lolxin/api/match.rb', line 6 def initialize( = {}) super @endpoint = "match/%{version}" % {version: @version} end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/lolxin/api/match.rb', line 3 def endpoint @endpoint end |
Instance Method Details
#by_account(account_id, recent = false) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/lolxin/api/match.rb', line 16 def by_account(account_id, recent = false) url = if recent "#{endpoint}/matchlists/by-account/#{account_id}/recent" else "#{endpoint}/matchlists/by-account/#{account_id}" end conn.get(url) end |
#by_match(match_id) ⇒ Object
26 27 28 29 |
# File 'lib/lolxin/api/match.rb', line 26 def by_match(match_id) url = "#{endpoint}/timelines/by-match/#{match_id}" conn.get(url) end |
#matches(match_id) ⇒ Object
11 12 13 14 |
# File 'lib/lolxin/api/match.rb', line 11 def matches(match_id) url = "#{endpoint}/matches/#{match_id}" conn.get(url) end |
#tournament_code(tournament_code, match_id) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/lolxin/api/match.rb', line 31 def tournament_code(tournament_code, match_id) url = if tournament_code && match_id "matches/by-tournament-code/#{tournament_code}/ids" else "matches/#{match_id}/by-tournament-code/#{tournament_code}" end conn.get(url) end |