Ryze 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +24 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +64 -0
- data/LICENSE.txt +21 -0
- data/README.md +58 -0
- data/Rakefile +12 -0
- data/Ryze.gemspec +30 -0
- data/lib/Ryze/client.rb +39 -0
- data/lib/Ryze/error.rb +6 -0
- data/lib/Ryze/object.rb +25 -0
- data/lib/Ryze/objects/match.rb +6 -0
- data/lib/Ryze/objects/summoner.rb +14 -0
- data/lib/Ryze/resource.rb +42 -0
- data/lib/Ryze/resources/match.rb +28 -0
- data/lib/Ryze/resources/summoner.rb +43 -0
- data/lib/Ryze/version.rb +6 -0
- data/lib/Ryze.rb +17 -0
- data/sig/Ryze.rbs +4 -0
- data/sig/ryze/client.rbs +5 -0
- data/sig/ryze/match.rbs +4 -0
- data/sig/ryze/match_resource.rbs +9 -0
- data/sig/ryze/summoner.rbs +4 -0
- data/sig/ryze/summoner_resource.rbs +13 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9c1ffc8a0a48b952413020566a3adfc125fe69acd7b15286fb6649383683a6b6
|
4
|
+
data.tar.gz: 167af25e1e8087b48e9f67b359cbeb0202347e7a79d4e8990ddcc2248cd88747
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c7483f8ad68979857238802950ce017e8445b8643617d695b9a242c4aba1910525207b1d9e640ffdd1652aa1b478b4a9ddfed78027bac86c2e275103fcd449a7
|
7
|
+
data.tar.gz: 86e97a917c1cc8099610434c1026de42788e72c4a8c651830848be935f9792eb8899b9605cc6014613c2fdf01229dbfa814afaefd7b7b6f3ea58e7f1468cc666
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.6
|
3
|
+
|
4
|
+
Style/StringLiterals:
|
5
|
+
Enabled: true
|
6
|
+
EnforcedStyle: double_quotes
|
7
|
+
|
8
|
+
Style/StringLiteralsInInterpolation:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
Layout/LineLength:
|
13
|
+
Max: 120
|
14
|
+
|
15
|
+
Metrics/BlockLength:
|
16
|
+
ExcludedMethods:
|
17
|
+
- 'describe'
|
18
|
+
- 'context'
|
19
|
+
- 'it'
|
20
|
+
|
21
|
+
Naming/FileName:
|
22
|
+
Exclude:
|
23
|
+
- 'lib/Ryze.rb'
|
24
|
+
- 'spec/Ryze_spec.rb'
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at csapt2001@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
Ryze (0.1.0)
|
5
|
+
faraday (~> 2.7.4)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.2)
|
11
|
+
diff-lcs (1.5.0)
|
12
|
+
faraday (2.7.4)
|
13
|
+
faraday-net_http (>= 2.0, < 3.1)
|
14
|
+
ruby2_keywords (>= 0.0.4)
|
15
|
+
faraday-net_http (3.0.2)
|
16
|
+
json (2.6.3)
|
17
|
+
parallel (1.23.0)
|
18
|
+
parser (3.2.2.1)
|
19
|
+
ast (~> 2.4.1)
|
20
|
+
rainbow (3.1.1)
|
21
|
+
rake (13.0.6)
|
22
|
+
regexp_parser (2.8.0)
|
23
|
+
rexml (3.2.5)
|
24
|
+
rspec (3.12.0)
|
25
|
+
rspec-core (~> 3.12.0)
|
26
|
+
rspec-expectations (~> 3.12.0)
|
27
|
+
rspec-mocks (~> 3.12.0)
|
28
|
+
rspec-core (3.12.2)
|
29
|
+
rspec-support (~> 3.12.0)
|
30
|
+
rspec-expectations (3.12.3)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.12.0)
|
33
|
+
rspec-mocks (3.12.5)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.12.0)
|
36
|
+
rspec-support (3.12.0)
|
37
|
+
rubocop (1.50.2)
|
38
|
+
json (~> 2.3)
|
39
|
+
parallel (~> 1.10)
|
40
|
+
parser (>= 3.2.0.0)
|
41
|
+
rainbow (>= 2.2.2, < 4.0)
|
42
|
+
regexp_parser (>= 1.8, < 3.0)
|
43
|
+
rexml (>= 3.2.5, < 4.0)
|
44
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
45
|
+
ruby-progressbar (~> 1.7)
|
46
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
47
|
+
rubocop-ast (1.28.1)
|
48
|
+
parser (>= 3.2.1.0)
|
49
|
+
ruby-progressbar (1.13.0)
|
50
|
+
ruby2_keywords (0.0.5)
|
51
|
+
unicode-display_width (2.4.2)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
x86_64-darwin-22
|
55
|
+
x86_64-linux
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
Ryze!
|
59
|
+
rake (~> 13.0)
|
60
|
+
rspec (~> 3.0)
|
61
|
+
rubocop (~> 1.21)
|
62
|
+
|
63
|
+
BUNDLED WITH
|
64
|
+
2.4.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Clément Sapt
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Ryze
|
2
|
+
|
3
|
+
Ryze is a Ruby gem that provides a simple interface to the League of Legends Riot API.
|
4
|
+
|
5
|
+
**Please note that this gem is still in development and is not yet ready for production use.**
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add ryze
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install ryze
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
To use the gem, you must first obtain an API key from Riot.
|
20
|
+
You can do so by visiting the [Riot Developer Portal](https://developer.riotgames.com/).
|
21
|
+
|
22
|
+
Than, you can create a new client by passing your API key as an argument:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
require 'ryze'
|
26
|
+
|
27
|
+
client = Client.new(api_key: 'YOUR_API_KEY')
|
28
|
+
```
|
29
|
+
|
30
|
+
You can then use the client to make requests to the Riot API:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
client.summoner.retrieve_summoner_by_name(summoner_name: 'Faker')
|
34
|
+
```
|
35
|
+
|
36
|
+
## Roadmap
|
37
|
+
|
38
|
+
- Finish implementing RBS files
|
39
|
+
- Add methods to Object classes to make it easier to access data
|
40
|
+
- Add tests
|
41
|
+
- Add possibility to change region
|
42
|
+
- Finish implementing all endpoints
|
43
|
+
|
44
|
+
## Endpoints
|
45
|
+
|
46
|
+
- [x] Summoner-v4
|
47
|
+
- [ ] Match-v5
|
48
|
+
- [ ] Champion-Mastery-v4
|
49
|
+
- [ ] Spectator-V4
|
50
|
+
- [ ] League-V4
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/clement0910/Ryze. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/clement0910/Ryze/blob/master/CODE_OF_CONDUCT.md).
|
55
|
+
|
56
|
+
## License
|
57
|
+
|
58
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/Ryze.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/Ryze/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "Ryze"
|
7
|
+
spec.version = Ryze::VERSION
|
8
|
+
spec.authors = ["Clément Sapt"]
|
9
|
+
spec.email = ["clementsapt@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Simple Ruby wrapper for the Riot Games API."
|
12
|
+
spec.description = "Ruby wrapper for the Riot Games API. Riot Games API can be found here: https://developer.riotgames.com/apis"
|
13
|
+
spec.homepage = "https://github.com/clement0910/Ryze"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/clement0910/Ryze"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/clement0910/Ryze/blob/master/CHANGELOG.md"
|
20
|
+
|
21
|
+
spec.files = Dir.chdir(__dir__) do
|
22
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_dependency "faraday", "~> 2.7.4"
|
30
|
+
end
|
data/lib/Ryze/client.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
|
5
|
+
module Ryze
|
6
|
+
# Client is the main entry point for interacting with the Riot API.
|
7
|
+
class Client
|
8
|
+
attr_reader :api_key, :adapter
|
9
|
+
|
10
|
+
# @param api_key [String] Your Riot API key.
|
11
|
+
# @param adapter [Symbol] Faraday adapter.
|
12
|
+
# @param stubs [Faraday::Adapter::Test::Stubs] Faraday stubs.
|
13
|
+
# @return [Client] A new instance of Client.
|
14
|
+
def initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil)
|
15
|
+
@api_key = api_key
|
16
|
+
@adapter = adapter
|
17
|
+
@stubs = stubs
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [SummonerResource] A new instance of SummonerResource.
|
21
|
+
def summoner
|
22
|
+
SummonerResource.new(self)
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [MatchResource] A new instance of MatchResource.
|
26
|
+
def match
|
27
|
+
MatchResource.new(self)
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Faraday::Connection] A new instance of Faraday::Connection or the current instance.
|
31
|
+
def connection
|
32
|
+
@connection ||= Faraday.new do |conn|
|
33
|
+
conn.request :json
|
34
|
+
conn.response :json, content_type: "application/json"
|
35
|
+
conn.adapter adapter, @stubs
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/Ryze/error.rb
ADDED
data/lib/Ryze/object.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
|
5
|
+
module Ryze
|
6
|
+
# Object is a base class for all objects returned from the Riot API.
|
7
|
+
class Object < OpenStruct
|
8
|
+
def initialize(attributes, client = nil)
|
9
|
+
super to_ostruct(attributes)
|
10
|
+
@client = client
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def to_ostruct(obj)
|
16
|
+
if obj.is_a?(Hash)
|
17
|
+
OpenStruct.new(obj.transform_values { |val| to_ostruct(val) })
|
18
|
+
elsif obj.is_a?(Array)
|
19
|
+
obj.map { |o| to_ostruct(o) }
|
20
|
+
else # Assumed to be a primitive value
|
21
|
+
obj
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ryze
|
4
|
+
# Summoner is a class corresponding to the SummonerDto Riot API object.
|
5
|
+
class Summoner < Object
|
6
|
+
# Retrieve the last match of the summoner.
|
7
|
+
#
|
8
|
+
# @return [Match] Match object.
|
9
|
+
def retrieve_last_match
|
10
|
+
match_id = MatchResource.new(@client).retrieve_match_list_by_puuid(puuid: puuid, count: 1).first
|
11
|
+
MatchResource.new(@client).retrieve_match(match_id: match_id)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ryze
|
4
|
+
# Resource is a class that provides a base for all Riot API resources.
|
5
|
+
class Resource
|
6
|
+
attr_reader :client
|
7
|
+
|
8
|
+
def initialize(client)
|
9
|
+
@client = client
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
# Makes a GET request to the Riot API using the Faraday connection.
|
15
|
+
#
|
16
|
+
# @param url [String] The URL to make the request to.
|
17
|
+
# @param params [Hash] The parameters to pass to the request.
|
18
|
+
# @param headers [Hash] The headers to pass to the request additional to the default headers.
|
19
|
+
# @return [Faraday::Response] The response from the Riot API trailed by the Ryze response handler.
|
20
|
+
def get_request(url, params: {}, headers: {})
|
21
|
+
handle_response client.connection.get(@base_url + url, params, default_headers.merge(headers))
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# Handles the response from the Riot API and raises an error if the response is not successful.
|
27
|
+
#
|
28
|
+
# @param response [Faraday::Response] The response from the Riot API.
|
29
|
+
# @return [Faraday::Response] The response from the Riot API.
|
30
|
+
def handle_response(response)
|
31
|
+
if %w[400 401 403 404 405 415 429 500 502 503 504].include?(response.status.to_s)
|
32
|
+
raise Error, "Riot API: #{response.body["status"]["message"]}"
|
33
|
+
end
|
34
|
+
|
35
|
+
response
|
36
|
+
end
|
37
|
+
|
38
|
+
def default_headers
|
39
|
+
{ "X-Riot-Token" => client.api_key }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ryze
|
4
|
+
# MatchResource is a class corresponding to the MatchV5 Riot API endpoint.
|
5
|
+
class MatchResource < Resource
|
6
|
+
def initialize(client)
|
7
|
+
super
|
8
|
+
@base_url = "https://europe.api.riotgames.com/lol/match/v5"
|
9
|
+
end
|
10
|
+
|
11
|
+
# Retrieve a match by match ID.
|
12
|
+
#
|
13
|
+
# @param match_id [String] Match ID.
|
14
|
+
# @return [Match] Match object.
|
15
|
+
def retrieve_match(match_id:)
|
16
|
+
Match.new get_request("/matches/#{match_id}").body
|
17
|
+
end
|
18
|
+
|
19
|
+
# Retrieve a match list by account puuid.
|
20
|
+
#
|
21
|
+
# @param puuid [String] Account puuid.
|
22
|
+
# @param params [Hash] Parameters to pass to the request.
|
23
|
+
# @return [Array<String>] Match IDs.
|
24
|
+
def retrieve_match_list_by_puuid(puuid:, **params)
|
25
|
+
Array.new get_request("/matches/by-puuid/#{puuid}/ids", params: params).body
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ryze
|
4
|
+
# SummonerResource is a class corresponding to the SummonerV4 Riot API endpoint.
|
5
|
+
class SummonerResource < Resource
|
6
|
+
def initialize(client)
|
7
|
+
super
|
8
|
+
@base_url = "https://euw1.api.riotgames.com/lol/summoner/v4"
|
9
|
+
end
|
10
|
+
|
11
|
+
# Retrieve a summoner by summoner name.
|
12
|
+
#
|
13
|
+
# @param summoner_name [String] Summoner name.
|
14
|
+
# @return [Summoner] Summoner object.
|
15
|
+
def retrieve_summoner_by_name(summoner_name:)
|
16
|
+
Summoner.new get_request("/summoners/by-name/#{summoner_name}").body, @client
|
17
|
+
end
|
18
|
+
|
19
|
+
# Retrieve a summoner by summoner puuid.
|
20
|
+
#
|
21
|
+
# @param puuid [String] Summoner puuid.
|
22
|
+
# @return [Summoner] Summoner object.
|
23
|
+
def retrieve_summoner_by_puuid(puuid:)
|
24
|
+
Summoner.new get_request("/summoners/by-puuid/#{puuid}").body, @client
|
25
|
+
end
|
26
|
+
|
27
|
+
# Retrieve a summoner by summoner account ID.
|
28
|
+
#
|
29
|
+
# @param account_id [String] Summoner account ID.
|
30
|
+
# @return [Summoner] Summoner object.
|
31
|
+
def retrieve_summoner_by_account_id(account_id:)
|
32
|
+
Summoner.new get_request("/summoners/by-account/#{account_id}").body, @client
|
33
|
+
end
|
34
|
+
|
35
|
+
# Retrieve a summoner by summoner ID.
|
36
|
+
#
|
37
|
+
# @param summoner_id [String] Summoner ID.
|
38
|
+
# @return [Summoner] Summoner object.
|
39
|
+
def retrieve_summoner_by_summoner_id(summoner_id:)
|
40
|
+
Summoner.new get_request("/summoners/#{summoner_id}").body, @client
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/Ryze/version.rb
ADDED
data/lib/Ryze.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "Ryze/version"
|
4
|
+
|
5
|
+
# The main module for the gem.
|
6
|
+
module Ryze
|
7
|
+
autoload :Client, "Ryze/client"
|
8
|
+
autoload :Error, "Ryze/error"
|
9
|
+
autoload :Object, "Ryze/object"
|
10
|
+
autoload :Resource, "Ryze/resource"
|
11
|
+
|
12
|
+
autoload :Summoner, "Ryze/objects/summoner"
|
13
|
+
autoload :Match, "Ryze/objects/match"
|
14
|
+
|
15
|
+
autoload :SummonerResource, "Ryze/resources/summoner"
|
16
|
+
autoload :MatchResource, "Ryze/resources/match"
|
17
|
+
end
|
data/sig/Ryze.rbs
ADDED
data/sig/ryze/client.rbs
ADDED
data/sig/ryze/match.rbs
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module Ryze
|
2
|
+
class SummonerResource < Resource
|
3
|
+
@base_url: String
|
4
|
+
|
5
|
+
def retrieve_summoner_by_name: (summoner_name: String) -> Sumonner
|
6
|
+
|
7
|
+
def retrieve_summoner_by_puuid: (puuid: String) -> Sumonner
|
8
|
+
|
9
|
+
def retrieve_summoner_by_account_id: (account_id: String) -> Sumonner
|
10
|
+
|
11
|
+
def retrieve_summoner_by_summoner_id: (summoner_id: String) -> Sumonner
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Ryze
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Clément Sapt
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-05-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.7.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.7.4
|
27
|
+
description: 'Ruby wrapper for the Riot Games API. Riot Games API can be found here:
|
28
|
+
https://developer.riotgames.com/apis'
|
29
|
+
email:
|
30
|
+
- clementsapt@gmail.com
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".rspec"
|
36
|
+
- ".rubocop.yml"
|
37
|
+
- CHANGELOG.md
|
38
|
+
- CODE_OF_CONDUCT.md
|
39
|
+
- Gemfile
|
40
|
+
- Gemfile.lock
|
41
|
+
- LICENSE.txt
|
42
|
+
- README.md
|
43
|
+
- Rakefile
|
44
|
+
- Ryze.gemspec
|
45
|
+
- lib/Ryze.rb
|
46
|
+
- lib/Ryze/client.rb
|
47
|
+
- lib/Ryze/error.rb
|
48
|
+
- lib/Ryze/object.rb
|
49
|
+
- lib/Ryze/objects/match.rb
|
50
|
+
- lib/Ryze/objects/summoner.rb
|
51
|
+
- lib/Ryze/resource.rb
|
52
|
+
- lib/Ryze/resources/match.rb
|
53
|
+
- lib/Ryze/resources/summoner.rb
|
54
|
+
- lib/Ryze/version.rb
|
55
|
+
- sig/Ryze.rbs
|
56
|
+
- sig/ryze/client.rbs
|
57
|
+
- sig/ryze/match.rbs
|
58
|
+
- sig/ryze/match_resource.rbs
|
59
|
+
- sig/ryze/summoner.rbs
|
60
|
+
- sig/ryze/summoner_resource.rbs
|
61
|
+
homepage: https://github.com/clement0910/Ryze
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata:
|
65
|
+
homepage_uri: https://github.com/clement0910/Ryze
|
66
|
+
source_code_uri: https://github.com/clement0910/Ryze
|
67
|
+
changelog_uri: https://github.com/clement0910/Ryze/blob/master/CHANGELOG.md
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.6.0
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubygems_version: 3.4.1
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Simple Ruby wrapper for the Riot Games API.
|
87
|
+
test_files: []
|