Class: Ryze::MatchResource

Inherits:
Resource show all
Defined in:
lib/Ryze/resources/match.rb

Overview

MatchResource is a class corresponding to the MatchV5 Riot API endpoint.

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ MatchResource

Returns a new instance of MatchResource.



6
7
8
9
# File 'lib/Ryze/resources/match.rb', line 6

def initialize(client)
  super
  @base_url = "https://europe.api.riotgames.com/lol/match/v5"
end

Instance Method Details

#retrieve_match(match_id:) ⇒ Match

Retrieve a match by match ID.

Parameters:

  • match_id (String)

    Match ID.

Returns:

  • (Match)

    Match object.



15
16
17
# File 'lib/Ryze/resources/match.rb', line 15

def retrieve_match(match_id:)
  Match.new get_request("/matches/#{match_id}").body
end

#retrieve_match_list_by_puuid(puuid:, **params) ⇒ Array<String>

Retrieve a match list by account puuid.

Parameters:

  • puuid (String)

    Account puuid.

  • params (Hash)

    Parameters to pass to the request.

Returns:

  • (Array<String>)

    Match IDs.



24
25
26
# File 'lib/Ryze/resources/match.rb', line 24

def retrieve_match_list_by_puuid(puuid:, **params)
  Array.new get_request("/matches/by-puuid/#{puuid}/ids", params: params).body
end