starcall 0.1.1 → 0.5.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/.github/workflows/tests.yaml +20 -0
- data/.rakeTasks +1 -1
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +112 -0
- data/Gemfile.lock +8 -2
- data/README.md +171 -8
- data/Rakefile +1 -1
- data/lib/starcall.rb +6 -1
- data/lib/starcall/api_requests.rb +7 -4
- data/lib/starcall/endpoints/champion_mastery_v4.rb +45 -0
- data/lib/starcall/endpoints/champion_v3.rb +26 -0
- data/lib/starcall/endpoints/clash_v1.rb +61 -0
- data/lib/starcall/endpoints/endpoints.rb +6 -0
- data/lib/starcall/endpoints/summoner_v4.rb +53 -0
- data/lib/starcall/errors/errors.rb +4 -0
- data/lib/starcall/errors/invalid_language.rb +21 -0
- data/lib/starcall/errors/invalid_region.rb +21 -0
- data/lib/starcall/helpers/region_parser.rb +30 -0
- data/lib/starcall/languages.rb +49 -0
- data/lib/starcall/regions.rb +30 -0
- data/lib/starcall/static_data.rb +47 -42
- data/lib/starcall/version.rb +1 -1
- data/starcall.gemspec +2 -1
- metadata +31 -5
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e6005cf053fb73f0bd6dc29b8f0f9384ac3df2494428a1adb2ef891c968591d
|
|
4
|
+
data.tar.gz: f87360fdb12ee7f030b1d87fb4572d7d081d0d82564a18488b8fd187eda3568c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ed33c6040ec1ffa32af6b2f5779066193eaffed0678dcb37ac5e58a1748615faf09d3140042ebc509d3532d59e08978269142e0e87ef3fe26b816aae0d62628a
|
|
7
|
+
data.tar.gz: cb5f5a86413892a3d5f117b8880883e2414b9111da40588da013c2133c03c75621a44b5a28f860d5bbdf325c652778c5e8fe6b2141af034b0c4f6622e68bdfd7
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
env:
|
|
2
|
+
RUBY_VERSION: 2.6
|
|
3
|
+
|
|
4
|
+
name: tests
|
|
5
|
+
on: [push]
|
|
6
|
+
jobs:
|
|
7
|
+
rubocop-and-rspec:
|
|
8
|
+
name: Rubocop and Rspec
|
|
9
|
+
runs-on: ubuntu-18.04
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v1
|
|
12
|
+
- uses: actions/setup-ruby@v1
|
|
13
|
+
with:
|
|
14
|
+
ruby-version: ${{ env.RUBY_VERSION }}
|
|
15
|
+
- name: Install dependencies
|
|
16
|
+
run: |
|
|
17
|
+
gem install bundler
|
|
18
|
+
bundle install
|
|
19
|
+
- name: Check code
|
|
20
|
+
run: bundle exec rake github:run
|
data/.rakeTasks
CHANGED
|
@@ -4,4 +4,4 @@ You are allowed to:
|
|
|
4
4
|
1. Remove rake task
|
|
5
5
|
2. Add existing rake tasks
|
|
6
6
|
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
-
--><RakeGroup description="" fullCmd="" taksId="rake"
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Change log
|
|
2
|
+
|
|
3
|
+
## master (unreleased)
|
|
4
|
+
|
|
5
|
+
### New features
|
|
6
|
+
None
|
|
7
|
+
|
|
8
|
+
### Changes
|
|
9
|
+
None
|
|
10
|
+
|
|
11
|
+
### Bug fixes
|
|
12
|
+
None
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## v0.5.0 - Anivia
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
### New features
|
|
20
|
+
- Add Clash V1 endpoint.
|
|
21
|
+
- Add the summoner endpoint.
|
|
22
|
+
|
|
23
|
+
### Changes
|
|
24
|
+
None
|
|
25
|
+
|
|
26
|
+
### Bug fixes
|
|
27
|
+
- Add Champion V3 to the endpoints file, making it accessible.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## v0.4.0 - Amumu
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
### New features
|
|
35
|
+
- Added the champion endpoints.
|
|
36
|
+
|
|
37
|
+
### Changes
|
|
38
|
+
None
|
|
39
|
+
|
|
40
|
+
### Bug fixes
|
|
41
|
+
None
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## v0.3.0 - Alistar
|
|
46
|
+

|
|
47
|
+
|
|
48
|
+
### New features
|
|
49
|
+
- Added the 3 Champion Mastery Endpoints.
|
|
50
|
+
- `ApiRequests` now checks for an API key called `RIOT_API_KEY` and adds to the headers.
|
|
51
|
+
- Added a region parser as the API URLs require a region, but they are not the same as the normal regions.
|
|
52
|
+
|
|
53
|
+
### Changes
|
|
54
|
+
- Move `ApiRequests` under the `Starcall` namespace.
|
|
55
|
+
- Move errors in to their own directory.
|
|
56
|
+
|
|
57
|
+
### Bug fixes
|
|
58
|
+
None
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## v0.2.1 - Akali
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
### New features
|
|
66
|
+
None
|
|
67
|
+
|
|
68
|
+
### Changes
|
|
69
|
+
None
|
|
70
|
+
|
|
71
|
+
### Bug fixes
|
|
72
|
+
- The program now functions correctly with the details in the read me.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## v0.2.0 - Ahri
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
### New features
|
|
80
|
+
- Regions
|
|
81
|
+
- `Starcall::Regions.list` for a full list of supported regions.
|
|
82
|
+
- Static data that can change per region and now supports different regions.
|
|
83
|
+
|
|
84
|
+
- Languages
|
|
85
|
+
- `Starcall::Languages.list` for a full list of supported languages.
|
|
86
|
+
- Static data comes in different languages and now supports different languages.
|
|
87
|
+
|
|
88
|
+
### Changes
|
|
89
|
+
- `Starcall::StaticData` now needs to be initialised. Can be initialised with a region and a language.
|
|
90
|
+
If none is supplied, `euw` and `en_GB` is assumed.
|
|
91
|
+
- `dd_euw_versions` has now become `dd_region_versions` defaulting to `euw` if no region has been supplied.
|
|
92
|
+
- Errors
|
|
93
|
+
- An error module has now been created where custom errors will be stored.
|
|
94
|
+
|
|
95
|
+
### Bug fixes
|
|
96
|
+
None
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## v0.1.1 - Aatrox
|
|
101
|
+

|
|
102
|
+
|
|
103
|
+
### New features
|
|
104
|
+
- Riot API static endpoints
|
|
105
|
+
|
|
106
|
+
### Changes
|
|
107
|
+
None
|
|
108
|
+
|
|
109
|
+
### Bug fixes
|
|
110
|
+
None
|
|
111
|
+
|
|
112
|
+
-----
|
data/Gemfile.lock
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
starcall (0.
|
|
4
|
+
starcall (0.5.0)
|
|
5
5
|
httparty (~> 0.17)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
10
|
ast (2.4.1)
|
|
11
|
+
coderay (1.1.3)
|
|
11
12
|
diff-lcs (1.3)
|
|
12
13
|
httparty (0.18.1)
|
|
13
14
|
mime-types (~> 3.0)
|
|
14
15
|
multi_xml (>= 0.5.2)
|
|
16
|
+
method_source (1.0.0)
|
|
15
17
|
mime-types (3.3.1)
|
|
16
18
|
mime-types-data (~> 3.2015)
|
|
17
19
|
mime-types-data (3.2020.0512)
|
|
@@ -19,6 +21,9 @@ GEM
|
|
|
19
21
|
parallel (1.19.2)
|
|
20
22
|
parser (2.7.1.4)
|
|
21
23
|
ast (~> 2.4.1)
|
|
24
|
+
pry (0.13.1)
|
|
25
|
+
coderay (~> 1.1)
|
|
26
|
+
method_source (~> 1.0)
|
|
22
27
|
rainbow (3.0.0)
|
|
23
28
|
rake (12.3.3)
|
|
24
29
|
regexp_parser (1.7.1)
|
|
@@ -58,6 +63,7 @@ PLATFORMS
|
|
|
58
63
|
|
|
59
64
|
DEPENDENCIES
|
|
60
65
|
bundler (~> 2.0)
|
|
66
|
+
pry (~> 0.13)
|
|
61
67
|
rake (~> 12.3)
|
|
62
68
|
rspec (~> 3.0)
|
|
63
69
|
rubocop (~> 0.86)
|
|
@@ -65,4 +71,4 @@ DEPENDENCIES
|
|
|
65
71
|
starcall!
|
|
66
72
|
|
|
67
73
|
BUNDLED WITH
|
|
68
|
-
2.
|
|
74
|
+
2.1.4
|
data/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
3
|
----
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
6
7
|
---
|
|
7
8
|
A Gem to help with calls to Riot API.
|
|
8
9
|
|
|
@@ -23,11 +24,41 @@ Or install it yourself as:
|
|
|
23
24
|
|
|
24
25
|
## Usage
|
|
25
26
|
|
|
27
|
+
### Regions
|
|
28
|
+
Sometimes, due to manual upload speeds, versions in different regions might be different or due to things like version specific bugs.
|
|
29
|
+
Due to this, if you are looking for details of a specific region, it worth checking there rather than generically.
|
|
30
|
+
|
|
31
|
+
A full list of supported regions can be obtained by running:
|
|
32
|
+
```ruby
|
|
33
|
+
Starcall::Regions.list
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Languages
|
|
37
|
+
Things such as champion data is avalible in different languages.
|
|
38
|
+
|
|
39
|
+
A full list of supported languages can be obtained by running:
|
|
40
|
+
```ruby
|
|
41
|
+
Starcall::Languages.list
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
26
45
|
### Static Queries
|
|
27
46
|
|
|
28
|
-
|
|
47
|
+
First you need to initialise and instance of Starcall::StaticData
|
|
48
|
+
```ruby
|
|
49
|
+
static_data = Starcall::StaticData.new
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Some of the queries below can return different data based on the region. When you initialize the class, you can pass in a valid region.
|
|
53
|
+
Regions that Riot support can be queried as per the Regions section above.
|
|
54
|
+
If no region is supplied, 'euw' will be assumed.
|
|
55
|
+
|
|
56
|
+
Some of the queries below can be returned in different languages.
|
|
57
|
+
Languages that Riot support can be queried as per the Languages section above.
|
|
58
|
+
If no language is supplied, 'en_GB' (English Great Britain) will be assumed.
|
|
59
|
+
|
|
29
60
|
```ruby
|
|
30
|
-
Starcall::StaticData.
|
|
61
|
+
Starcall::StaticData.new(region: 'kr', language: 'ko_KR')
|
|
31
62
|
```
|
|
32
63
|
|
|
33
64
|
#### `season_ids`
|
|
@@ -52,7 +83,7 @@ A full list of game types can be can be retrieved with the below method.
|
|
|
52
83
|
#### Data Dragon
|
|
53
84
|
Data Dragon is Riots way of centralizing League of Legends game data and assets, including champions, items, runes, summoner spells, and profile icons.
|
|
54
85
|
All of which can be used by third-party developers.
|
|
55
|
-
Please be aware that Riot update Data Dragon after each League of Legends
|
|
86
|
+
Please be aware that Riot update Data Dragon after each League of Legends manually, so it is not always updated immediately after a patch.
|
|
56
87
|
|
|
57
88
|
#### `dd_versions`
|
|
58
89
|
All valid Data Dragon versions can be can be retrieved with the below method.
|
|
@@ -61,28 +92,160 @@ however occasionally there will be additional builds.
|
|
|
61
92
|
This typically occurs when there's an error in the original build.
|
|
62
93
|
As such, you should always use the most recent Data Dragon version for a given patch for the best results.
|
|
63
94
|
|
|
64
|
-
#### `
|
|
95
|
+
#### `dd_region_versions`
|
|
96
|
+
|
|
65
97
|
Data Dragon versions aren't always equivalent to the League of Legends client version in a region.
|
|
66
98
|
You can find the version each region is using via the realms files.
|
|
67
|
-
This function returns the EWU versions
|
|
68
99
|
|
|
69
100
|
#### `dd_champions`
|
|
101
|
+
|
|
70
102
|
This returns a list of all champion with a brief summary, including stats, id and blurb.
|
|
71
103
|
|
|
72
104
|
#### `dd_specific_champion(champion_name:)`
|
|
73
|
-
|
|
105
|
+
|
|
106
|
+
For more detailed and specific information about a champion, this call can be used.
|
|
74
107
|
|
|
75
108
|
#### `dd_items`
|
|
109
|
+
|
|
76
110
|
Data Dragon also provides detail for every item in the game.
|
|
77
111
|
with this method you can find info such as the item's description, purchase value, sell value,
|
|
78
112
|
items it builds from, items it builds into, and stats granted from the item.
|
|
79
113
|
|
|
80
114
|
#### `dd_summoner_spells`
|
|
115
|
+
|
|
81
116
|
Details about summoner spells.
|
|
82
117
|
|
|
83
118
|
#### `dd_profile_icons`
|
|
119
|
+
|
|
84
120
|
Details about profile icons and where they can be found on the sprite sheets.
|
|
85
121
|
|
|
122
|
+
## Endpoints
|
|
123
|
+
The below commands require a Riot API key.
|
|
124
|
+
It needs to be saved as an ENV var and called `RIOT_API_KEY`
|
|
125
|
+
### SummonerV4
|
|
126
|
+
#### `by_account_id`
|
|
127
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#summoner-v4/GET_getByAccountId)
|
|
128
|
+
|
|
129
|
+
Required fields:
|
|
130
|
+
- `encrypted_summoner_id` (The encrypted summoner ID for the summoner you want to know about.)
|
|
131
|
+
- `region` (The region that the summoner is in.)
|
|
132
|
+
|
|
133
|
+
Optional fields:
|
|
134
|
+
None
|
|
135
|
+
|
|
136
|
+
#### `by_summoner_name`
|
|
137
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#summoner-v4/GET_getBySummonerName)
|
|
138
|
+
|
|
139
|
+
Required fields:
|
|
140
|
+
- `summoner_name` (The summoner name for the summoner you want to know about.)
|
|
141
|
+
- `region` (The region that the summoner is in.)
|
|
142
|
+
|
|
143
|
+
Optional fields:
|
|
144
|
+
None
|
|
145
|
+
|
|
146
|
+
#### `by_puuid`
|
|
147
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#summoner-v4/GET_getByPUUID)
|
|
148
|
+
|
|
149
|
+
Required fields:
|
|
150
|
+
- `puuid` (The puuid for the summoner you want to know about.)
|
|
151
|
+
- `region` (The region that the summoner is in.)
|
|
152
|
+
|
|
153
|
+
Optional fields:
|
|
154
|
+
None
|
|
155
|
+
|
|
156
|
+
#### `by_summoner_id`
|
|
157
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#summoner-v4/GET_getBySummonerId)
|
|
158
|
+
|
|
159
|
+
Required fields:
|
|
160
|
+
- `summoner_id` (The summoner id for the summoner you want to know about.)
|
|
161
|
+
- `region` (The region that the summoner is in.)
|
|
162
|
+
|
|
163
|
+
Optional fields:
|
|
164
|
+
None
|
|
165
|
+
|
|
166
|
+
### Champion Mastery V4
|
|
167
|
+
|
|
168
|
+
#### `summoner`
|
|
169
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#champion-mastery-v4/GET_getAllChampionMasteries)
|
|
170
|
+
|
|
171
|
+
Required fields:
|
|
172
|
+
- `encrypted_summoner_id` (The encrypted summoner ID for the summoner you want to know about.)
|
|
173
|
+
- `region` (The region that the summoner is in.)
|
|
174
|
+
|
|
175
|
+
#### `summoner_on_champion`
|
|
176
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#champion-mastery-v4/GET_getChampionMastery)
|
|
177
|
+
|
|
178
|
+
Required fields:
|
|
179
|
+
- `encrypted_summoner_id` (The encrypted summoner ID for the summoner you want to know about.)
|
|
180
|
+
- `champion_id` (The ID number of the champion that you want to know about.)
|
|
181
|
+
- `region` (The region that the summoner is in.)
|
|
182
|
+
|
|
183
|
+
#### `summoner_total_mastery`
|
|
184
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#champion-mastery-v4/GET_getChampionMasteryScore)
|
|
185
|
+
|
|
186
|
+
Required fields:
|
|
187
|
+
- `encrypted_summoner_id` (the encrypted summoner ID for the summoner you want to know about.)
|
|
188
|
+
- `region` (The region that the summoner is in.)
|
|
189
|
+
|
|
190
|
+
### Champion V3
|
|
191
|
+
#### `champion_rotations`
|
|
192
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#champion-v3/GET_getChampionInfo)
|
|
193
|
+
|
|
194
|
+
Required fields:
|
|
195
|
+
- None
|
|
196
|
+
|
|
197
|
+
Optional fields:
|
|
198
|
+
- `region` (By default it will assume `euw`, if you want to know for a specific region, you can pass that in.)
|
|
199
|
+
|
|
200
|
+
### Clash V3
|
|
201
|
+
#### `clash_by_summoner_id`
|
|
202
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#clash-v1/GET_getPlayersBySummoner)
|
|
203
|
+
|
|
204
|
+
Required fields:
|
|
205
|
+
- `encrypted_summoner_id` (the encrypted summoner ID for the summoner you want to know about.)
|
|
206
|
+
- `region` (The region that the summoner is in.)
|
|
207
|
+
|
|
208
|
+
Optional fields:
|
|
209
|
+
- None
|
|
210
|
+
|
|
211
|
+
#### `clash_by_team_id`
|
|
212
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#clash-v1/GET_getTeamById)
|
|
213
|
+
|
|
214
|
+
Required fields:
|
|
215
|
+
- `team_id` (the team ID for the team you want to know about.)
|
|
216
|
+
- `region` (The region that the team is in.)
|
|
217
|
+
|
|
218
|
+
Optional fields:
|
|
219
|
+
- None
|
|
220
|
+
|
|
221
|
+
#### `clash_tournaments`
|
|
222
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#clash-v1/GET_getTournaments)
|
|
223
|
+
|
|
224
|
+
Required fields:
|
|
225
|
+
- `region` (The region that you want to know about.)
|
|
226
|
+
|
|
227
|
+
Optional fields:
|
|
228
|
+
- None
|
|
229
|
+
|
|
230
|
+
#### `clash_tournaments_by_team_id`
|
|
231
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#clash-v1/GET_getTournaments)
|
|
232
|
+
|
|
233
|
+
Required fields:
|
|
234
|
+
- `team_id` (the team ID for the team you want to know about.)
|
|
235
|
+
- `region` (The region that the team is in.)
|
|
236
|
+
|
|
237
|
+
Optional fields:
|
|
238
|
+
- None
|
|
239
|
+
|
|
240
|
+
#### `clash_tournaments_by_tournament_id`
|
|
241
|
+
[Riot API Documentation](https://developer.riotgames.com/apis#clash-v1/GET_getTournaments)
|
|
242
|
+
|
|
243
|
+
Required fields:
|
|
244
|
+
- `tournament_id` (the tournament ID for the tournament you want to know about.)
|
|
245
|
+
- `region` (The region that the tournament is in.)
|
|
246
|
+
|
|
247
|
+
Optional fields:
|
|
248
|
+
- None
|
|
86
249
|
|
|
87
250
|
## Development
|
|
88
251
|
|
data/Rakefile
CHANGED
data/lib/starcall.rb
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'starcall/endpoints/endpoints'
|
|
4
|
+
require 'starcall/errors/errors'
|
|
5
|
+
require 'starcall/languages'
|
|
6
|
+
require 'starcall/regions'
|
|
7
|
+
require 'starcall/static_data'
|
|
3
8
|
require 'starcall/version'
|
|
4
9
|
|
|
10
|
+
# The root of it all
|
|
5
11
|
module Starcall
|
|
6
|
-
class Error < StandardError; end
|
|
7
12
|
end
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
require 'httparty'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
class
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
module Starcall
|
|
6
|
+
# A small class to make a HTTP get request using the passed in URL
|
|
7
|
+
# Intened to only be used my internal Gem classes and not be called directly.
|
|
8
|
+
class ApiRequests
|
|
9
|
+
def self.make_request(url:)
|
|
10
|
+
HTTParty.get(url, { headers: { 'X-Riot-Token' => ENV['RIOT_API_KEY'] } }).parsed_response
|
|
11
|
+
end
|
|
9
12
|
end
|
|
10
13
|
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'starcall/helpers/region_parser'
|
|
4
|
+
require 'starcall/api_requests'
|
|
5
|
+
|
|
6
|
+
module Starcall
|
|
7
|
+
module Endpoints
|
|
8
|
+
# Methods used to call the Champion Mastery endpoints.
|
|
9
|
+
class ChampionMasteryV4
|
|
10
|
+
# Get all champion mastery entries sorted by number of champion points descending.
|
|
11
|
+
def self.summoner(encrypted_summoner_id:, region:)
|
|
12
|
+
Starcall::Regions.valid?(region: region)
|
|
13
|
+
Starcall::ApiRequests.make_request(
|
|
14
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
15
|
+
"/lol/champion-mastery/v4/champion-masteries/by-summoner/#{encrypted_summoner_id}"
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Get a champion mastery by player ID and champion ID.
|
|
20
|
+
def self.summoner_on_champion(encrypted_summoner_id:, champion_id:, region:)
|
|
21
|
+
Starcall::Regions.valid?(region: region)
|
|
22
|
+
Starcall::ApiRequests.make_request(
|
|
23
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
24
|
+
"/lol/champion-mastery/v4/champion-masteries/by-summoner/#{encrypted_summoner_id}"\
|
|
25
|
+
"/by-champion/#{champion_id}"
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
|
|
30
|
+
def self.summoner_total_mastery(encrypted_summoner_id:, region:)
|
|
31
|
+
Starcall::Regions.valid?(region: region)
|
|
32
|
+
Starcall::ApiRequests.make_request(
|
|
33
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
34
|
+
"/lol/champion-mastery/v4/scores/by-summoner/#{encrypted_summoner_id}"
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.parse_region(region:)
|
|
39
|
+
Starcall::Helpers::RegionParser.parse(region: region)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private_class_method :parse_region
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'starcall/helpers/region_parser'
|
|
4
|
+
require 'starcall/api_requests'
|
|
5
|
+
|
|
6
|
+
module Starcall
|
|
7
|
+
module Endpoints
|
|
8
|
+
# Methods used to call the Champion endpoints.
|
|
9
|
+
class ChampionV3
|
|
10
|
+
# Returns champion rotations, including free-to-play and low-level free-to-play rotations
|
|
11
|
+
def self.champion_rotations(region: 'euw')
|
|
12
|
+
Starcall::Regions.valid?(region: region)
|
|
13
|
+
Starcall::ApiRequests.make_request(
|
|
14
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
15
|
+
'/lol/platform/v3/champion-rotations'
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.parse_region(region:)
|
|
20
|
+
Starcall::Helpers::RegionParser.parse(region: region)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private_class_method :parse_region
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'starcall/helpers/region_parser'
|
|
4
|
+
require 'starcall/api_requests'
|
|
5
|
+
|
|
6
|
+
module Starcall
|
|
7
|
+
module Endpoints
|
|
8
|
+
# Methods used to get information about clash
|
|
9
|
+
class ClashV1
|
|
10
|
+
# Get players by summoner ID.
|
|
11
|
+
def self.clash_by_summoner_id(encrypted_summoner_id:, region:)
|
|
12
|
+
Starcall::Regions.valid?(region: region)
|
|
13
|
+
Starcall::ApiRequests.make_request(
|
|
14
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
15
|
+
"/lol/clash/v1/players/by-summoner/#{encrypted_summoner_id}"
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Get team by ID.
|
|
20
|
+
def self.clash_by_team_id(team_id:, region:)
|
|
21
|
+
Starcall::Regions.valid?(region: region)
|
|
22
|
+
Starcall::ApiRequests.make_request(
|
|
23
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
24
|
+
"/lol/clash/v1/teams/#{team_id}"
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Get all active or upcoming tournaments.
|
|
29
|
+
def self.clash_tournaments(region:)
|
|
30
|
+
Starcall::Regions.valid?(region: region)
|
|
31
|
+
Starcall::ApiRequests.make_request(
|
|
32
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com/lol/clash/v1/tournaments"
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Get tournament by team ID.
|
|
37
|
+
def self.clash_tournaments_by_team_id(team_id:, region:)
|
|
38
|
+
Starcall::Regions.valid?(region: region)
|
|
39
|
+
Starcall::ApiRequests.make_request(
|
|
40
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
41
|
+
"/lol/clash/v1/tournaments/by-team/#{team_id}"
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Get tournament by ID
|
|
46
|
+
def self.clash_tournaments_by_tournament_id(tournament_id:, region:)
|
|
47
|
+
Starcall::Regions.valid?(region: region)
|
|
48
|
+
Starcall::ApiRequests.make_request(
|
|
49
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
50
|
+
"/lol/clash/v1/tournaments/#{tournament_id}"
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.parse_region(region:)
|
|
55
|
+
Starcall::Helpers::RegionParser.parse(region: region)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
private_class_method :parse_region
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'starcall/helpers/region_parser'
|
|
4
|
+
require 'starcall/api_requests'
|
|
5
|
+
|
|
6
|
+
module Starcall
|
|
7
|
+
module Endpoints
|
|
8
|
+
# Methods used to get information about summoners.
|
|
9
|
+
class SummonerV4
|
|
10
|
+
# Get a summoner by account ID.
|
|
11
|
+
def self.by_account_id(encrypted_account_id:, region:)
|
|
12
|
+
Starcall::Regions.valid?(region: region)
|
|
13
|
+
Starcall::ApiRequests.make_request(
|
|
14
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
15
|
+
"/lol/summoner/v4/summoners/by-account/#{encrypted_account_id}"
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Get a summoner by summoner name.
|
|
20
|
+
def self.by_summoner_name(summoner_name:, region:)
|
|
21
|
+
Starcall::Regions.valid?(region: region)
|
|
22
|
+
Starcall::ApiRequests.make_request(
|
|
23
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
24
|
+
"/lol/summoner/v4/summoners/by-name/#{summoner_name}"
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Get a summoner by PUUID.
|
|
29
|
+
def self.by_puuid(puuid:, region:)
|
|
30
|
+
Starcall::Regions.valid?(region: region)
|
|
31
|
+
Starcall::ApiRequests.make_request(
|
|
32
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
33
|
+
"/lol/summoner/v4/summoners/by-puuid/#{puuid}"
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Get a summoner by summoner ID.
|
|
38
|
+
def self.by_summoner_id(summoner_id:, region:)
|
|
39
|
+
Starcall::Regions.valid?(region: region)
|
|
40
|
+
Starcall::ApiRequests.make_request(
|
|
41
|
+
url: "https://#{parse_region(region: region)}.api.riotgames.com"\
|
|
42
|
+
"/lol/summoner/v4/summoners/#{summoner_id}"
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.parse_region(region:)
|
|
47
|
+
Starcall::Helpers::RegionParser.parse(region: region)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private_class_method :parse_region
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Starcall
|
|
4
|
+
module Errors
|
|
5
|
+
# A Custom error message, used when an incorrect language is passed.
|
|
6
|
+
class InvalidLanguage < StandardError
|
|
7
|
+
def initialize(language:)
|
|
8
|
+
super
|
|
9
|
+
@language = language
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def message
|
|
13
|
+
"#{language} is not a valid language. Please consult Starcall::Languages.list for a list of valid languages."
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
attr_reader :language
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Starcall
|
|
4
|
+
module Errors
|
|
5
|
+
# A Custom error message, used when an incorrect region is passed.
|
|
6
|
+
class InvalidRegion < StandardError
|
|
7
|
+
def initialize(region:)
|
|
8
|
+
super
|
|
9
|
+
@region = region
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def message
|
|
13
|
+
"#{region} is not a valid region. Please consult Starcall::Regions.list for a list of valid regions."
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
attr_reader :region
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'starcall/regions'
|
|
4
|
+
|
|
5
|
+
module Starcall
|
|
6
|
+
module Helpers
|
|
7
|
+
# The API URLs don't use the actual region name, they used different ones.
|
|
8
|
+
# This converts from a region name to the URL string.
|
|
9
|
+
class RegionParser
|
|
10
|
+
def self.parse(region:)
|
|
11
|
+
Starcall::Regions.valid?(region: region)
|
|
12
|
+
|
|
13
|
+
region_matchup = {
|
|
14
|
+
br: 'br1',
|
|
15
|
+
eune: 'eun1',
|
|
16
|
+
euw: 'euw1',
|
|
17
|
+
lan: 'la1',
|
|
18
|
+
las: 'la2',
|
|
19
|
+
na: 'na1',
|
|
20
|
+
oce: 'oc1',
|
|
21
|
+
ru: 'ru',
|
|
22
|
+
tr: 'tr1',
|
|
23
|
+
jp: 'jp1',
|
|
24
|
+
kr: 'kr'
|
|
25
|
+
}
|
|
26
|
+
region_matchup[region.to_sym]
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Starcall
|
|
4
|
+
# This class is used to list and validate languages.
|
|
5
|
+
class Languages
|
|
6
|
+
# A list of valid Riot Languages.
|
|
7
|
+
# rubocop:disable Metrics/MethodLength
|
|
8
|
+
def self.list
|
|
9
|
+
[
|
|
10
|
+
'cs_CZ', # Czech (Czech Republic)
|
|
11
|
+
'el_GR', # Greek (Greece)
|
|
12
|
+
'pl_PL', # Polish (Poland)
|
|
13
|
+
'ro_RO', # Romanian (Romania)
|
|
14
|
+
'hu_HU', # Hungarian (Hungary)
|
|
15
|
+
'en_GB', # English (United Kingdom)
|
|
16
|
+
'de_DE', # German (Germany)
|
|
17
|
+
'es_ES', # Spanish (Spain)
|
|
18
|
+
'it_IT', # Italian (Italy)
|
|
19
|
+
'fr_FR', # French (France)
|
|
20
|
+
'ja_JP', # Japanese (Japan)
|
|
21
|
+
'ko_KR', # Korean (Korea)
|
|
22
|
+
'es_MX', # Spanish (Mexico)
|
|
23
|
+
'es_AR', # Spanish (Argentina)
|
|
24
|
+
'pt_BR', # Portuguese (Brazil)
|
|
25
|
+
'en_US', # English (United States)
|
|
26
|
+
'en_AU', # English (Australia)
|
|
27
|
+
'ru_RU', # Russian (Russia)
|
|
28
|
+
'tr_TR', # Turkish (Turkey)
|
|
29
|
+
'ms_MY', # Malay (Malaysia)
|
|
30
|
+
'en_PH', # English (Republic of the Philippines)
|
|
31
|
+
'en_SG', # English (Singapore)
|
|
32
|
+
'th_TH', # Thai (Thailand)
|
|
33
|
+
'vn_VN', # Vietnamese (Viet Nam)
|
|
34
|
+
'id_ID', # Indonesian (Indonesia)
|
|
35
|
+
'zh_MY', # Chinese (Malaysia)
|
|
36
|
+
'zh_CN', # Chinese (China)
|
|
37
|
+
'zh_TW' # Chinese (Taiwan)
|
|
38
|
+
]
|
|
39
|
+
end
|
|
40
|
+
# rubocop:enable Metrics/MethodLength
|
|
41
|
+
|
|
42
|
+
# A method to check is the language is valid, if not, raise an error.
|
|
43
|
+
def self.valid?(language:)
|
|
44
|
+
return true if list.include? language
|
|
45
|
+
|
|
46
|
+
raise Starcall::Errors::InvalidLanguage.new(language: language)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Starcall
|
|
4
|
+
# This class is used to list and validate regions.
|
|
5
|
+
class Regions
|
|
6
|
+
# A list of valid Riot Regions.
|
|
7
|
+
def self.list
|
|
8
|
+
[
|
|
9
|
+
'br', # Brazil
|
|
10
|
+
'eune', # EU North East
|
|
11
|
+
'euw', # EU West
|
|
12
|
+
'lan', # Latin America North
|
|
13
|
+
'las', # Latin America South
|
|
14
|
+
'na', # North America
|
|
15
|
+
'oce', # Oceania
|
|
16
|
+
'ru', # Russia
|
|
17
|
+
'tr', # Turkey
|
|
18
|
+
'jp', # Japan
|
|
19
|
+
'kr' # Korea
|
|
20
|
+
]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# A method to check is the region is valid, if not, raise an error.
|
|
24
|
+
def self.valid?(region:)
|
|
25
|
+
return true if list.include? region
|
|
26
|
+
|
|
27
|
+
raise Starcall::Errors::InvalidRegion.new(region: region)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/starcall/static_data.rb
CHANGED
|
@@ -6,32 +6,41 @@ module Starcall
|
|
|
6
6
|
# This class is used for all things Static Data related.
|
|
7
7
|
# Using Riots Static data and Data Dragon.
|
|
8
8
|
class StaticData
|
|
9
|
+
# Initialize the class with a region, if none is supplied, EUW will be assumed.
|
|
10
|
+
def initialize(region: 'euw', language: 'en_GB')
|
|
11
|
+
Starcall::Regions.valid?(region: region)
|
|
12
|
+
Starcall::Languages.valid?(language: language)
|
|
13
|
+
|
|
14
|
+
@region = region
|
|
15
|
+
@language = language
|
|
16
|
+
end
|
|
17
|
+
|
|
9
18
|
# Season ids are used in match history to indicate which season a match was played.
|
|
10
19
|
# A full list of season ids can be retrieved with the below method.
|
|
11
|
-
def
|
|
12
|
-
ApiRequests.make_request(url: static_url(search_term: 'seasons'))
|
|
20
|
+
def season_ids
|
|
21
|
+
Starcall::ApiRequests.make_request(url: static_url(search_term: 'seasons'))
|
|
13
22
|
end
|
|
14
23
|
|
|
15
24
|
# Queue ids show up in several places throughout the API and are used to indicate which kind of match was played.
|
|
16
25
|
# A full list of queue ids can be can be retrieved with the below method.
|
|
17
|
-
def
|
|
18
|
-
ApiRequests.make_request(url: static_url(search_term: 'queues'))
|
|
26
|
+
def queue_ids
|
|
27
|
+
Starcall::ApiRequests.make_request(url: static_url(search_term: 'queues'))
|
|
19
28
|
end
|
|
20
29
|
|
|
21
30
|
# Map ids are used in match history to indicate which map a match was played.
|
|
22
31
|
# A full list of map ids can be can be retrieved with the below method.
|
|
23
|
-
def
|
|
24
|
-
ApiRequests.make_request(url: static_url(search_term: 'maps'))
|
|
32
|
+
def map_ids
|
|
33
|
+
Starcall::ApiRequests.make_request(url: static_url(search_term: 'maps'))
|
|
25
34
|
end
|
|
26
35
|
|
|
27
36
|
# A full list of game modes can be can be retrieved with the below method.
|
|
28
|
-
def
|
|
29
|
-
ApiRequests.make_request(url: static_url(search_term: 'gameModes'))
|
|
37
|
+
def game_modes
|
|
38
|
+
Starcall::ApiRequests.make_request(url: static_url(search_term: 'gameModes'))
|
|
30
39
|
end
|
|
31
40
|
|
|
32
41
|
# A full list of game types can be can be retrieved with the below method.
|
|
33
|
-
def
|
|
34
|
-
ApiRequests.make_request(url: static_url(search_term: 'gameTypes'))
|
|
42
|
+
def game_types
|
|
43
|
+
Starcall::ApiRequests.make_request(url: static_url(search_term: 'gameTypes'))
|
|
35
44
|
end
|
|
36
45
|
|
|
37
46
|
# All valid Data Dragon versions can be can be retrieved with the below method.
|
|
@@ -39,83 +48,79 @@ module Starcall
|
|
|
39
48
|
# however occasionally there will be additional builds.
|
|
40
49
|
# This typically occurs when there's an error in the original build.
|
|
41
50
|
# As such, you should always use the most recent Data Dragon version for a given patch for the best results.
|
|
42
|
-
def
|
|
43
|
-
ApiRequests.make_request(url: dd_versions_url)
|
|
51
|
+
def dd_versions
|
|
52
|
+
Starcall::ApiRequests.make_request(url: dd_versions_url)
|
|
44
53
|
end
|
|
45
54
|
|
|
46
55
|
# Data Dragon versions aren't always equivalent to the League of Legends client version in a region.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
ApiRequests.make_request(url: dd_euw_specific_version_url)
|
|
56
|
+
def dd_region_versions
|
|
57
|
+
Starcall::ApiRequests.make_request(url: dd_region_version_url)
|
|
50
58
|
end
|
|
51
59
|
|
|
52
60
|
# This returns a list of all champion with a brief summary, including stats, id and blurb.
|
|
53
|
-
def
|
|
54
|
-
ApiRequests.make_request(url: dd_url(game_component: 'champion'))
|
|
61
|
+
def dd_champions
|
|
62
|
+
Starcall::ApiRequests.make_request(url: dd_url(game_component: 'champion'))
|
|
55
63
|
end
|
|
56
64
|
|
|
57
65
|
# For me detailed and specific information about a champion, this call can be used.
|
|
58
|
-
def
|
|
59
|
-
ApiRequests.make_request(url: dd_specific_champion_url(champion_name: champion_name))
|
|
66
|
+
def dd_specific_champion(champion_name:)
|
|
67
|
+
Starcall::ApiRequests.make_request(url: dd_specific_champion_url(champion_name: champion_name))
|
|
60
68
|
end
|
|
61
69
|
|
|
62
70
|
# Data Dragon also provides detail for every item in the game.
|
|
63
71
|
# with this method you can find info such as the item's description, purchase value, sell value,
|
|
64
72
|
# items it builds from, items it builds into, and stats granted from the item.
|
|
65
|
-
def
|
|
66
|
-
ApiRequests.make_request(url: dd_url(game_component: 'item'))
|
|
73
|
+
def dd_items
|
|
74
|
+
Starcall::ApiRequests.make_request(url: dd_url(game_component: 'item'))
|
|
67
75
|
end
|
|
68
76
|
|
|
69
77
|
# Details about summoner spells.
|
|
70
|
-
def
|
|
71
|
-
ApiRequests.make_request(url: dd_url(game_component: 'summoner'))
|
|
78
|
+
def dd_summoner_spells
|
|
79
|
+
Starcall::ApiRequests.make_request(url: dd_url(game_component: 'summoner'))
|
|
72
80
|
end
|
|
73
81
|
|
|
74
82
|
# Details about profile icons and where they can be found on the sprite sheets.
|
|
75
|
-
def
|
|
76
|
-
ApiRequests.make_request(url: dd_url(game_component: 'profileicon'))
|
|
83
|
+
def dd_profile_icons
|
|
84
|
+
Starcall::ApiRequests.make_request(url: dd_url(game_component: 'profileicon'))
|
|
77
85
|
end
|
|
78
86
|
|
|
87
|
+
private
|
|
88
|
+
|
|
89
|
+
attr_reader :region, :language
|
|
90
|
+
|
|
79
91
|
# This help build the static data url for thins such as map ids.
|
|
80
|
-
def
|
|
92
|
+
def static_url(search_term:)
|
|
81
93
|
"http://static.developer.riotgames.com/docs/lol/#{search_term}.json"
|
|
82
94
|
end
|
|
83
95
|
|
|
84
96
|
# This is the data dragon version URL
|
|
85
|
-
def
|
|
97
|
+
def dd_versions_url
|
|
86
98
|
'https://ddragon.leagueoflegends.com/api/versions.json'
|
|
87
99
|
end
|
|
88
100
|
|
|
89
101
|
# This is the specific EUW data dragon version URL.
|
|
90
|
-
def
|
|
91
|
-
|
|
102
|
+
def dd_region_version_url
|
|
103
|
+
"https://ddragon.leagueoflegends.com/realms/#{region}.json"
|
|
92
104
|
end
|
|
93
105
|
|
|
94
106
|
# This gets the current version of specific game components, such as champions.
|
|
95
|
-
def
|
|
96
|
-
ApiRequests.make_request(url:
|
|
107
|
+
def dd_current_data_version(game_component:)
|
|
108
|
+
Starcall::ApiRequests.make_request(url: dd_region_version_url)['n'][game_component]
|
|
97
109
|
end
|
|
98
110
|
|
|
99
111
|
# This builds the data dragon url for specific components such as champions,
|
|
100
112
|
# using the above method to get the version.
|
|
101
|
-
def
|
|
113
|
+
def dd_url(game_component:)
|
|
102
114
|
'http://ddragon.leagueoflegends.com/cdn/'\
|
|
103
|
-
"#{dd_current_data_version(game_component: game_component)}/data/
|
|
115
|
+
"#{dd_current_data_version(game_component: game_component)}/data/#{language}/"\
|
|
104
116
|
"#{game_component}.json"
|
|
105
117
|
end
|
|
106
118
|
|
|
107
119
|
# This builds the data dragon url for a specific champion.
|
|
108
|
-
def
|
|
120
|
+
def dd_specific_champion_url(champion_name:)
|
|
109
121
|
'http://ddragon.leagueoflegends.com/cdn/'\
|
|
110
122
|
"#{dd_current_data_version(game_component: 'champion')}"\
|
|
111
|
-
"/data/
|
|
123
|
+
"/data/#{language}/champion/#{champion_name}.json"
|
|
112
124
|
end
|
|
113
|
-
|
|
114
|
-
private_class_method :static_url,
|
|
115
|
-
:dd_versions_url,
|
|
116
|
-
:dd_euw_specific_version_url,
|
|
117
|
-
:dd_current_data_version,
|
|
118
|
-
:dd_url,
|
|
119
|
-
:dd_specific_champion_url
|
|
120
125
|
end
|
|
121
126
|
end
|
data/lib/starcall/version.rb
CHANGED
data/starcall.gemspec
CHANGED
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
|
17
17
|
|
|
18
18
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
19
19
|
spec.metadata['source_code_uri'] = 'https://github.com/kks110/starcall'
|
|
20
|
-
spec.metadata['changelog_uri'] = 'https://github.com/kks110/starcall'
|
|
20
|
+
spec.metadata['changelog_uri'] = 'https://github.com/kks110/starcall/blob/master/CHANGELOG.md'
|
|
21
21
|
|
|
22
22
|
# Specify which files should be added to the gem when it is released.
|
|
23
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
spec.require_paths = ['lib']
|
|
31
31
|
|
|
32
32
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
33
|
+
spec.add_development_dependency 'pry', '~> 0.13'
|
|
33
34
|
spec.add_development_dependency 'rake', '~> 12.3'
|
|
34
35
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
35
36
|
spec.add_development_dependency 'rubocop', '~> 0.86'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: starcall
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kelvin Samuel
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -24,6 +24,20 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '2.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: pry
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0.13'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0.13'
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: rake
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -102,10 +116,11 @@ executables: []
|
|
|
102
116
|
extensions: []
|
|
103
117
|
extra_rdoc_files: []
|
|
104
118
|
files:
|
|
119
|
+
- ".github/workflows/tests.yaml"
|
|
105
120
|
- ".gitignore"
|
|
106
121
|
- ".rakeTasks"
|
|
107
122
|
- ".rubocop.yml"
|
|
108
|
-
-
|
|
123
|
+
- CHANGELOG.md
|
|
109
124
|
- Gemfile
|
|
110
125
|
- Gemfile.lock
|
|
111
126
|
- LICENSE.txt
|
|
@@ -113,6 +128,17 @@ files:
|
|
|
113
128
|
- Rakefile
|
|
114
129
|
- lib/starcall.rb
|
|
115
130
|
- lib/starcall/api_requests.rb
|
|
131
|
+
- lib/starcall/endpoints/champion_mastery_v4.rb
|
|
132
|
+
- lib/starcall/endpoints/champion_v3.rb
|
|
133
|
+
- lib/starcall/endpoints/clash_v1.rb
|
|
134
|
+
- lib/starcall/endpoints/endpoints.rb
|
|
135
|
+
- lib/starcall/endpoints/summoner_v4.rb
|
|
136
|
+
- lib/starcall/errors/errors.rb
|
|
137
|
+
- lib/starcall/errors/invalid_language.rb
|
|
138
|
+
- lib/starcall/errors/invalid_region.rb
|
|
139
|
+
- lib/starcall/helpers/region_parser.rb
|
|
140
|
+
- lib/starcall/languages.rb
|
|
141
|
+
- lib/starcall/regions.rb
|
|
116
142
|
- lib/starcall/static_data.rb
|
|
117
143
|
- lib/starcall/version.rb
|
|
118
144
|
- starcall.gemspec
|
|
@@ -123,7 +149,7 @@ licenses:
|
|
|
123
149
|
metadata:
|
|
124
150
|
homepage_uri: https://github.com/kks110/starcall
|
|
125
151
|
source_code_uri: https://github.com/kks110/starcall
|
|
126
|
-
changelog_uri: https://github.com/kks110/starcall
|
|
152
|
+
changelog_uri: https://github.com/kks110/starcall/blob/master/CHANGELOG.md
|
|
127
153
|
post_install_message:
|
|
128
154
|
rdoc_options: []
|
|
129
155
|
require_paths:
|
|
@@ -139,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
165
|
- !ruby/object:Gem::Version
|
|
140
166
|
version: '0'
|
|
141
167
|
requirements: []
|
|
142
|
-
rubygems_version: 3.0.
|
|
168
|
+
rubygems_version: 3.0.1
|
|
143
169
|
signing_key:
|
|
144
170
|
specification_version: 4
|
|
145
171
|
summary: A Helper Gem for calling Riots API
|