sightstone 0.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 243c70edff88cf6ca5d8eb317dd0437f2bbac531
|
4
|
+
data.tar.gz: 9da5d398a81d48ec7092c1b590ac987d9c12dfab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5402a448fda8ed420686b8883809dce83ec2628b458df69316a60b12842e7063267e91f2f25deb3333aee3726f025c72a87be0369a19331b42bf431fb4e3f8fb
|
7
|
+
data.tar.gz: 5f48ca696b4341696d3a713c31d46c3e0c1de0f122cc663ef6d2beb3a7b04f0412f2e27186321e087d123b54fc53bfa904f517bf04222b8160bb5dbc3ce87c4d
|
data/lib/sightstone/league.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
+
# Class to represent a league
|
2
|
+
# @attr [String] name name of the league
|
3
|
+
# @attr [String] queue queue Type (can be: RANKED_SOLO_5x5, RANKED_TEAM_3x3, RANKED_TEAM_5x5)
|
4
|
+
# @attr [String] tier tier of the requestet summoner (can be: CHALLENGER, DIAMOND, PLATINUM, GOLD, SILVER, BRONZE)
|
5
|
+
# @attr [Array<LeagueItem>] entries
|
1
6
|
class League
|
2
|
-
attr_accessor :entries, :name, :queue, :tier
|
7
|
+
attr_accessor :entries, :name, :queue, :tier
|
3
8
|
|
4
9
|
def initialize(data)
|
5
10
|
@name = data['name']
|
6
11
|
@queue = data['queue']
|
7
12
|
@tier = data['tier']
|
8
|
-
@timestamp = data['timestamp']
|
9
13
|
@entries = []
|
10
14
|
data['entries'].each do |entry|
|
11
15
|
@entries << LeagueItem.new(entry)
|
@@ -13,29 +17,48 @@ class League
|
|
13
17
|
end
|
14
18
|
end
|
15
19
|
|
20
|
+
# One entry of a league
|
21
|
+
# @attr [Boolean] isFreshBlood determines if summoner is new in the league
|
22
|
+
# @attr [Boolean] isHotStreak hotStreak = 3 games won in a row
|
23
|
+
# @attr [Boolean] isInactive true if summoner is inactive
|
24
|
+
# @attr [Boolean] isVetern true if veteran
|
25
|
+
# @attr [Fixnum] lastPlayed timestamp of last played game
|
26
|
+
# @attr [String] leagueName name of the league
|
27
|
+
# @attr [Fixnum] leaguePoints leaguePoints
|
28
|
+
# @attr [MiniSeries, nil] nil if player has no miniseries, a miniseries object if he is in one
|
29
|
+
# @attr [String] playerOrTeamId id of the player or team as a string
|
30
|
+
# @attr [String] playerOrTeamName name of the player/team
|
31
|
+
# @attr [String] queueType type of the queue
|
32
|
+
# @attr [String] rank rank (can be: I, II, III, IV, V)
|
33
|
+
# @attr [String] tier tier (can be: CHALLENGER, DIAMOND, PLATINUM, GOLD, SILVER, BRONZE)
|
34
|
+
# @attr [Fixnum] wins number of won matches in given queue
|
16
35
|
class LeagueItem
|
17
|
-
attr_accessor :isFreshBlood, :isHotStreak, :
|
36
|
+
attr_accessor :isFreshBlood, :isHotStreak, :isInactive, :isVeteran, :lastPlayed, :leagueName, :leaguePoints, :miniSeries, :playerOrTeamId, :playerOrTeamName, :queueType, :rank, :tier, :wins
|
18
37
|
|
19
38
|
def initialize(data)
|
20
39
|
@isFreshBlood=data['isFreshBlood']
|
21
40
|
@isHotStreak=data['isHotStreak']
|
22
|
-
@
|
41
|
+
@isInactive=data['isInactive']
|
23
42
|
@isVeteran=data['isVeteran']
|
24
43
|
@lastPlayed=data['lastPlayed']
|
25
|
-
@leagueName=data['
|
44
|
+
@leagueName=data['leagueName']
|
26
45
|
@leaguePoints=data['leaguePoints']
|
27
|
-
@losses=data['losses']
|
28
46
|
@miniSeries= MiniSeries.new(data['miniSeries']) if data.has_key? 'miniSeries'
|
29
47
|
@playerOrTeamId=data['playerOrTeamId']
|
30
48
|
@playerOrTeamName=data['playerOrTeamName']
|
31
49
|
@queueType=data['queueType']
|
32
50
|
@rank=data['rank']
|
33
51
|
@tier=data['tier']
|
34
|
-
@timeUntilDecay=data['timeUntilDecay']
|
35
52
|
@wins=data['wins']
|
36
53
|
end
|
37
54
|
end
|
38
55
|
|
56
|
+
# Class to represent a MiniSeries (Promotion games)
|
57
|
+
# @attr [Fixnum] losses number of lost games of the series
|
58
|
+
# @attr [Fixnum] wins number of won games of the series
|
59
|
+
# @attr [Fixnum] target number of required wins to win the series
|
60
|
+
# @attr [Fixnum] timeLeftToPlayMillis time left to complete the series
|
61
|
+
# @attr [String] win/loose history as a string. Each character shows a (W)in, (L)oss or (N)ot played
|
39
62
|
class MiniSeries
|
40
63
|
attr_accessor :losses, :wins, :target, :progress, :timeLeftToPlayMillis
|
41
64
|
def initialize(data)
|
@@ -43,6 +66,6 @@ class MiniSeries
|
|
43
66
|
@wins = data['wins']
|
44
67
|
@target = data['target']
|
45
68
|
@progress = data['progress']
|
46
|
-
@timeLeftToPlayMillis = data['
|
69
|
+
@timeLeftToPlayMillis = data['timeLeftToPlayMillis']
|
47
70
|
end
|
48
71
|
end
|
@@ -8,7 +8,7 @@ class DatadragonModule < SightstoneBaseModule
|
|
8
8
|
|
9
9
|
def version(optional={})
|
10
10
|
region = optional[:region] || @sightstone.region
|
11
|
-
uri = "
|
11
|
+
uri = "https://ddragon.leagueoflegends.com/realms/#{region}.json"
|
12
12
|
|
13
13
|
response = _get_api_response(uri)
|
14
14
|
_parse_response(response) { |resp|
|
@@ -2,11 +2,16 @@ require 'sightstone/modules/sightstone_base_module'
|
|
2
2
|
require 'sightstone/summoner'
|
3
3
|
require 'sightstone/league'
|
4
4
|
|
5
|
+
# module to provide calls to the league api
|
5
6
|
class LeagueModule < SightstoneBaseModule
|
6
7
|
def initialize(sightstone)
|
7
8
|
@sightstone = sightstone
|
8
9
|
end
|
9
10
|
|
11
|
+
# Provides league information of a summoner
|
12
|
+
# @param [Summoner, Integer] summoner
|
13
|
+
# @param optional [Hash] optional arguments: :region => replaces default region
|
14
|
+
# @returns [Array<League>] an array of all leagues the summoner and his teams are in
|
10
15
|
def league(summoner, optional={})
|
11
16
|
region = optional[:region] || @sightstone.region
|
12
17
|
id = if summoner.is_a? Summoner
|
@@ -15,7 +20,7 @@ class LeagueModule < SightstoneBaseModule
|
|
15
20
|
summoner
|
16
21
|
end
|
17
22
|
|
18
|
-
uri = "https://prod.api.pvp.net/api/#{region}/v2.
|
23
|
+
uri = "https://prod.api.pvp.net/api/lol/#{region}/v2.2/league/by-summoner/#{id}"
|
19
24
|
response = _get_api_response(uri)
|
20
25
|
_parse_response(response) { |resp|
|
21
26
|
data = JSON.parse(resp)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sightstone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2012-12-
|
11
|
+
date: 2012-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
85
|
rubyforge_project:
|
86
|
-
rubygems_version: 2.
|
86
|
+
rubygems_version: 2.1.10
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: Ruby wrapper for riots league of legends api
|