Ryze 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +1 -1
- data/lib/Ryze/client.rb +5 -0
- data/lib/Ryze/object.rb +4 -0
- data/lib/Ryze/objects/account.rb +1 -1
- data/lib/Ryze/objects/league.rb +6 -0
- data/lib/Ryze/resources/account.rb +2 -2
- data/lib/Ryze/resources/league.rb +17 -0
- data/lib/Ryze/version.rb +1 -1
- data/lib/Ryze.rb +2 -0
- data/sig/Ryze/league.rbs +4 -0
- data/sig/Ryze/league_resource.rbs +7 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 022f779e8ab8a60dec3e9ae05088fc9322cb6431be38ad3db9105f15fa9937c2
|
4
|
+
data.tar.gz: b56d086d609eec980b1d94563b0dcdbca86c6e49c4f74bad304df1d290e430f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 142e7978ea034bae188195f97b729e4cbf89b05f286d2364e480f541052955065688b79d0d20e7395a61819b36aeb670e7e977e223e004bf986292fa01ecd20f
|
7
|
+
data.tar.gz: '08837d3d0afbfdcfe4e6e7a3e3c3590ef984dfda6bea2b36611fc94ef52501821ba9989830647712c3b57b45970c6dd49e636974cb7e6ca14575ae7fc254946d'
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## [0.3.0] - 2023-04-12
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
- Added new `League` Resource.
|
6
|
+
- Added new LeagueV4 API Endpoints:
|
7
|
+
- `getEntriesBySummonerId`
|
8
|
+
- Add documentation for `Object#to_ostruct` method.
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- Add default `tag_line` value to `retrieve_account_by_riot_id` method.
|
12
|
+
- Fix typo in `Account` object class.
|
13
|
+
|
1
14
|
## [0.2.0] - 2023-04-12
|
2
15
|
|
3
16
|
- Lots of changes
|
data/Gemfile.lock
CHANGED
data/lib/Ryze/client.rb
CHANGED
@@ -37,6 +37,11 @@ module Ryze
|
|
37
37
|
SpectatorResource.new(self)
|
38
38
|
end
|
39
39
|
|
40
|
+
# @return [LeagueResource] A new instance of LeagueResource.
|
41
|
+
def league
|
42
|
+
LeagueResource.new(self)
|
43
|
+
end
|
44
|
+
|
40
45
|
# @return [Faraday::Connection] A new instance of Faraday::Connection or the current instance.
|
41
46
|
def connection
|
42
47
|
@connection ||= Faraday.new do |conn|
|
data/lib/Ryze/object.rb
CHANGED
@@ -11,6 +11,10 @@ module Ryze
|
|
11
11
|
|
12
12
|
private
|
13
13
|
|
14
|
+
# Convert a hash to an OpenStruct recursively.
|
15
|
+
#
|
16
|
+
# @param obj [Hash, Array, ::Object] The object to convert.
|
17
|
+
# @return [OpenStruct, Array, ::Object] The converted object.
|
14
18
|
def to_ostruct(obj)
|
15
19
|
if obj.is_a?(Hash)
|
16
20
|
OpenStruct.new(obj.transform_values { |val| to_ostruct(val) })
|
data/lib/Ryze/objects/account.rb
CHANGED
@@ -8,9 +8,9 @@ module Ryze
|
|
8
8
|
# Retrieve an account by Riot ID.
|
9
9
|
#
|
10
10
|
# @param game_name [String] Game name of the account.
|
11
|
-
# @param tag_line [String] Tag line of the account.
|
11
|
+
# @param tag_line [String] Tag line of the account. Default is 'EUW'.
|
12
12
|
# @return [Account] Account object.
|
13
|
-
def retrieve_account_by_riot_id(game_name:, tag_line:)
|
13
|
+
def retrieve_account_by_riot_id(game_name:, tag_line: "EUW")
|
14
14
|
Account.new get_request("#{BASE_URL}/by-riot-id/#{game_name}/#{tag_line}").body
|
15
15
|
end
|
16
16
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ryze
|
4
|
+
# LeagueResource is a class corresponding to the LeagueV4 Riot API endpoint.
|
5
|
+
class LeagueResource < Resource
|
6
|
+
BASE_URL = "https://euw1.api.riotgames.com/lol/league/v4"
|
7
|
+
|
8
|
+
# Retrieve the summoner's leagues by summoner ID.
|
9
|
+
#
|
10
|
+
# @param summoner_id [String] Summoner ID.
|
11
|
+
# @return [Array<League>] League objects.
|
12
|
+
def retrieve_leagues_by_summoner_id(summoner_id:)
|
13
|
+
leagues = get_request("#{BASE_URL}/entries/by-summoner/#{summoner_id}").body
|
14
|
+
leagues.map(&League.method(:new))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/Ryze/version.rb
CHANGED
data/lib/Ryze.rb
CHANGED
@@ -12,10 +12,12 @@ module Ryze
|
|
12
12
|
autoload :Summoner, "Ryze/objects/summoner"
|
13
13
|
autoload :Match, "Ryze/objects/match"
|
14
14
|
autoload :Account, "Ryze/objects/account"
|
15
|
+
autoload :League, "Ryze/objects/league"
|
15
16
|
autoload :Spectator, "Ryze/objects/spectator"
|
16
17
|
|
17
18
|
autoload :SummonerResource, "Ryze/resources/summoner"
|
18
19
|
autoload :MatchResource, "Ryze/resources/match"
|
19
20
|
autoload :AccountResource, "Ryze/resources/account"
|
21
|
+
autoload :LeagueResource, "Ryze/resources/league"
|
20
22
|
autoload :SpectatorResource, "Ryze/resources/spectator"
|
21
23
|
end
|
data/sig/Ryze/league.rbs
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Ryze
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clément Sapt
|
@@ -60,11 +60,13 @@ files:
|
|
60
60
|
- lib/Ryze/error.rb
|
61
61
|
- lib/Ryze/object.rb
|
62
62
|
- lib/Ryze/objects/account.rb
|
63
|
+
- lib/Ryze/objects/league.rb
|
63
64
|
- lib/Ryze/objects/match.rb
|
64
65
|
- lib/Ryze/objects/spectator.rb
|
65
66
|
- lib/Ryze/objects/summoner.rb
|
66
67
|
- lib/Ryze/resource.rb
|
67
68
|
- lib/Ryze/resources/account.rb
|
69
|
+
- lib/Ryze/resources/league.rb
|
68
70
|
- lib/Ryze/resources/match.rb
|
69
71
|
- lib/Ryze/resources/spectator.rb
|
70
72
|
- lib/Ryze/resources/summoner.rb
|
@@ -73,6 +75,8 @@ files:
|
|
73
75
|
- sig/Ryze/account.rbs
|
74
76
|
- sig/Ryze/account_resource.rbs
|
75
77
|
- sig/Ryze/client.rbs
|
78
|
+
- sig/Ryze/league.rbs
|
79
|
+
- sig/Ryze/league_resource.rbs
|
76
80
|
- sig/Ryze/match.rbs
|
77
81
|
- sig/Ryze/match_resource.rbs
|
78
82
|
- sig/Ryze/spectator.rbs
|