Ryze 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cfbeff4b1caa0fe79b4a7e1fcb47b219f332e4fc8e2835461fa2b08dd88c4ca
4
- data.tar.gz: cb693eb925b0fe22305f35ec8f97260b45c537450534e15c2bd34b8e364abcac
3
+ metadata.gz: 022f779e8ab8a60dec3e9ae05088fc9322cb6431be38ad3db9105f15fa9937c2
4
+ data.tar.gz: b56d086d609eec980b1d94563b0dcdbca86c6e49c4f74bad304df1d290e430f9
5
5
  SHA512:
6
- metadata.gz: 1e819e04cf37c7dbb378365a6f6b0b7f0b3cff02f340f3ca456b9c06272b67891dae413a89db88332e60918baebbf6b0fd4e46308e3000097b5d8c884691a393
7
- data.tar.gz: 1fd6a0705e23a9cdd85235113de6a50a93f42c5d1521e59346d14b5f7d646ca7c0d06cd4e3540b9bb60801b0e0faf10ca4373a3ea225ec25413b4174c0b6061b
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Ryze (0.2.0)
4
+ Ryze (0.3.0)
5
5
  addressable (~> 2.7)
6
6
  faraday (~> 2.9.0)
7
7
 
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,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
@@ -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.3.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
@@ -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.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