Sha256: 28c8fdaf68d4b23b43b629b44a45346dc8b44897a5ba56d06b29c4c1d83fcac5

Contents?: true

Size: 1015 Bytes

Versions: 1

Compression:

Stored size: 1015 Bytes

Contents

module Lolxin
  class Match
    attr_accessor :endpoint

    # TODO: many endpoints to change and many DTOs to add
    def initialize(options = {})
      super
      @endpoint = "match/%{version}" % {version: @version}
    end

    def matches(match_id)
      url = "#{endpoint}/matches/#{match_id}"
      conn.get(url)
    end

    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

    def by_match(match_id)
      url = "#{endpoint}/timelines/by-match/#{match_id}"
      conn.get(url)
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lolxin-0.13.0 lib/lolxin/api/match.rb