Class: Lolxin::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/lolxin/api/match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  super
  @endpoint = "match/%{version}" % {version: @version}
end

Instance Attribute Details

#endpointObject

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 (, recent = false)
  url = if recent
          "#{endpoint}/matchlists/by-account/#{}/recent"
        else
          "#{endpoint}/matchlists/by-account/#{}"
        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