LoLStat 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 +7 -0
- data/lib/LoLStat.rb +22 -0
- data/lib/LoLStat/Leagues.rb +7 -0
- data/lib/LoLStat/Masteries.rb +7 -0
- data/lib/LoLStat/RankedStats.rb +7 -0
- data/lib/LoLStat/RecentGames.rb +17 -0
- data/lib/LoLStat/Runes.rb +7 -0
- data/lib/LoLStat/Stats.rb +7 -0
- data/lib/LoLStat/Summoner.rb +48 -0
- data/lib/LoLStat/Teams.rb +7 -0
- metadata +52 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 2092d409faff5ecf7f7a5d6eb4d1eab08d92e815
|
|
4
|
+
data.tar.gz: caab5740520be176840cea59b863d8b4a240cd2e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 686ad99af1dbfb699b638f09294540327c55bc5396cfdb25eae9e4715a2c078ec107404b4c77e8c1aea422eb1d0e0137361957f6261b658ceb7fd914b24a5f71
|
|
7
|
+
data.tar.gz: b859ba3d702c42fec8029edd7c18da59a80a3100861cd7419e99ed61abffe177fa35b05816f3f006b5ff1c943cf4492f06f04bdfd9cb0620b1151485a9ca59c6
|
data/lib/LoLStat.rb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#api from https://developer.riotgames.com/
|
|
2
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__))
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'json'
|
|
5
|
+
require 'net/http'
|
|
6
|
+
require 'uri'
|
|
7
|
+
require 'LoLStat/Summoner'
|
|
8
|
+
|
|
9
|
+
class LoLStat
|
|
10
|
+
attr_accessor :api_key
|
|
11
|
+
def initialize(api_key)
|
|
12
|
+
@api_key = api_key.to_s
|
|
13
|
+
end
|
|
14
|
+
def find_summoner_by_id(id)
|
|
15
|
+
uri = "https://prod.api.pvp.net/api/lol/na/v1.1/summoner/" + id.to_s + "?api_key=" + @api_key
|
|
16
|
+
return Summoner.new(JSON.parse(Net::HTTP.get_response(URI.parse(uri)).body), @api_key)
|
|
17
|
+
end
|
|
18
|
+
def find_summoner_by_name(name)
|
|
19
|
+
uri = "https://prod.api.pvp.net/api/lol/na/v1.1/summoner/by-name/" + URI.encode(name.to_s) + "?api_key=" + @api_key
|
|
20
|
+
return Summoner.new(JSON.parse(Net::HTTP.get_response(URI.parse(uri)).body), @api_key)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class Masteries
|
|
2
|
+
attr_reader :data
|
|
3
|
+
def initialize(summonerId, api_key)
|
|
4
|
+
@URI = "https://prod.api.pvp.net/api/lol/na/v1.1/game/by-summoner/" + summonerId.to_s + "/recent" + "?api_key=" + api_key.to_s
|
|
5
|
+
@data = JSON.parse(Net::HTTP.get_response(URI.parse(@URI)).body)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class RankedStats
|
|
2
|
+
attr_reader :data
|
|
3
|
+
def initialize(summonerId, api_key)
|
|
4
|
+
@URI = "https://prod.api.pvp.net/api/lol/na/v1.1/stats/by-summoner/" + summonerId.to_s + "/ranked" + "?api_key=" + api_key.to_s
|
|
5
|
+
@data = JSON.parse(Net::HTTP.get_response(URI.parse(@URI)).body)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class RecentGames
|
|
2
|
+
attr_reader :data
|
|
3
|
+
def initialize(summonerId, api_key)
|
|
4
|
+
@URI = "https://prod.api.pvp.net/api/lol/na/v1.1/game/by-summoner/" + summonerId.to_s + "/recent" + "?api_key=" + api_key.to_s
|
|
5
|
+
@data = JSON.parse(Net::HTTP.get_response(URI.parse(@URI)).body)
|
|
6
|
+
end
|
|
7
|
+
def getGame(game_num)
|
|
8
|
+
return Game.new(@data, game_num)
|
|
9
|
+
end
|
|
10
|
+
class Game
|
|
11
|
+
attr_reader :data, :gameId
|
|
12
|
+
def initialize(game_list, game_num)
|
|
13
|
+
@data = game_list["games"][game_num]
|
|
14
|
+
@gameId = @data["gameId"]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class Runes
|
|
2
|
+
attr_reader :data
|
|
3
|
+
def initialize(summonerId, api_key)
|
|
4
|
+
@URI = "https://prod.api.pvp.net/api/lol/na/v1.1/summoner/" + summonerId.to_s + "/runes" + "?api_key=" + api_key.to_s
|
|
5
|
+
@data = JSON.parse(Net::HTTP.get_response(URI.parse(@URI)).body)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class Stats
|
|
2
|
+
attr_reader :datas
|
|
3
|
+
def initialize(summonerId, api_key)
|
|
4
|
+
@URI = "https://prod.api.pvp.net/api/lol/na/v1.1/stats/by-summoner/" + summonerId.to_s + "/summary" + "?api_key=" + api_key.to_s
|
|
5
|
+
@data = JSON.parse(Net::HTTP.get_response(URI.parse(@URI)).body)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__))
|
|
2
|
+
require 'RecentGames'
|
|
3
|
+
require 'Leagues'
|
|
4
|
+
require 'Stats'
|
|
5
|
+
require 'RankedStats'
|
|
6
|
+
require 'Masteries'
|
|
7
|
+
require 'Runes'
|
|
8
|
+
require 'Teams'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Summoner
|
|
12
|
+
attr_reader :api_key, :data, :summonerId, :summonerName
|
|
13
|
+
def initialize(summoner, api_key)
|
|
14
|
+
@api_key = api_key
|
|
15
|
+
@data = summoner
|
|
16
|
+
@summonerId = summoner["id"]
|
|
17
|
+
@summonerName = summoner["name"]
|
|
18
|
+
end
|
|
19
|
+
def profileIconId()
|
|
20
|
+
@data["profileIconId"]
|
|
21
|
+
end
|
|
22
|
+
def summonerLevel()
|
|
23
|
+
@data["summonerLevel"]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def recentGames()
|
|
27
|
+
return RecentGames.new(@summonerId, @api_key)
|
|
28
|
+
end
|
|
29
|
+
def leagues()
|
|
30
|
+
return Leagues.new(@summonerId, @api_key)
|
|
31
|
+
end
|
|
32
|
+
def stats()
|
|
33
|
+
return Stats.new(@summonerId, @api_key)
|
|
34
|
+
end
|
|
35
|
+
def rankedStats()
|
|
36
|
+
return RankedStats.new(@summonerId, @api_key)
|
|
37
|
+
end
|
|
38
|
+
def masteries()
|
|
39
|
+
return Masteries.new(@summonerId, @api_key)
|
|
40
|
+
end
|
|
41
|
+
def runes()
|
|
42
|
+
return Runes.new(@summonerId, @api_key)
|
|
43
|
+
end
|
|
44
|
+
def teams()
|
|
45
|
+
return Teams.new(@summonerId, @api_key)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: LoLStat
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Timothy Quach
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2013-12-14 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A barebones League of Legends API Wrapper
|
|
14
|
+
email: timothyquach94@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/LoLStat.rb
|
|
20
|
+
- lib/LoLStat/Summoner.rb
|
|
21
|
+
- lib/LoLStat/Leagues.rb
|
|
22
|
+
- lib/LoLStat/Teams.rb
|
|
23
|
+
- lib/LoLStat/Masteries.rb
|
|
24
|
+
- lib/LoLStat/Runes.rb
|
|
25
|
+
- lib/LoLStat/RankedStats.rb
|
|
26
|
+
- lib/LoLStat/RecentGames.rb
|
|
27
|
+
- lib/LoLStat/Stats.rb
|
|
28
|
+
homepage: https://github.com/timothyquach/LoLStat
|
|
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.1.9
|
|
49
|
+
signing_key:
|
|
50
|
+
specification_version: 4
|
|
51
|
+
summary: League of Legends API Wrapper
|
|
52
|
+
test_files: []
|