taric 0.1.0 → 0.1.1
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/.gitignore +1 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/encodings.xml +4 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/taric.iml +40 -0
- data/.idea/vcs.xml +6 -0
- data/LICENSE.txt +1 -1
- data/README.md +79 -3
- data/lib/taric.rb +38 -2
- data/lib/taric/client.rb +31 -0
- data/lib/taric/configuration.rb +24 -0
- data/lib/taric/connection.rb +17 -0
- data/lib/taric/operation/api.rb +45 -0
- data/lib/taric/operation/base.rb +8 -0
- data/lib/taric/operation/champion.rb +23 -0
- data/lib/taric/operation/current_game.rb +11 -0
- data/lib/taric/operation/featured_games.rb +11 -0
- data/lib/taric/operation/game.rb +15 -0
- data/lib/taric/operation/league.rb +38 -0
- data/lib/taric/operation/lol_static_data.rb +157 -0
- data/lib/taric/operation/lol_status.rb +16 -0
- data/lib/taric/operation/match.rb +15 -0
- data/lib/taric/operation/stats.rb +21 -0
- data/lib/taric/operation/summoner.rb +38 -0
- data/lib/taric/operation/team.rb +23 -0
- data/lib/taric/version.rb +1 -1
- data/taric.gemspec +1 -5
- metadata +27 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e20af3d854b8c5f7fbb56f6fbfe94e6be61e744
|
|
4
|
+
data.tar.gz: 69061b667be3bd835082fb20077b3835ff0a006e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab811f3276d40aba25e883672ec3b82e1c2b3425961841ca656ef010c9319251d33748d4d64e99f1f4924a45f47b90ab6e3f758650d9b9f6794af8236c015e4b
|
|
7
|
+
data.tar.gz: 2498e174d418df266c8984d9e976759afb4eb75fb98c336ddd2fc2976b05e7635033b130f401e82f595c039fd282c5e0cb117440a509eb051491bdce4c5b4178
|
data/.gitignore
CHANGED
data/.idea/.name
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
taric
|
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
data/.idea/encodings.xml
ADDED
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
data/.idea/taric.iml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="FacetManager">
|
|
4
|
+
<facet type="gem" name="Ruby Gem">
|
|
5
|
+
<configuration>
|
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
|
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="$MODULE_DIR$/test" />
|
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
|
|
9
|
+
</configuration>
|
|
10
|
+
</facet>
|
|
11
|
+
</component>
|
|
12
|
+
<component name="NewModuleRootManager">
|
|
13
|
+
<content url="file://$MODULE_DIR$">
|
|
14
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
|
15
|
+
</content>
|
|
16
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-2.1.5 [taric]" jdkType="RUBY_SDK" />
|
|
17
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.3.7, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.8.5, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.2, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="ethon (v0.7.3, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="faraday (v0.9.1, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="faraday_middleware (v0.9.1, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.9.8, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="hashie (v3.4.0, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="memoist (v0.11.0, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.11.0, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="multipart-post (v2.0.0, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.2.0, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.2.2, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.2.0, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.2.1, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.2.2, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="safe_yaml (v1.0.4, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="typhoeus (v0.7.1, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="webmock (v1.20.4, RVM: ruby-2.1.5 [taric]) [gem]" level="application" />
|
|
39
|
+
</component>
|
|
40
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
[](https://codeclimate.com/github/josephyi/taric)
|
|
2
|
+
|
|
1
3
|
# Taric
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
> "Ruby for vigor."
|
|
6
|
+
|
|
7
|
+
Taric is a wrapper client to Riot Games' League of Legends API.
|
|
8
|
+
|
|
9
|
+
## Prerequisite
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
> "You face unblemished power."
|
|
12
|
+
|
|
13
|
+
Sign up for an API key at [Riot Games Developer] site.
|
|
6
14
|
|
|
7
15
|
## Installation
|
|
8
16
|
|
|
17
|
+
> "Gems? Gems are truly outrageous. They are truly, truly, truly outrageous."
|
|
18
|
+
|
|
9
19
|
Add this line to your application's Gemfile:
|
|
10
20
|
|
|
11
21
|
```ruby
|
|
@@ -20,20 +30,86 @@ Or install it yourself as:
|
|
|
20
30
|
|
|
21
31
|
$ gem install taric
|
|
22
32
|
|
|
33
|
+
## Configuration
|
|
34
|
+
|
|
35
|
+
> "With clarity."
|
|
36
|
+
|
|
37
|
+
There are a couple of ways to set the API key:
|
|
38
|
+
|
|
39
|
+
1. Set the `RIOT_API_KEY` environment variable:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
RIOT_API_KEY=whatever_key_rito_assigned_you
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This approach is best if you don't care to configure anything else.
|
|
46
|
+
|
|
47
|
+
2. Configure it once (e.g. Rails initializer):
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
Taric.configure! do |config|
|
|
51
|
+
config.api_key = 'whatever_key_rito_assigned_you'
|
|
52
|
+
end
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This approach is best if you want to configure other things (documentation to come)
|
|
56
|
+
|
|
23
57
|
## Usage
|
|
24
58
|
|
|
25
|
-
|
|
59
|
+
> "Functional and stylish."
|
|
60
|
+
|
|
61
|
+
Once the key is set, you can use `Taric.client(:region)` to get a client instance for the specified region.
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
# North America
|
|
65
|
+
client = Taric.client(:na)
|
|
66
|
+
|
|
67
|
+
# Korea
|
|
68
|
+
client = Taric.client(:kr)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Champion
|
|
72
|
+
|
|
73
|
+
```ruby
|
|
74
|
+
# https://developer.riotgames.com/api/methods#!/958/3289
|
|
75
|
+
client.champion(id: )
|
|
76
|
+
|
|
77
|
+
# https://developer.riotgames.com/api/methods#!/958/3290
|
|
78
|
+
client.champions
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Current Game
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
# https://developer.riotgames.com/api/methods#!/956/3287
|
|
85
|
+
client.current_game(summoner_id: )
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Featured Games
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
# https://developer.riotgames.com/api/methods#!/957/3288
|
|
92
|
+
client.featured_games
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
TODO: finish writing this crap :p
|
|
26
96
|
|
|
27
97
|
## Development
|
|
28
98
|
|
|
99
|
+
> "I will weep for you."
|
|
100
|
+
|
|
29
101
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
102
|
|
|
31
103
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
104
|
|
|
33
105
|
## Contributing
|
|
34
106
|
|
|
107
|
+
> ""Brilliantly."
|
|
108
|
+
|
|
35
109
|
1. Fork it ( https://github.com/[my-github-username]/taric/fork )
|
|
36
110
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
37
111
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
38
112
|
4. Push to the branch (`git push origin my-new-feature`)
|
|
39
113
|
5. Create a new Pull Request
|
|
114
|
+
|
|
115
|
+
[Riot Games Developer]:https://developer.riotgames.com/
|
data/lib/taric.rb
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'taric/client'
|
|
2
|
+
require 'taric/configuration'
|
|
3
|
+
require 'taric/connection'
|
|
4
|
+
require 'taric/version'
|
|
5
|
+
require 'typhoeus/adapters/faraday'
|
|
6
|
+
require 'memoist'
|
|
2
7
|
|
|
3
8
|
module Taric
|
|
4
|
-
|
|
9
|
+
class << self
|
|
10
|
+
extend Memoist
|
|
11
|
+
attr_accessor :configuration
|
|
12
|
+
|
|
13
|
+
def client(region = :na, config = @configuration ||= Taric::Configuration.new)
|
|
14
|
+
Taric::Client.new(config.api_key, region, config.requestor.(connection(config)), config.response_handler)
|
|
15
|
+
end
|
|
16
|
+
memoize :client
|
|
17
|
+
|
|
18
|
+
def configure!
|
|
19
|
+
reset!
|
|
20
|
+
yield(configuration)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def reset!
|
|
24
|
+
@configuration = Taric::Configuration.new
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def method_missing(method, *args, &block)
|
|
28
|
+
return super unless client.respond_to?(method)
|
|
29
|
+
client.send(method, *args, &block)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def respond_to?(method, include_all=false)
|
|
33
|
+
client.respond_to?(method, include_all) || super
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
include Taric::Connection
|
|
37
|
+
end
|
|
38
|
+
|
|
5
39
|
end
|
|
40
|
+
|
|
41
|
+
|
data/lib/taric/client.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require_relative 'operation/api'
|
|
2
|
+
require 'memoist'
|
|
3
|
+
module Taric
|
|
4
|
+
class Client
|
|
5
|
+
include Taric::Operation::API
|
|
6
|
+
|
|
7
|
+
def initialize(api_key, region, requestor, response_handler)
|
|
8
|
+
@api_key = api_key
|
|
9
|
+
@region = region
|
|
10
|
+
@requestor = requestor
|
|
11
|
+
@response_handler = response_handler
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def expand_template(operation, options = {})
|
|
15
|
+
operation.expand(options.merge(self.class.operation_values(@api_key, @region)))
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
def response_for(operation, options = {})
|
|
20
|
+
RESPONSE.(expand_template(operation, options), @requestor, @response_handler)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class << self
|
|
24
|
+
extend Memoist
|
|
25
|
+
def operation_values(api_key, region)
|
|
26
|
+
{api_key: api_key}.merge!(Taric::Operation::API::REGION_ENDPOINT_INFO[region]).freeze
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Taric
|
|
2
|
+
class Configuration
|
|
3
|
+
attr_accessor :api_key, :format, :user_agent, :connection_opts, :adapter, :region, :requestor, :response_handler
|
|
4
|
+
|
|
5
|
+
DEFAULT_REQUESTOR = -> connection, url {
|
|
6
|
+
connection.get url
|
|
7
|
+
}.curry
|
|
8
|
+
|
|
9
|
+
DEFAULT_RESPONSE_HANDLER = -> response {
|
|
10
|
+
response.body
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
def initialize(options = {})
|
|
14
|
+
@api_key = options.fetch(:api_key, ENV.fetch('RIOT_API_KEY'.freeze, 'KeyNotSetButUsingThisForTest'.freeze))
|
|
15
|
+
@format = options.fetch(:format, :json)
|
|
16
|
+
@user_agent = options.fetch(:user_agent, 'Taric Gem')
|
|
17
|
+
@adapter = options.fetch(:adapter, :typhoeus)
|
|
18
|
+
@region = options.fetch(:region, ENV.fetch('RIOT_API_REGION'.freeze, 'na').to_sym)
|
|
19
|
+
@connection_opts = options.fetch(:connection_opts, {})
|
|
20
|
+
@requestor = options.fetch(:requestor, DEFAULT_REQUESTOR)
|
|
21
|
+
@response_handler = options.fetch(:response_handler, DEFAULT_RESPONSE_HANDLER)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'faraday_middleware'
|
|
2
|
+
|
|
3
|
+
module Taric
|
|
4
|
+
module Connection
|
|
5
|
+
def connection(config)
|
|
6
|
+
options = {
|
|
7
|
+
:headers => {'Accept' => "application/#{config.format}; charset=utf-8", 'User-Agent' => config.user_agent}
|
|
8
|
+
}.merge(config.connection_opts)
|
|
9
|
+
|
|
10
|
+
Faraday::Connection.new(options) do |conn|
|
|
11
|
+
#conn.use FaradayMiddleware::Mashify
|
|
12
|
+
conn.response :json, :content_type => /\bjson$/
|
|
13
|
+
conn.adapter config.adapter
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require_relative 'champion'
|
|
2
|
+
require_relative 'current_game'
|
|
3
|
+
require_relative 'featured_games'
|
|
4
|
+
require_relative 'game'
|
|
5
|
+
require_relative 'league'
|
|
6
|
+
require_relative 'lol_static_data'
|
|
7
|
+
require_relative 'lol_status'
|
|
8
|
+
require_relative 'match'
|
|
9
|
+
require_relative 'stats'
|
|
10
|
+
require_relative 'summoner'
|
|
11
|
+
module Taric
|
|
12
|
+
module Operation
|
|
13
|
+
module API
|
|
14
|
+
include Taric::Operation::Champion
|
|
15
|
+
include Taric::Operation::CurrentGame
|
|
16
|
+
include Taric::Operation::FeaturedGames
|
|
17
|
+
include Taric::Operation::Game
|
|
18
|
+
include Taric::Operation::League
|
|
19
|
+
include Taric::Operation::LolStaticData
|
|
20
|
+
include Taric::Operation::LolStatus
|
|
21
|
+
include Taric::Operation::Match
|
|
22
|
+
include Taric::Operation::Stats
|
|
23
|
+
include Taric::Operation::Summoner
|
|
24
|
+
|
|
25
|
+
REGION_ENDPOINT_INFO = {
|
|
26
|
+
br: {region: 'br'.freeze, platform_id: 'BR1'.freeze, host: 'br.api.pvp.net'},
|
|
27
|
+
eune: {region: 'eune'.freeze, platform_id: 'EUN1'.freeze, host: 'eune.api.pvp.net'},
|
|
28
|
+
euw: {region: 'euw'.freeze, platform_id: 'EUW1', host: 'euw.api.pvp.net'},
|
|
29
|
+
kr: {region: 'kr'.freeze, platform_id: 'KR', host: 'kr.api.pvp.net'},
|
|
30
|
+
lan: {region: 'lan'.freeze, platform_id: 'LA1', host: 'lan.api.pvp.net'},
|
|
31
|
+
las: {region: 'las'.freeze, platform_id: 'LA2', host: 'las.api.pvp.net'},
|
|
32
|
+
na: {region: 'na'.freeze, platform_id: 'NA1', host: 'na.api.pvp.net'},
|
|
33
|
+
oce: {region: 'oce'.freeze, platform_id: 'OC1', host: 'oce.api.pvp.net'},
|
|
34
|
+
tr: {region: 'tr'.freeze, platform_id: 'TR1', host: 'tr.api.pvp.net'},
|
|
35
|
+
ru: {region: 'ru'.freeze, platform_id: 'RU', host: 'ru.api.pvp.net'},
|
|
36
|
+
pbe: {region: 'pbe'.freeze, platform_id: 'PBE1', host: 'pbe.api.pvp.net'}
|
|
37
|
+
}.freeze
|
|
38
|
+
|
|
39
|
+
RESPONSE = -> url, requestor, response_handler {
|
|
40
|
+
response_handler.(requestor.(url))
|
|
41
|
+
}.curry
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require_relative 'base'
|
|
2
|
+
require 'addressable/template'
|
|
3
|
+
module Taric
|
|
4
|
+
module Operation
|
|
5
|
+
module Champion
|
|
6
|
+
include Taric::Operation::Base
|
|
7
|
+
|
|
8
|
+
CHAMPION_VERSION = 'v1.2'.freeze
|
|
9
|
+
CHAMPION_BASE_URL = "#{BASE_URL_FN.(CHAMPION_VERSION)}/champion"
|
|
10
|
+
|
|
11
|
+
CHAMPIONS = Addressable::Template.new("#{CHAMPION_BASE_URL}{?api_key,freeToPlay}")
|
|
12
|
+
CHAMPION_BY_ID = Addressable::Template.new("#{CHAMPION_BASE_URL}/{id}{?api_key}")
|
|
13
|
+
|
|
14
|
+
def champions(free_to_play: nil)
|
|
15
|
+
response_for CHAMPIONS, freeToPlay: free_to_play
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def champion(id:)
|
|
19
|
+
response_for CHAMPION_BY_ID, id: id
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Taric
|
|
2
|
+
module Operation
|
|
3
|
+
module CurrentGame
|
|
4
|
+
GAME_INFO = Addressable::Template.new 'https://{host}/observer-mode/rest/consumer/getSpectatorGameInfo/{platform_id}/{summonerId}{?api_key}'
|
|
5
|
+
|
|
6
|
+
def current_game(summoner_id:)
|
|
7
|
+
response_for GAME_INFO, summonerId: summoner_id
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require_relative 'base'
|
|
2
|
+
module Taric
|
|
3
|
+
module Operation
|
|
4
|
+
module Game
|
|
5
|
+
include Taric::Operation::Base
|
|
6
|
+
|
|
7
|
+
GAME_VERSION = 'v1.3'.freeze
|
|
8
|
+
RECENT = Addressable::Template.new "#{BASE_URL_FN.(GAME_VERSION)}/game/by-summoner/{summonerId}/recent{?api_key}"
|
|
9
|
+
|
|
10
|
+
def recent_games(summoner_id:)
|
|
11
|
+
response_for RECENT, {summonerId: summoner_id}
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require_relative 'base'
|
|
2
|
+
require 'addressable/template'
|
|
3
|
+
module Taric
|
|
4
|
+
module Operation
|
|
5
|
+
module League
|
|
6
|
+
include Taric::Operation::Base
|
|
7
|
+
|
|
8
|
+
LEAGUE_VERSION = 'v2.5'
|
|
9
|
+
BASE_LEAGUE_URL = "#{BASE_URL_FN.(LEAGUE_VERSION)}/league"
|
|
10
|
+
|
|
11
|
+
LEAGUES_BY_SUMMONER_IDS = Addressable::Template.new "#{BASE_LEAGUE_URL}/by-summoner/{summonerIds}{?api_key}"
|
|
12
|
+
ENTRIES_BY_SUMMONER_IDS = Addressable::Template.new "#{LEAGUES_BY_SUMMONER_IDS}/entry{?api_key}"
|
|
13
|
+
LEAGUES_BY_TEAM_IDS = Addressable::Template.new "#{BASE_LEAGUE_URL}/by-team/{teamIds}{?api_key}"
|
|
14
|
+
ENTRIES_BY_TEAM_IDS = Addressable::Template.new "#{LEAGUES_BY_TEAM_IDS}/entry{?api_key}"
|
|
15
|
+
CHALLENGER = Addressable::Template.new "#{BASE_LEAGUE_URL}/challenger{?api_key}"
|
|
16
|
+
|
|
17
|
+
def leagues_by_summoner_ids(summoner_ids:)
|
|
18
|
+
response_for LEAGUES_BY_SUMMONER_IDS, {summonerIds: summoner_ids}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def league_entries_by_summoner_ids(summoner_ids:)
|
|
22
|
+
response_for ENTRIES_BY_SUMMONER_IDS, {summonerIds: summoner_ids}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def leagues_by_team_ids(team_ids:)
|
|
26
|
+
response_for LEAGUES_BY_TEAM_IDS, {teamIds: team_ids}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def league_entries_by_team_ids(team_ids:)
|
|
30
|
+
response_for ENTRIES_BY_TEAM_IDS, {teamIds: team_ids}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def challenger(type: )
|
|
34
|
+
response_for CHALLENGER, {type: type}
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
require_relative 'base'
|
|
2
|
+
module Taric
|
|
3
|
+
module Operation
|
|
4
|
+
module LolStaticData
|
|
5
|
+
include Taric::Operation::Base
|
|
6
|
+
VERSION = 'v1.2'
|
|
7
|
+
BASE_STATIC_URL = "https://global.api.pvp.net/api/lol/static-data/{region}/#{VERSION}"
|
|
8
|
+
|
|
9
|
+
STATIC_CHAMPIONS = Addressable::Template.new "#{BASE_STATIC_URL}/champion{?api_key}"
|
|
10
|
+
STATIC_CHAMPION = Addressable::Template.new "#{STATIC_CHAMPIONS}/{id}{?api_key}"
|
|
11
|
+
STATIC_ITEMS = Addressable::Template.new "#{BASE_STATIC_URL}/item{?api_key}"
|
|
12
|
+
STATIC_ITEM = Addressable::Template.new "#{STATIC_ITEMS}/{id}{?api_key}"
|
|
13
|
+
STATIC_LANGUAGE_STRINGS = Addressable::Template.new "#{BASE_STATIC_URL}/language-strings{?api_key}"
|
|
14
|
+
STATIC_LANGUAGES = Addressable::Template.new "#{BASE_STATIC_URL}/languages{?api_key}"
|
|
15
|
+
STATIC_MAP = Addressable::Template.new "#{BASE_STATIC_URL}/map{?api_key}"
|
|
16
|
+
STATIC_MASTERIES = Addressable::Template.new "#{BASE_STATIC_URL}/mastery{?api_key}"
|
|
17
|
+
STATIC_MASTERY = Addressable::Template.new "#{STATIC_MASTERIES}/{id}{?api_key}"
|
|
18
|
+
STATIC_REALM = Addressable::Template.new "#{BASE_STATIC_URL}/realm{?api_key}"
|
|
19
|
+
STATIC_RUNES = Addressable::Template.new "#{BASE_STATIC_URL}/rune{?api_key}"
|
|
20
|
+
STATIC_RUNE = Addressable::Template.new "#{STATIC_RUNES}/{id}{?api_key}"
|
|
21
|
+
STATIC_SUMMONER_SPELLS = Addressable::Template.new "#{BASE_STATIC_URL}/summoner-spell{?api_key}"
|
|
22
|
+
STATIC_SUMMONER_SPELL = Addressable::Template.new "#{STATIC_SUMMONER_SPELLS}/{id}{?api_key}"
|
|
23
|
+
STATIC_VERSIONS = Addressable::Template.new "#{BASE_STATIC_URL}/versions{?api_key}"
|
|
24
|
+
|
|
25
|
+
CHAMP_DATA_OPTIONS = [
|
|
26
|
+
'all'.freeze,
|
|
27
|
+
'allytips'.freeze,
|
|
28
|
+
'altimages'.freeze,
|
|
29
|
+
'blurb'.freeze,
|
|
30
|
+
'enemytips'.freeze,
|
|
31
|
+
'image'.freeze,
|
|
32
|
+
'info'.freeze,
|
|
33
|
+
'lore'.freeze,
|
|
34
|
+
'partype'.freeze,
|
|
35
|
+
'passive'.freeze,
|
|
36
|
+
'recommended'.freeze,
|
|
37
|
+
'skins'.freeze,
|
|
38
|
+
'stats'.freeze,
|
|
39
|
+
'tags'.freeze
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
ITEM_DATA_OPTIONS = [
|
|
43
|
+
'all'.freeze,
|
|
44
|
+
'colloq'.freeze,
|
|
45
|
+
'consumeOnFull'.freeze,
|
|
46
|
+
'consumed'.freeze,
|
|
47
|
+
'depth'.freeze,
|
|
48
|
+
'from'.freeze,
|
|
49
|
+
'gold'.freeze,
|
|
50
|
+
'groups'.freeze,
|
|
51
|
+
'hideFromAll'.freeze,
|
|
52
|
+
'image'.freeze,
|
|
53
|
+
'inStore'.freeze,
|
|
54
|
+
'into'.freeze,
|
|
55
|
+
'maps'.freeze,
|
|
56
|
+
'requiredChampion'.freeze,
|
|
57
|
+
'sanitizedDescription'.freeze,
|
|
58
|
+
'specialRecipe'.freeze,
|
|
59
|
+
'stacks'.freeze,
|
|
60
|
+
'stats'.freeze,
|
|
61
|
+
'tags'.freeze,
|
|
62
|
+
'tree'.freeze
|
|
63
|
+
].freeze
|
|
64
|
+
|
|
65
|
+
MASTERY_DATA_OPTIONS = [
|
|
66
|
+
'all'.freeze,
|
|
67
|
+
'image'.freeze,
|
|
68
|
+
'masteryTree'.freeze,
|
|
69
|
+
'prereq'.freeze,
|
|
70
|
+
'ranks'.freeze,
|
|
71
|
+
'sanitizedDescription'.freeze
|
|
72
|
+
].freeze
|
|
73
|
+
|
|
74
|
+
SPELL_DATA_OPTIONS = [
|
|
75
|
+
'all'.freeze,
|
|
76
|
+
'cooldown'.freeze,
|
|
77
|
+
'cooldownBurn'.freeze,
|
|
78
|
+
'cost'.freeze,
|
|
79
|
+
'costType'.freeze,
|
|
80
|
+
'effect'.freeze,
|
|
81
|
+
'effectBurn'.freeze,
|
|
82
|
+
'image'.freeze,
|
|
83
|
+
'key'.freeze,
|
|
84
|
+
'leveltip'.freeze,
|
|
85
|
+
'maxrank'.freeze,
|
|
86
|
+
'modes'.freeze,
|
|
87
|
+
'range'.freeze,
|
|
88
|
+
'rangeBurn'.freeze,
|
|
89
|
+
'resource'.freeze,
|
|
90
|
+
'sanitizedDescription'.freeze,
|
|
91
|
+
'sanitizedTooltip'.freeze,
|
|
92
|
+
'tooltip'.freeze,
|
|
93
|
+
'vars'.freeze
|
|
94
|
+
].freeze
|
|
95
|
+
|
|
96
|
+
def static_champions(data_by_id: nil, champ_data_option: nil, locale: nil, version: nil)
|
|
97
|
+
response_for STATIC_CHAMPIONS, {dataById: data_by_id, champData: champ_data_option, locale: locale, version: version}
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def static_champion(id:, champ_data_option: nil, locale: nil, version: nil)
|
|
101
|
+
response_for STATIC_CHAMPION, {id: id, champData: champ_data_option, locale: locale, version: version}
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def static_items(item_data_option: nil, locale: nil, version: nil)
|
|
105
|
+
response_for STATIC_ITEMS, {itemListData: item_data_option, locale: locale, version: version,}
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def static_item(id:, item_data_option: nil, locale: nil, version: nil)
|
|
109
|
+
response_for STATIC_ITEM, {id: id, itemData: item_data_option, locale: locale, version: version}
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def static_language_strings(locale: nil, version: nil)
|
|
113
|
+
response_for STATIC_LANGUAGE_STRINGS, {locale: locale, version: version}
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def static_languages
|
|
117
|
+
response_for STATIC_LANGUAGES
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def static_map(locale: nil, version: nil)
|
|
121
|
+
response_for STATIC_MAP, {locale: locale, version: version}
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def static_masteries(mastery_data_option: nil, locale: nil, version: nil)
|
|
125
|
+
response_for STATIC_MASTERIES, {masteryListData: mastery_data_option, locale: locale, version: version}
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def static_mastery(id:, mastery_data_option: nil, locale: nil, version: nil)
|
|
129
|
+
response_for STATIC_MASTERY, {id: id, masteryData: mastery_data_option, locale:locale, version: version}
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def static_realm
|
|
133
|
+
response_for STATIC_REALM
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def static_runes(rune_data_option: nil, locale: nil, version: nil)
|
|
137
|
+
response_for STATIC_RUNES, {runeListData: rune_data_option, locale: locale, version: version}
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def static_rune(id:, rune_data_option: nil, locale: nil, version: nil)
|
|
141
|
+
response_for STATIC_RUNE, {id: id, runeData: rune_data_option, locale: locale, version: version}
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def static_summoner_spells(data_by_id: nil, spell_data_option: nil, locale: nil, version: nil)
|
|
145
|
+
response_for STATIC_SUMMONER_SPELLS, {dataById: data_by_id, spellData: spell_data_option, locale: locale, version: version}
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def static_summoner_spell(id:, spell_data_option: nil, locale: nil, version: nil)
|
|
149
|
+
response_for STATIC_SUMMONER_SPELL, {id: id, spellData: spell_data_option, locale: locale, version: version}
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def static_versions
|
|
153
|
+
response_for STATIC_VERSIONS
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Taric
|
|
2
|
+
module Operation
|
|
3
|
+
module LolStatus
|
|
4
|
+
SHARDS = Addressable::Template.new 'http://status.leagueoflegends.com/shards'
|
|
5
|
+
SHARD = Addressable::Template.new 'http://status.leagueoflegends.com/shards/{region}'
|
|
6
|
+
|
|
7
|
+
def shards
|
|
8
|
+
response_for SHARDS
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def shard(region:)
|
|
12
|
+
response_for SHARD, {region: region}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require_relative 'base'
|
|
2
|
+
module Taric
|
|
3
|
+
module Operation
|
|
4
|
+
module Match
|
|
5
|
+
include Taric::Operation::Base
|
|
6
|
+
|
|
7
|
+
MATCH_VERSION = 'v2.2'
|
|
8
|
+
MATCH = Addressable::Template.new "#{BASE_URL_FN.(MATCH_VERSION)}/match/{matchId}"
|
|
9
|
+
|
|
10
|
+
def match(id:, include_timeline: nil)
|
|
11
|
+
response_for MATCH, {matchId: id, includeTimeline: include_timeline}
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require_relative 'base'
|
|
2
|
+
module Taric
|
|
3
|
+
module Operation
|
|
4
|
+
module Stats
|
|
5
|
+
include Taric::Operation::Base
|
|
6
|
+
|
|
7
|
+
STATS_VERSION = 'v1.3'.freeze
|
|
8
|
+
BASE_STATS_URL = Addressable::Template.new "#{BASE_URL_FN.(STATS_VERSION)}/stats/by-summoner/{summonerId}{?api_key}"
|
|
9
|
+
RANKED = Addressable::Template.new "#{BASE_STATS_URL}/ranked{?api_key}"
|
|
10
|
+
SUMMARY = Addressable::Template.new "#{BASE_STATS_URL}/summary{?api_key}"
|
|
11
|
+
|
|
12
|
+
def ranked(summoner_id: , season: nil)
|
|
13
|
+
response_for RANKED, {summonerId: summoner_id, season: season}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def summary(summoner_id: , season: nil)
|
|
17
|
+
response_for SUMMARY, {summonerId: summoner_id, season: season}
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require_relative 'base'
|
|
2
|
+
module Taric
|
|
3
|
+
module Operation
|
|
4
|
+
module Summoner
|
|
5
|
+
include Taric::Operation::Base
|
|
6
|
+
|
|
7
|
+
VERSION = 'v1.4'
|
|
8
|
+
BASE_SUMMONER_URL = "#{BASE_URL_FN.(VERSION)}/summoner"
|
|
9
|
+
|
|
10
|
+
BY_NAMES = Addressable::Template.new "#{BASE_SUMMONER_URL}/by-name/{summonerNames}{?api_key}"
|
|
11
|
+
BY_IDS = Addressable::Template.new "#{BASE_SUMMONER_URL}/{summonerIds}{?api_key}"
|
|
12
|
+
MASTERIES = Addressable::Template.new "#{BY_IDS}/masteries{?api_key}"
|
|
13
|
+
NAMES = Addressable::Template.new "#{BY_IDS}/name{?api_key}"
|
|
14
|
+
RUNES = Addressable::Template.new "#{BY_IDS}/rune{?api_key}"
|
|
15
|
+
|
|
16
|
+
def summoners_by_names(names:)
|
|
17
|
+
response_for BY_NAMES, {summonerNames: names}
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def summoners_by_ids(summoner_ids:)
|
|
21
|
+
response_for BY_IDS, {summonerIds: summoner_ids}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def masteries(summoner_ids:)
|
|
25
|
+
response_for MASTERIES, {summonerIds: summoner_ids}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def name(summoner_ids)
|
|
29
|
+
response_for NAME, {summonerIds: summoner_ids}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def runes(summoner_ids:)
|
|
33
|
+
response_for RUNES, {summonerIds: summoner_ids}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require_relative 'base'
|
|
2
|
+
module Taric
|
|
3
|
+
module Operation
|
|
4
|
+
module Team
|
|
5
|
+
include Taric::Operation::Base
|
|
6
|
+
|
|
7
|
+
TEAM_VERSION = 'v2.4'.freeze
|
|
8
|
+
BASE_TEAM_URL = "#{BASE_URL_FN.(TEAM_VERSION)}/team"
|
|
9
|
+
|
|
10
|
+
TEAMS_BY_SUMMONER_IDS = Addressable::Template.new "#{BASE_TEAM_URL}/by-summoner/{summonerIds}"
|
|
11
|
+
TEAMS_BY_TEAM_IDS = Addressable::Template.new "#{BASE_TEAM_URL}/{teamIds}"
|
|
12
|
+
|
|
13
|
+
def teams_by_summoner_ids(summoner_ids:)
|
|
14
|
+
response_for TEAMS_BY_SUMMONER_IDS, {summonerIds: summoner_ids}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def teams(team_ids:)
|
|
18
|
+
response_for TEAMS_BY_TEAM_IDS, {teamIds: team_ids}
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
data/lib/taric/version.rb
CHANGED
data/taric.gemspec
CHANGED
|
@@ -8,14 +8,10 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.version = Taric::VERSION
|
|
9
9
|
spec.authors = ["Joseph Yi"]
|
|
10
10
|
spec.email = ["dissonance@gmail.com"]
|
|
11
|
-
#
|
|
12
|
-
# if spec.respond_to?(:metadata)
|
|
13
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
|
|
14
|
-
# end
|
|
15
11
|
|
|
16
12
|
spec.summary = %q{Riot Games LoL Api Client}
|
|
17
13
|
spec.description = %q{Riot Games LoL Api Client.}
|
|
18
|
-
spec.homepage = "http://github.com/
|
|
14
|
+
spec.homepage = "http://github.com/josephyi/taric"
|
|
19
15
|
spec.license = "MIT"
|
|
20
16
|
|
|
21
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: taric
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joseph Yi
|
|
@@ -172,6 +172,14 @@ extensions: []
|
|
|
172
172
|
extra_rdoc_files: []
|
|
173
173
|
files:
|
|
174
174
|
- ".gitignore"
|
|
175
|
+
- ".idea/.name"
|
|
176
|
+
- ".idea/.rakeTasks"
|
|
177
|
+
- ".idea/encodings.xml"
|
|
178
|
+
- ".idea/misc.xml"
|
|
179
|
+
- ".idea/modules.xml"
|
|
180
|
+
- ".idea/scopes/scope_settings.xml"
|
|
181
|
+
- ".idea/taric.iml"
|
|
182
|
+
- ".idea/vcs.xml"
|
|
175
183
|
- ".rspec"
|
|
176
184
|
- ".travis.yml"
|
|
177
185
|
- CODE_OF_CONDUCT.md
|
|
@@ -182,9 +190,25 @@ files:
|
|
|
182
190
|
- bin/console
|
|
183
191
|
- bin/setup
|
|
184
192
|
- lib/taric.rb
|
|
193
|
+
- lib/taric/client.rb
|
|
194
|
+
- lib/taric/configuration.rb
|
|
195
|
+
- lib/taric/connection.rb
|
|
196
|
+
- lib/taric/operation/api.rb
|
|
197
|
+
- lib/taric/operation/base.rb
|
|
198
|
+
- lib/taric/operation/champion.rb
|
|
199
|
+
- lib/taric/operation/current_game.rb
|
|
200
|
+
- lib/taric/operation/featured_games.rb
|
|
201
|
+
- lib/taric/operation/game.rb
|
|
202
|
+
- lib/taric/operation/league.rb
|
|
203
|
+
- lib/taric/operation/lol_static_data.rb
|
|
204
|
+
- lib/taric/operation/lol_status.rb
|
|
205
|
+
- lib/taric/operation/match.rb
|
|
206
|
+
- lib/taric/operation/stats.rb
|
|
207
|
+
- lib/taric/operation/summoner.rb
|
|
208
|
+
- lib/taric/operation/team.rb
|
|
185
209
|
- lib/taric/version.rb
|
|
186
210
|
- taric.gemspec
|
|
187
|
-
homepage: http://github.com/
|
|
211
|
+
homepage: http://github.com/josephyi/taric
|
|
188
212
|
licenses:
|
|
189
213
|
- MIT
|
|
190
214
|
metadata: {}
|
|
@@ -204,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
204
228
|
version: '0'
|
|
205
229
|
requirements: []
|
|
206
230
|
rubyforge_project:
|
|
207
|
-
rubygems_version: 2.4.
|
|
231
|
+
rubygems_version: 2.4.3
|
|
208
232
|
signing_key:
|
|
209
233
|
specification_version: 4
|
|
210
234
|
summary: Riot Games LoL Api Client
|