starcall 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yaml +20 -0
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +52 -0
- data/Gemfile.lock +68 -68
- data/README.md +44 -9
- data/Rakefile +1 -1
- data/lib/starcall/error.rb +37 -0
- data/lib/starcall/languages.rb +51 -0
- data/lib/starcall/regions.rb +32 -0
- data/lib/starcall/static_data.rb +38 -31
- data/lib/starcall/version.rb +1 -1
- data/starcall.gemspec +1 -1
- metadata +8 -4
- 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: 747f4858cbdbfc589afaea575efb50a1ab13cb6b17ea4c8a00e7d8531372ff45
|
4
|
+
data.tar.gz: 7343bf8040d4a954f7f9c28724053bfad8d97ea4c145d1a028607b900d539bb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d648c379749197d1c35f5a18ffffa6661741a12b704cb1ca10ab27df84c81640c2f56650ee7feb32363276beb222a0bedec5806702a5dc0b19d6c66dad64e7f
|
7
|
+
data.tar.gz: cd19a5a3963fc1a6240877ebba5f2020c76165b56f12d9d887ee2d3a961c75ec70134252227626527b6b5be0844c951e037facf95a2ab92d5b44d22752db7d29
|
@@ -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/.rubocop.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,52 @@
|
|
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.2.0 - Ahri
|
17
|
+
![Aatrox](http://ddragon.leagueoflegends.com/cdn/10.12.1/img/champion/Ahri.png)
|
18
|
+
|
19
|
+
### New features
|
20
|
+
- Regions
|
21
|
+
- `Starcall::Regions.list` for a full list of supported regions.
|
22
|
+
- Static data that can change per region and now supports different regions.
|
23
|
+
|
24
|
+
- Languages
|
25
|
+
- `Starcall::Languages.list` for a full list of supported languages.
|
26
|
+
- Static data comes in different languages and now supports different languages.
|
27
|
+
|
28
|
+
### Changes
|
29
|
+
- `Starcall::StaticData` now needs to be initialised. Can be initialised with a region and a language.
|
30
|
+
If none is supplied, `euw` and `en_GB` is assumed.
|
31
|
+
- `dd_euw_versions` has now become `dd_region_versions` defaulting to `euw` if no region has been supplied.
|
32
|
+
- Errors
|
33
|
+
- An error module has now been created where custom errors will be stored.
|
34
|
+
|
35
|
+
### Bug fixes
|
36
|
+
None
|
37
|
+
|
38
|
+
---
|
39
|
+
|
40
|
+
## v0.1.1 - Aatrox
|
41
|
+
![Aatrox](http://ddragon.leagueoflegends.com/cdn/10.12.1/img/champion/Aatrox.png)
|
42
|
+
|
43
|
+
### New features
|
44
|
+
- Riot API static endpoints
|
45
|
+
|
46
|
+
### Changes
|
47
|
+
None
|
48
|
+
|
49
|
+
### Bug fixes
|
50
|
+
None
|
51
|
+
|
52
|
+
-----
|
data/Gemfile.lock
CHANGED
@@ -1,68 +1,68 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
starcall (0.
|
5
|
-
httparty (~> 0.17)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
ast (2.4.1)
|
11
|
-
diff-lcs (1.3)
|
12
|
-
httparty (0.18.1)
|
13
|
-
mime-types (~> 3.0)
|
14
|
-
multi_xml (>= 0.5.2)
|
15
|
-
mime-types (3.3.1)
|
16
|
-
mime-types-data (~> 3.2015)
|
17
|
-
mime-types-data (3.2020.0512)
|
18
|
-
multi_xml (0.6.0)
|
19
|
-
parallel (1.19.2)
|
20
|
-
parser (2.7.1.4)
|
21
|
-
ast (~> 2.4.1)
|
22
|
-
rainbow (3.0.0)
|
23
|
-
rake (12.3.3)
|
24
|
-
regexp_parser (1.7.1)
|
25
|
-
rexml (3.2.4)
|
26
|
-
rspec (3.9.0)
|
27
|
-
rspec-core (~> 3.9.0)
|
28
|
-
rspec-expectations (~> 3.9.0)
|
29
|
-
rspec-mocks (~> 3.9.0)
|
30
|
-
rspec-core (3.9.2)
|
31
|
-
rspec-support (~> 3.9.3)
|
32
|
-
rspec-expectations (3.9.2)
|
33
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.9.0)
|
35
|
-
rspec-mocks (3.9.1)
|
36
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.9.0)
|
38
|
-
rspec-support (3.9.3)
|
39
|
-
rubocop (0.86.0)
|
40
|
-
parallel (~> 1.10)
|
41
|
-
parser (>= 2.7.0.1)
|
42
|
-
rainbow (>= 2.2.2, < 4.0)
|
43
|
-
regexp_parser (>= 1.7)
|
44
|
-
rexml
|
45
|
-
rubocop-ast (>= 0.0.3, < 1.0)
|
46
|
-
ruby-progressbar (~> 1.7)
|
47
|
-
unicode-display_width (>= 1.4.0, < 2.0)
|
48
|
-
rubocop-ast (0.0.3)
|
49
|
-
parser (>= 2.7.0.1)
|
50
|
-
rubocop-rspec (1.40.0)
|
51
|
-
rubocop (>= 0.68.1)
|
52
|
-
ruby-progressbar (1.10.1)
|
53
|
-
unicode-display_width (1.7.0)
|
54
|
-
|
55
|
-
PLATFORMS
|
56
|
-
ruby
|
57
|
-
x64-mingw32
|
58
|
-
|
59
|
-
DEPENDENCIES
|
60
|
-
bundler (~> 2.0)
|
61
|
-
rake (~> 12.3)
|
62
|
-
rspec (~> 3.0)
|
63
|
-
rubocop (~> 0.86)
|
64
|
-
rubocop-rspec (~> 1.40)
|
65
|
-
starcall!
|
66
|
-
|
67
|
-
BUNDLED WITH
|
68
|
-
2.0.2
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
starcall (0.2.0)
|
5
|
+
httparty (~> 0.17)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.1)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
httparty (0.18.1)
|
13
|
+
mime-types (~> 3.0)
|
14
|
+
multi_xml (>= 0.5.2)
|
15
|
+
mime-types (3.3.1)
|
16
|
+
mime-types-data (~> 3.2015)
|
17
|
+
mime-types-data (3.2020.0512)
|
18
|
+
multi_xml (0.6.0)
|
19
|
+
parallel (1.19.2)
|
20
|
+
parser (2.7.1.4)
|
21
|
+
ast (~> 2.4.1)
|
22
|
+
rainbow (3.0.0)
|
23
|
+
rake (12.3.3)
|
24
|
+
regexp_parser (1.7.1)
|
25
|
+
rexml (3.2.4)
|
26
|
+
rspec (3.9.0)
|
27
|
+
rspec-core (~> 3.9.0)
|
28
|
+
rspec-expectations (~> 3.9.0)
|
29
|
+
rspec-mocks (~> 3.9.0)
|
30
|
+
rspec-core (3.9.2)
|
31
|
+
rspec-support (~> 3.9.3)
|
32
|
+
rspec-expectations (3.9.2)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.9.0)
|
35
|
+
rspec-mocks (3.9.1)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.9.0)
|
38
|
+
rspec-support (3.9.3)
|
39
|
+
rubocop (0.86.0)
|
40
|
+
parallel (~> 1.10)
|
41
|
+
parser (>= 2.7.0.1)
|
42
|
+
rainbow (>= 2.2.2, < 4.0)
|
43
|
+
regexp_parser (>= 1.7)
|
44
|
+
rexml
|
45
|
+
rubocop-ast (>= 0.0.3, < 1.0)
|
46
|
+
ruby-progressbar (~> 1.7)
|
47
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
48
|
+
rubocop-ast (0.0.3)
|
49
|
+
parser (>= 2.7.0.1)
|
50
|
+
rubocop-rspec (1.40.0)
|
51
|
+
rubocop (>= 0.68.1)
|
52
|
+
ruby-progressbar (1.10.1)
|
53
|
+
unicode-display_width (1.7.0)
|
54
|
+
|
55
|
+
PLATFORMS
|
56
|
+
ruby
|
57
|
+
x64-mingw32
|
58
|
+
|
59
|
+
DEPENDENCIES
|
60
|
+
bundler (~> 2.0)
|
61
|
+
rake (~> 12.3)
|
62
|
+
rspec (~> 3.0)
|
63
|
+
rubocop (~> 0.86)
|
64
|
+
rubocop-rspec (~> 1.40)
|
65
|
+
starcall!
|
66
|
+
|
67
|
+
BUNDLED WITH
|
68
|
+
2.0.2
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
![starcall](starcall.png)
|
2
2
|
|
3
3
|
----
|
4
|
-
|
5
|
-
|
4
|
+
![Build Status](https://img.shields.io/github/workflow/status/kks110/starcall/tests/master)
|
5
|
+
![Gem Version](https://img.shields.io/gem/v/starcall)
|
6
|
+
![Downloads](https://img.shields.io/gem/dt/starcall)
|
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,32 @@ 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`
|
84
|
-
Details about profile icons and where they can be found on the sprite sheets.
|
85
119
|
|
120
|
+
Details about profile icons and where they can be found on the sprite sheets.
|
86
121
|
|
87
122
|
## Development
|
88
123
|
|
data/Rakefile
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Starcall
|
4
|
+
module Error
|
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
|
+
|
21
|
+
# A Custom error message, used when an incorrect language is passed.
|
22
|
+
class InvalidLanguage < StandardError
|
23
|
+
def initialize(language:)
|
24
|
+
super
|
25
|
+
@language = language
|
26
|
+
end
|
27
|
+
|
28
|
+
def message
|
29
|
+
"#{language} is not a valid language. Please consult Starcall::Languages.list for a list of valid languages."
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
attr_reader :language
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'starcall/error'
|
4
|
+
|
5
|
+
module Starcall
|
6
|
+
# This class is used to list and validate languages.
|
7
|
+
class Languages
|
8
|
+
# A list of valid Riot Languages.
|
9
|
+
# rubocop:disable Metrics/MethodLength
|
10
|
+
def self.list
|
11
|
+
[
|
12
|
+
'cs_CZ', # Czech (Czech Republic)
|
13
|
+
'el_GR', # Greek (Greece)
|
14
|
+
'pl_PL', # Polish (Poland)
|
15
|
+
'ro_RO', # Romanian (Romania)
|
16
|
+
'hu_HU', # Hungarian (Hungary)
|
17
|
+
'en_GB', # English (United Kingdom)
|
18
|
+
'de_DE', # German (Germany)
|
19
|
+
'es_ES', # Spanish (Spain)
|
20
|
+
'it_IT', # Italian (Italy)
|
21
|
+
'fr_FR', # French (France)
|
22
|
+
'ja_JP', # Japanese (Japan)
|
23
|
+
'ko_KR', # Korean (Korea)
|
24
|
+
'es_MX', # Spanish (Mexico)
|
25
|
+
'es_AR', # Spanish (Argentina)
|
26
|
+
'pt_BR', # Portuguese (Brazil)
|
27
|
+
'en_US', # English (United States)
|
28
|
+
'en_AU', # English (Australia)
|
29
|
+
'ru_RU', # Russian (Russia)
|
30
|
+
'tr_TR', # Turkish (Turkey)
|
31
|
+
'ms_MY', # Malay (Malaysia)
|
32
|
+
'en_PH', # English (Republic of the Philippines)
|
33
|
+
'en_SG', # English (Singapore)
|
34
|
+
'th_TH', # Thai (Thailand)
|
35
|
+
'vn_VN', # Vietnamese (Viet Nam)
|
36
|
+
'id_ID', # Indonesian (Indonesia)
|
37
|
+
'zh_MY', # Chinese (Malaysia)
|
38
|
+
'zh_CN', # Chinese (China)
|
39
|
+
'zh_TW' # Chinese (Taiwan)
|
40
|
+
]
|
41
|
+
end
|
42
|
+
# rubocop:enable Metrics/MethodLength
|
43
|
+
|
44
|
+
# A method to check is the language is valid, if not, raise an error.
|
45
|
+
def self.valid?(language:)
|
46
|
+
return true if list.include? language
|
47
|
+
|
48
|
+
raise Starcall::Error::InvalidLanguage.new(language: language)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'starcall/error'
|
4
|
+
|
5
|
+
module Starcall
|
6
|
+
# This class is used to list and validate regions.
|
7
|
+
class Regions
|
8
|
+
# A list of valid Riot Regions.
|
9
|
+
def self.list
|
10
|
+
[
|
11
|
+
'br', # Brazil
|
12
|
+
'eune', # EU North East
|
13
|
+
'euw', # EU West
|
14
|
+
'lan', # Latin America North
|
15
|
+
'las', # Latin America South
|
16
|
+
'na', # North America
|
17
|
+
'oce', # Oceania
|
18
|
+
'ru', # Russia
|
19
|
+
'tr', # Turkey
|
20
|
+
'jp', # Japan
|
21
|
+
'kr' # Korea
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
# A method to check is the region is valid, if not, raise an error.
|
26
|
+
def self.valid?(region:)
|
27
|
+
return true if list.include? region
|
28
|
+
|
29
|
+
raise Starcall::Error::InvalidRegion.new(region: region)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/starcall/static_data.rb
CHANGED
@@ -1,36 +1,47 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'starcall/api_requests'
|
4
|
+
require 'starcall/regions'
|
5
|
+
require 'starcall/languages'
|
4
6
|
|
5
7
|
module Starcall
|
6
8
|
# This class is used for all things Static Data related.
|
7
9
|
# Using Riots Static data and Data Dragon.
|
8
10
|
class StaticData
|
11
|
+
# Initialize the class with a region, if none is supplied, EUW will be assumed.
|
12
|
+
def initialize(region: 'euw', language: 'en_GB')
|
13
|
+
Starcall::Regions.valid?(region: region)
|
14
|
+
Starcall::Languages.valid?(language: language)
|
15
|
+
|
16
|
+
@region = region
|
17
|
+
@language = language
|
18
|
+
end
|
19
|
+
|
9
20
|
# Season ids are used in match history to indicate which season a match was played.
|
10
21
|
# A full list of season ids can be retrieved with the below method.
|
11
|
-
def
|
22
|
+
def season_ids
|
12
23
|
ApiRequests.make_request(url: static_url(search_term: 'seasons'))
|
13
24
|
end
|
14
25
|
|
15
26
|
# Queue ids show up in several places throughout the API and are used to indicate which kind of match was played.
|
16
27
|
# A full list of queue ids can be can be retrieved with the below method.
|
17
|
-
def
|
28
|
+
def queue_ids
|
18
29
|
ApiRequests.make_request(url: static_url(search_term: 'queues'))
|
19
30
|
end
|
20
31
|
|
21
32
|
# Map ids are used in match history to indicate which map a match was played.
|
22
33
|
# A full list of map ids can be can be retrieved with the below method.
|
23
|
-
def
|
34
|
+
def map_ids
|
24
35
|
ApiRequests.make_request(url: static_url(search_term: 'maps'))
|
25
36
|
end
|
26
37
|
|
27
38
|
# A full list of game modes can be can be retrieved with the below method.
|
28
|
-
def
|
39
|
+
def game_modes
|
29
40
|
ApiRequests.make_request(url: static_url(search_term: 'gameModes'))
|
30
41
|
end
|
31
42
|
|
32
43
|
# A full list of game types can be can be retrieved with the below method.
|
33
|
-
def
|
44
|
+
def game_types
|
34
45
|
ApiRequests.make_request(url: static_url(search_term: 'gameTypes'))
|
35
46
|
end
|
36
47
|
|
@@ -39,83 +50,79 @@ module Starcall
|
|
39
50
|
# however occasionally there will be additional builds.
|
40
51
|
# This typically occurs when there's an error in the original build.
|
41
52
|
# As such, you should always use the most recent Data Dragon version for a given patch for the best results.
|
42
|
-
def
|
53
|
+
def dd_versions
|
43
54
|
ApiRequests.make_request(url: dd_versions_url)
|
44
55
|
end
|
45
56
|
|
46
57
|
# 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)
|
58
|
+
def dd_region_versions
|
59
|
+
ApiRequests.make_request(url: dd_region_version_url)
|
50
60
|
end
|
51
61
|
|
52
62
|
# This returns a list of all champion with a brief summary, including stats, id and blurb.
|
53
|
-
def
|
63
|
+
def dd_champions
|
54
64
|
ApiRequests.make_request(url: dd_url(game_component: 'champion'))
|
55
65
|
end
|
56
66
|
|
57
67
|
# For me detailed and specific information about a champion, this call can be used.
|
58
|
-
def
|
68
|
+
def dd_specific_champion(champion_name:)
|
59
69
|
ApiRequests.make_request(url: dd_specific_champion_url(champion_name: champion_name))
|
60
70
|
end
|
61
71
|
|
62
72
|
# Data Dragon also provides detail for every item in the game.
|
63
73
|
# with this method you can find info such as the item's description, purchase value, sell value,
|
64
74
|
# items it builds from, items it builds into, and stats granted from the item.
|
65
|
-
def
|
75
|
+
def dd_items
|
66
76
|
ApiRequests.make_request(url: dd_url(game_component: 'item'))
|
67
77
|
end
|
68
78
|
|
69
79
|
# Details about summoner spells.
|
70
|
-
def
|
80
|
+
def dd_summoner_spells
|
71
81
|
ApiRequests.make_request(url: dd_url(game_component: 'summoner'))
|
72
82
|
end
|
73
83
|
|
74
84
|
# Details about profile icons and where they can be found on the sprite sheets.
|
75
|
-
def
|
85
|
+
def dd_profile_icons
|
76
86
|
ApiRequests.make_request(url: dd_url(game_component: 'profileicon'))
|
77
87
|
end
|
78
88
|
|
89
|
+
private
|
90
|
+
|
91
|
+
attr_reader :region, :language
|
92
|
+
|
79
93
|
# This help build the static data url for thins such as map ids.
|
80
|
-
def
|
94
|
+
def static_url(search_term:)
|
81
95
|
"http://static.developer.riotgames.com/docs/lol/#{search_term}.json"
|
82
96
|
end
|
83
97
|
|
84
98
|
# This is the data dragon version URL
|
85
|
-
def
|
99
|
+
def dd_versions_url
|
86
100
|
'https://ddragon.leagueoflegends.com/api/versions.json'
|
87
101
|
end
|
88
102
|
|
89
103
|
# This is the specific EUW data dragon version URL.
|
90
|
-
def
|
91
|
-
|
104
|
+
def dd_region_version_url
|
105
|
+
"https://ddragon.leagueoflegends.com/realms/#{region}.json"
|
92
106
|
end
|
93
107
|
|
94
108
|
# This gets the current version of specific game components, such as champions.
|
95
|
-
def
|
96
|
-
ApiRequests.make_request(url:
|
109
|
+
def dd_current_data_version(game_component:)
|
110
|
+
ApiRequests.make_request(url: dd_region_version_url)['n'][game_component]
|
97
111
|
end
|
98
112
|
|
99
113
|
# This builds the data dragon url for specific components such as champions,
|
100
114
|
# using the above method to get the version.
|
101
|
-
def
|
115
|
+
def dd_url(game_component:)
|
102
116
|
'http://ddragon.leagueoflegends.com/cdn/'\
|
103
|
-
"#{dd_current_data_version(game_component: game_component)}/data/
|
117
|
+
"#{dd_current_data_version(game_component: game_component)}/data/#{language}/"\
|
104
118
|
"#{game_component}.json"
|
105
119
|
end
|
106
120
|
|
107
121
|
# This builds the data dragon url for a specific champion.
|
108
|
-
def
|
122
|
+
def dd_specific_champion_url(champion_name:)
|
109
123
|
'http://ddragon.leagueoflegends.com/cdn/'\
|
110
124
|
"#{dd_current_data_version(game_component: 'champion')}"\
|
111
|
-
"/data/
|
125
|
+
"/data/#{language}/champion/#{champion_name}.json"
|
112
126
|
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
127
|
end
|
121
128
|
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.
|
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.2.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-06-
|
11
|
+
date: 2020-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -102,10 +102,11 @@ executables: []
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
+
- ".github/workflows/tests.yaml"
|
105
106
|
- ".gitignore"
|
106
107
|
- ".rakeTasks"
|
107
108
|
- ".rubocop.yml"
|
108
|
-
-
|
109
|
+
- CHANGELOG.md
|
109
110
|
- Gemfile
|
110
111
|
- Gemfile.lock
|
111
112
|
- LICENSE.txt
|
@@ -113,6 +114,9 @@ files:
|
|
113
114
|
- Rakefile
|
114
115
|
- lib/starcall.rb
|
115
116
|
- lib/starcall/api_requests.rb
|
117
|
+
- lib/starcall/error.rb
|
118
|
+
- lib/starcall/languages.rb
|
119
|
+
- lib/starcall/regions.rb
|
116
120
|
- lib/starcall/static_data.rb
|
117
121
|
- lib/starcall/version.rb
|
118
122
|
- starcall.gemspec
|
@@ -123,7 +127,7 @@ licenses:
|
|
123
127
|
metadata:
|
124
128
|
homepage_uri: https://github.com/kks110/starcall
|
125
129
|
source_code_uri: https://github.com/kks110/starcall
|
126
|
-
changelog_uri: https://github.com/kks110/starcall
|
130
|
+
changelog_uri: https://github.com/kks110/starcall/blob/master/CHANGELOG.md
|
127
131
|
post_install_message:
|
128
132
|
rdoc_options: []
|
129
133
|
require_paths:
|