Ryze 0.2.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cfbeff4b1caa0fe79b4a7e1fcb47b219f332e4fc8e2835461fa2b08dd88c4ca
4
- data.tar.gz: cb693eb925b0fe22305f35ec8f97260b45c537450534e15c2bd34b8e364abcac
3
+ metadata.gz: 16d56dbc179a28d73d4a5883e868fbfc59e14215b854411a0896c4435a1e2258
4
+ data.tar.gz: c8f83399719110a8df97fcdd1fcebdc67f59cd0064503d4266eb0d40ae52709d
5
5
  SHA512:
6
- metadata.gz: 1e819e04cf37c7dbb378365a6f6b0b7f0b3cff02f340f3ca456b9c06272b67891dae413a89db88332e60918baebbf6b0fd4e46308e3000097b5d8c884691a393
7
- data.tar.gz: 1fd6a0705e23a9cdd85235113de6a50a93f42c5d1521e59346d14b5f7d646ca7c0d06cd4e3540b9bb60801b0e0faf10ca4373a3ea225ec25413b4174c0b6061b
6
+ metadata.gz: dd0efe9ba09fc6070f234678519157773dc5f5a5b90bcf57745aacb9f659c5a779542910aefbc933ab8c2ddd06f4f1c2888e38cb24f1e99a68f68b10b22b7008
7
+ data.tar.gz: 91cfb64cc9a5744c6a7dd424143fa1523b8812a17d6770b614466519e5762aafd320ed9da5bb355cea2cabafe2a90df3359bf4adbf65b839976b48be8c3218ec
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## [0.4.0] - 2023-04-13
2
+
3
+ ### Added
4
+
5
+ - Added new AccountV1 API Endpoints:
6
+ - `getAccountByPuuid`
7
+
8
+
9
+ ## [0.3.0] - 2023-04-12
10
+
11
+ ### Added
12
+
13
+ - Added new `League` Resource.
14
+ - Added new LeagueV4 API Endpoints:
15
+ - `getEntriesBySummonerId`
16
+ - Add documentation for `Object#to_ostruct` method.
17
+ ### Changed
18
+
19
+ - Add default `tag_line` value to `retrieve_account_by_riot_id` method.
20
+ - Fix typo in `Account` object class.
21
+
1
22
  ## [0.2.0] - 2023-04-12
2
23
 
3
24
  - Lots of changes
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Ryze (0.2.0)
4
+ Ryze (0.4.0)
5
5
  addressable (~> 2.7)
6
6
  faraday (~> 2.9.0)
7
7
 
data/README.md CHANGED
@@ -35,7 +35,7 @@ client = Ryze::Client.new(api_key: 'YOUR_API_KEY')
35
35
  You can then use the client to make requests to the Riot API:
36
36
 
37
37
  ```ruby
38
- client.summoner.retrieve_summoner_by_name(summoner_name: 'Faker')
38
+ client.account.retrieve_account_by_riot_id(game_name: 'SAKEN')
39
39
  ```
40
40
 
41
41
  ## Roadmap
@@ -48,7 +48,8 @@ client.summoner.retrieve_summoner_by_name(summoner_name: 'Faker')
48
48
 
49
49
  ## Endpoints
50
50
 
51
- - [x] Summoner-v4
51
+ - [X] Account-v1
52
+ - [X] Summoner-v4
52
53
  - [ ] Match-v5
53
54
  - [ ] Champion-Mastery-v4
54
55
  - [ ] Spectator-V4
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) })
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ryze
4
- # Match is a class corresponding to the AccountDto Riot API object.
4
+ # Account is a class corresponding to the AccountDto Riot API object.
5
5
  class Account < Object; end
6
6
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ryze
4
+ # League is a class corresponding to the LeagueEntryDto Riot API object.
5
+ class League < Object; end
6
+ end
@@ -8,10 +8,18 @@ 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
+
17
+ # Retrieve an account by puuid.
18
+ #
19
+ # @param puuid [String] puuid of the account.
20
+ # @return [Account] Account object.
21
+ def retrieve_account_by_puuid(puuid:)
22
+ Account.new get_request("#{BASE_URL}/by-puuid/#{puuid}").body
23
+ end
16
24
  end
17
25
  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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Ryze
4
4
  # The current version of the Ryze gem.
5
- VERSION = "0.2.0"
5
+ VERSION = "0.4.0"
6
6
  end
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
@@ -2,6 +2,8 @@ module Ryze
2
2
  class AccountResource
3
3
  BASE_URL: String
4
4
 
5
+ def retrieve_account_by_puuid: (puuid: String) -> Account
6
+
5
7
  def retrieve_account_by_riot_id: (game_name: String, tag_line: String) -> Account
6
8
  end
7
9
  end
@@ -0,0 +1,4 @@
1
+ module Ryze
2
+ class League
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module Ryze
2
+ class LeagueResource
3
+ BASE_URL: String
4
+
5
+ def retrieve_leagues_by_summoner_id: (summoner_id: String) -> Array[League]
6
+ end
7
+ end
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.2.0
4
+ version: 0.4.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