riot-api-ruby 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b7eeb82fca08f3528adc564714ecf19f7ff591bf
4
+ data.tar.gz: 3f901895a897fb3c4bcce0cc228035551986d7e8
5
+ SHA512:
6
+ metadata.gz: a5cb8a43869fdd422cac425b4850eef523a1ee5a0fc1b4012a43d639cefd864604f8d95fd43deb94f5637ed7e4df473967b7f143e866b1e57add18165b764575
7
+ data.tar.gz: 144fb0914d062983ab19d844d85194dd646bbffe34e6bd38b870b6ed441a162aa1442f3b99fb755f5b0dfd6364836d30a107134219b356dcd93bf0296e4c4ca2
@@ -0,0 +1,22 @@
1
+ class RiotAPI
2
+ def initialize(apiKey)
3
+ Utils.setAPIKey(apiKey)
4
+ end
5
+
6
+ # TODO riot-api
7
+ # handle Response Error exceptions
8
+ # make the API more intuitive (classes that pre-initialize all the needed data)
9
+
10
+ #Includes
11
+ require 'open-uri'
12
+ require 'json'
13
+ require 'certified'
14
+ require "riot-api-ruby/champion"
15
+ require "riot-api-ruby/game"
16
+ require "riot-api-ruby/league"
17
+ require "riot-api-ruby/lol-static-data"
18
+ require "riot-api-ruby/stats"
19
+ require "riot-api-ruby/summoner"
20
+ require "riot-api-ruby/team"
21
+ require "riot-api-ruby/utilities"
22
+ end
@@ -0,0 +1,19 @@
1
+ class Champion
2
+
3
+ class GetChampion
4
+ def self.byID(region, id)
5
+ uri = Utils.baseURI + '/api/lol/' + region +'/v1.2/champion/' + id + "?api_key=" + Utils.getAPIKey
6
+ jsonRequest = open(uri).read
7
+ return JSON.parse(jsonRequest)
8
+ end
9
+ end
10
+
11
+ class GetChampions
12
+ def self.byRegion(region, f2p)
13
+ uri = Utils.baseURI + '/api/lol/' + region +'/v1.2/champion' + "?api_key=" + Utils.getAPIKey
14
+ jsonRequest = open(uri).read
15
+ return JSON.parse(jsonRequest)
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,13 @@
1
+ class Game
2
+
3
+ class RecentGames
4
+
5
+ def self.bySummonerID(region, summonerID)
6
+ uri = Utils.baseURI + '/api/lol/' + region +'/v1.3/game/by-summoner/' + summonerID + '/recent' + "?api_key=" + Utils.getAPIKey
7
+ jsonRequest = open(uri).read
8
+ return JSON.parse(jsonRequest)
9
+ end
10
+
11
+ end
12
+
13
+ end
@@ -0,0 +1,40 @@
1
+ class League
2
+
3
+ class BySummoner
4
+
5
+ def self.leagues(region, summonerIDs)
6
+ uri = Utils.baseURI + '/api/lol/' + region +'/v2.4/league/by-summoner/' + summonerIDs + "?api_key=" + Utils.getAPIKey
7
+ jsonRequest = open(uri).read
8
+ return JSON.parse(jsonRequest)
9
+ end
10
+
11
+ def self.entries(region, summonerIDs)
12
+ uri = Utils.baseURI + '/api/lol/' + region +'/v2.4/league/by-summoner/' + summonerIDs + '/entry' + "?api_key=" + Utils.getAPIKey
13
+ jsonRequest = open(uri).read
14
+ return JSON.parse(jsonRequest)
15
+ end
16
+
17
+ end
18
+
19
+ class ByTeam
20
+ def self.leagues(region, teamIDs)
21
+ uri = Utils.baseURI + '/api/lol/' + region +'/v2.4/league/by-team/' + teamIDs + "?api_key=" + Utils.getAPIKey
22
+ jsonRequest = open(uri).read
23
+ return JSON.parse(jsonRequest)
24
+ end
25
+
26
+ def self.entries(region, teamIDs)
27
+ uri = Utils.baseURI + '/api/lol/' + region +'/v2.4/league/by-team/' + teamIDs + '/entry' + "?api_key=" + Utils.getAPIKey
28
+ jsonRequest = open(uri).read
29
+ return JSON.parse(jsonRequest)
30
+ end
31
+
32
+ end
33
+
34
+ def self.challenger(region)
35
+ uri = Utils.baseURI + '/api/lol/' + region +'/v2.4/league/challenger/' + "?api_key=" + Utils.getAPIKey
36
+ jsonRequest = open(uri).read
37
+ return JSON.parse(jsonRequest)
38
+ end
39
+
40
+ end
@@ -0,0 +1,46 @@
1
+ class StaticData
2
+
3
+ def self.champion(region, id)
4
+ uri = Utils.baseURI + '/api/lol/static-data/' + region + '/v1.2/champion/' + id + "?api_key=" + Utils.getAPIKey
5
+ jsonRequest = open(uri).read
6
+ return JSON.parse(jsonRequest)
7
+ end
8
+
9
+ def self.item(region, id)
10
+ uri = Utils.baseURI + '/api/lol/static-data/' + region + '/v1.2/item/' + id + "?api_key=" + Utils.getAPIKey
11
+ jsonRequest = open(uri).read
12
+ return JSON.parse(jsonRequest)
13
+ end
14
+
15
+
16
+ def self.mastery(region, id)
17
+ uri = Utils.baseURI + '/api/lol/static-data/' + region + '/v1.2/mastery/' + id + "?api_key=" + Utils.getAPIKey
18
+ jsonRequest = open(uri).read
19
+ return JSON.parse(jsonRequest)
20
+ end
21
+
22
+ def self.rune(region, id)
23
+ uri = Utils.baseURI + '/api/lol/static-data/' + region + '/v1.2/rune/' + id + "?api_key=" + Utils.getAPIKey
24
+ jsonRequest = open(uri).read
25
+ return JSON.parse(jsonRequest)
26
+ end
27
+
28
+ def self.summonerspell(region, id)
29
+ uri = Utils.baseURI + '/api/lol/static-data/' + region + '/v1.2/summoner-spell/' + id + "?api_key=" + Utils.getAPIKey
30
+ jsonRequest = open(uri).read
31
+ return JSON.parse(jsonRequest)
32
+ end
33
+
34
+ def self.realm(region)
35
+ uri = Utils.baseURI + '/api/lol/static-data/' + region + '/v1.2/realm' + "?api_key=" + Utils.getAPIKey
36
+ jsonRequest = open(uri).read
37
+ return JSON.parse(jsonRequest)
38
+ end
39
+
40
+ def self.versions(region)
41
+ uri = Utils.baseURI + '/api/lol/static-data/' + region + '/v1.2/versions' + "?api_key=" + Utils.getAPIKey
42
+ jsonRequest = open(uri).read
43
+ return JSON.parse(jsonRequest)
44
+ end
45
+
46
+ end
@@ -0,0 +1,15 @@
1
+ class Stats
2
+
3
+ def self.ranked(region, summonerID, season)
4
+ uri = Utils.baseURI + '/api/lol/' + region + '/v1.3/stats/by-summoner/' + summonerID + '/ranked?season=' + season + "&api_key=" + Utils.getAPIKey
5
+ jsonRequest = open(uri).read
6
+ return JSON.parse(jsonRequest)
7
+ end
8
+
9
+ def self.summary(region, summonerID, season)
10
+ uri = Utils.baseURI + '/api/lol/' + region + '/v1.3/stats/by-summoner/' + summonerID + '/summary?season=' + season + "&api_key=" + Utils.getAPIKey
11
+ jsonRequest = open(uri).read
12
+ return JSON.parse(jsonRequest)
13
+ end
14
+
15
+ end
@@ -0,0 +1,34 @@
1
+ class Summoner
2
+
3
+ def self.byNames(region, summonerNames)
4
+ uri = Utils.baseURI + '/api/lol/' + region + '/v1.4/summoner/by-name/' + summonerNames + "?api_key=" + Utils.getAPIKey
5
+ puts uri
6
+ jsonRequest = open(uri).read
7
+ return JSON.parse(jsonRequest)
8
+ end
9
+
10
+ def self.byIDS(region, summonerIDS)
11
+ uri = Utils.baseURI + '/api/lol/' + region + '/v1.4/summoner/' + summonerIDS + "?api_key=" + Utils.getAPIKey
12
+ jsonRequest = open(uri).read
13
+ return JSON.parse(jsonRequest)
14
+ end
15
+
16
+ def self.masteries(region, summonerIDS)
17
+ uri = Utils.baseURI + '/api/lol/' + region + '/v1.4/summoner/' + summonerIDS + '/masteries' + "?api_key=" + Utils.getAPIKey
18
+ jsonRequest = open(uri).read
19
+ return JSON.parse(jsonRequest)
20
+ end
21
+
22
+ def self.names(region, summonerIDS)
23
+ uri = Utils.baseURI + '/api/lol/' + region + '/v1.3/stats/by-summoner/' + summonerIDS + '/name' + "?api_key=" + Utils.getAPIKey
24
+ jsonRequest = open(uri).read
25
+ return JSON.parse(jsonRequest)
26
+ end
27
+
28
+ def self.runes(region, summonerIDS)
29
+ uri = Utils.baseURI + '/api/lol/' + region + '/v1.3/stats/by-summoner/' + summonerIDS + '/runes' + "?api_key=" + Utils.getAPIKey
30
+ jsonRequest = open(uri).read
31
+ return JSON.parse(jsonRequest)
32
+ end
33
+
34
+ end
@@ -0,0 +1,15 @@
1
+ class Team
2
+
3
+ def self.bySummonerIDS(region, summonerIDS)
4
+ uri = Utils.baseURI + '/api/lol/' + region + '/v2.3/team/by-summoner/' + summonerIDS + "?api_key=" + Utils.getAPIKey
5
+ jsonRequest = open(uri).read
6
+ return JSON.parse(jsonRequest)
7
+ end
8
+
9
+ def self.byTeamIDS(region, teamIDS)
10
+ uri = Utils.baseURI + '/api/lol/' + region + '/v2.3/team/' + teamIDS + "?api_key=" + Utils.getAPIKey
11
+ jsonRequest = open(uri).read
12
+ return JSON.parse(jsonRequest)
13
+ end
14
+
15
+ end
@@ -0,0 +1,17 @@
1
+ class Utils
2
+
3
+ @@apiKey
4
+
5
+ def self.baseURI
6
+ return "https://prod.api.pvp.net"
7
+ end
8
+
9
+ def self.getAPIKey
10
+ return @@apiKey
11
+ end
12
+
13
+ def self.setAPIKey(apiKey)
14
+ @@apiKey = apiKey
15
+ end
16
+
17
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: riot-api-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Corey DeMarse
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A ruby gem for the Riot Developers API
14
+ email: ''
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/riot-api-ruby.rb
20
+ - lib/riot-api-ruby/champion.rb
21
+ - lib/riot-api-ruby/game.rb
22
+ - lib/riot-api-ruby/league.rb
23
+ - lib/riot-api-ruby/lol-static-data.rb
24
+ - lib/riot-api-ruby/stats.rb
25
+ - lib/riot-api-ruby/summoner.rb
26
+ - lib/riot-api-ruby/team.rb
27
+ - lib/riot-api-ruby/utilities.rb
28
+ homepage: http://github.com/matadoer
29
+ licenses:
30
+ - MIT
31
+ metadata: {}
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ requirements: []
47
+ rubyforge_project:
48
+ rubygems_version: 2.2.2
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: A ruby gem for the Riot Developers API
52
+ test_files: []