sightstone 1.1.1 → 1.2.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: 5430116b45094b367aeacadb72e4d01f2cd6d20b
4
- data.tar.gz: 9736aff967352f2bd42a0c410f42f67d19c03436
3
+ metadata.gz: ceec81e765a40e9490ee4f7ec2e6bdd4df106422
4
+ data.tar.gz: 5d3756bd092397e15aed7c741d9724a06a7dcf1e
5
5
  SHA512:
6
- metadata.gz: e55b0d8e928d5f46424dda7c01a42e33bcd7e44b03f17bb642c076a798aa8870028a3f28cdcf5e7b79abc609f922a5fa1768f93b5d986588f306483a3622e06f
7
- data.tar.gz: 51192ec4a77e121d0a1ac802373feaa84098ce98f4d1b550ebe939309671fa58b83d6c05cacd00b8f885c975dc33ff07f489f93e080354074b48db3803334179
6
+ metadata.gz: bab7cd5ad8b2855dc9d34926aa0baa36a156ebb5ebda47f83f3ae4b7d65b78d98ef4045e9a93a92c0ee1b4b1cb561d58a5cb943bb363162767faaee55ee16705
7
+ data.tar.gz: 43fd6852404f2ecdb2ed49f6b8e821ea8a4018df28999a991c8cf706a95b469fcd8eff9c26867f8f566153c979992c66a166e2912ad2aaea67967f85370a78c5
@@ -17,6 +17,8 @@ require 'sightstone/modules/datadragon_module'
17
17
  # @attr [LeagueModule] League module to call the leagues api
18
18
  # @attr [StatsModule] Stats module to call the stats api
19
19
  # @attr [TeamModule] Team module to call the team api
20
+ module Sightstone
21
+
20
22
  class Sightstone
21
23
 
22
24
  attr_accessor :region
@@ -53,3 +55,6 @@ class SightstoneConnectionException < SightstoneApiException; end
53
55
 
54
56
  # Raised when the RateLimit has been exceeded (api returns http error code 429)
55
57
  class RateLimitExceededException < SightstoneApiException; end
58
+
59
+
60
+ end
@@ -1,3 +1,4 @@
1
+ module Sightstone
1
2
  # Class to represent a champion
2
3
  # @attr [Boolean] active determines if champion is active
3
4
  # @attr [Integer] attackRank attack rank
@@ -27,4 +28,5 @@ class Champion
27
28
  @rankedPlayEnabled = data['rankedPlayEnabled']
28
29
  end
29
30
 
31
+ end
30
32
  end
@@ -0,0 +1,20 @@
1
+ module Sightstone
2
+
3
+ # Base class for exceptions raised by the gem
4
+ class SightstoneApiException < Exception; end
5
+
6
+ # Raised if no or an invalid api key was passed to the api
7
+ class InvalidApiKeyException < SightstoneApiException; end
8
+
9
+ # Raised if the given developer cannot be found (api returns http error code 404)
10
+ class SummonerNotFoundException < SightstoneApiException; end
11
+
12
+ # Raised if the connection to the api failed
13
+ class SightstoneConnectionException < SightstoneApiException; end
14
+
15
+ # Raised when the RateLimit has been exceeded (api returns http error code 429)
16
+ class RateLimitExceededException < SightstoneApiException; end
17
+
18
+
19
+
20
+ end
@@ -1,3 +1,4 @@
1
+ module Sightstone
1
2
  # Class to represent a league
2
3
  # @attr [String] name name of the league
3
4
  # @attr [String] queue queue Type (can be: RANKED_SOLO_5x5, RANKED_TEAM_3x3, RANKED_TEAM_5x5)
@@ -69,3 +70,4 @@ class MiniSeries
69
70
  @timeLeftToPlayMillis = data['timeLeftToPlayMillis']
70
71
  end
71
72
  end
73
+ end
@@ -1,3 +1,4 @@
1
+ module Sightstone
1
2
  # Class to represent the masterybook of a summoner
2
3
  # @attr [Numeric] summonerId id of the summoner
3
4
  # @attr [Array<MasteryPage>] pages of the masterybook
@@ -45,4 +46,5 @@ class Talent
45
46
  @name = data['name']
46
47
  @rank = data['rank']
47
48
  end
49
+ end
48
50
  end
@@ -1,4 +1,4 @@
1
-
1
+ module Sightstone
2
2
  # match history of a summoner
3
3
  # @attr [Fixnum] summonerId ID of the summoner
4
4
  # @attr [Array<HistoryGame>] games unsorted list of recently played games
@@ -90,3 +90,4 @@ class Stat
90
90
  end
91
91
  end
92
92
  end
93
+ end
@@ -1,6 +1,6 @@
1
1
  require 'sightstone/champion'
2
2
  require 'sightstone/modules/sightstone_base_module'
3
-
3
+ module Sightstone
4
4
  # Module to provide calls to the summoner api
5
5
  class ChampionModule < SightstoneBaseModule
6
6
 
@@ -30,4 +30,5 @@ class ChampionModule < SightstoneBaseModule
30
30
  end
31
31
  }
32
32
  end
33
+ end
33
34
  end
@@ -1,5 +1,5 @@
1
1
  require 'sightstone/modules/sightstone_base_module'
2
-
2
+ module Sightstone
3
3
  class DatadragonModule < SightstoneBaseModule
4
4
 
5
5
  def initialize(sightstone)
@@ -23,3 +23,4 @@ class DatadragonModule < SightstoneBaseModule
23
23
 
24
24
 
25
25
  end
26
+ end
@@ -1,7 +1,7 @@
1
1
  require 'sightstone/modules/sightstone_base_module'
2
2
  require 'sightstone/summoner'
3
3
  require 'sightstone/match_history'
4
-
4
+ module Sightstone
5
5
  # module to access the game api
6
6
  class GameModule < SightstoneBaseModule
7
7
 
@@ -35,4 +35,5 @@ class GameModule < SightstoneBaseModule
35
35
  end
36
36
 
37
37
 
38
+ end
38
39
  end
@@ -2,6 +2,7 @@ require 'sightstone/modules/sightstone_base_module'
2
2
  require 'sightstone/summoner'
3
3
  require 'sightstone/league'
4
4
 
5
+ module Sightstone
5
6
  # module to provide calls to the league api
6
7
  class LeagueModule < SightstoneBaseModule
7
8
  def initialize(sightstone)
@@ -38,3 +39,4 @@ class LeagueModule < SightstoneBaseModule
38
39
  end
39
40
 
40
41
  end
42
+ end
@@ -1,5 +1,5 @@
1
1
  require 'open-uri'
2
-
2
+ module Sightstone
3
3
  # Base class of the api modules
4
4
  # @abstract
5
5
  class SightstoneBaseModule
@@ -23,16 +23,18 @@ class SightstoneBaseModule
23
23
  if response_code == 200
24
24
  block.call(response.body)
25
25
  elsif response_code == 404
26
- raise Sightstone::SummonerNotFoundException
26
+ raise SummonerNotFoundException
27
27
  elsif response_code == 500
28
- raise Sightstone::SightstoneConnectionException
28
+ raise SightstoneConnectionException
29
29
  elsif response_code == 429
30
- raise Sightstone::RateLimitExceededException
30
+ raise RateLimitExceededException
31
31
  elsif response_code == 401
32
- raise Sightstone::InvalidApiKeyException
32
+ raise InvalidApiKeyException
33
33
  else
34
- raise Sightstone::SightstoneApiException 'Unknown error occured'
34
+ raise SightstoneApiException 'Unknown error occured'
35
35
  end
36
36
  end
37
37
 
38
38
  end
39
+
40
+ end
@@ -1,8 +1,9 @@
1
+
1
2
  require 'sightstone/modules/sightstone_base_module'
2
3
  require 'sightstone/summoner'
3
4
  require 'sightstone/player_stats_summary'
4
5
  require 'sightstone/ranked_stats'
5
-
6
+ module Sightstone
6
7
  # Module to receive stats
7
8
  class StatsModule < SightstoneBaseModule
8
9
  def initialize(sightstone)
@@ -71,4 +72,5 @@ class StatsModule < SightstoneBaseModule
71
72
  }
72
73
 
73
74
  end
75
+ end
74
76
  end
@@ -4,6 +4,7 @@ require 'sightstone/masterybook'
4
4
  require 'sightstone/runebook'
5
5
  require 'open-uri'
6
6
 
7
+ module Sightstone
7
8
  # Module to provide calls to the summoner api
8
9
  class SummonerModule < SightstoneBaseModule
9
10
 
@@ -107,3 +108,4 @@ class SummonerModule < SightstoneBaseModule
107
108
  }
108
109
  end
109
110
  end
111
+ end
@@ -2,6 +2,7 @@ require 'sightstone/modules/sightstone_base_module'
2
2
  require 'sightstone/summoner'
3
3
  require 'sightstone/team'
4
4
 
5
+ module Sightstone
5
6
  # module to make calls to the team api
6
7
  class TeamModule < SightstoneBaseModule
7
8
  def initialize(sightstone)
@@ -38,3 +39,4 @@ class TeamModule < SightstoneBaseModule
38
39
  end
39
40
 
40
41
  end
42
+ end
@@ -1,4 +1,4 @@
1
-
1
+ module Sightstone
2
2
  # summary of player statistic
3
3
  # @attr [Fixnum] summonerId ID of the summoner
4
4
  # @attr [Array<PlayerStatSummary] array of stat summaries for player with given id
@@ -35,4 +35,5 @@ class PlayerStatSummary
35
35
  @aggregatedStats[stat] = data['aggregatedStats'][stat]
36
36
  end
37
37
  end
38
+ end
38
39
  end
@@ -1,3 +1,4 @@
1
+ module Sightstone
1
2
  # Ranked stats of a summoner
2
3
  # @attr [Fixnum] modifyDate date of last modification
3
4
  # @attr [Fixnum] summonerId id of the summoner
@@ -20,3 +21,4 @@ class RankedStats
20
21
  end
21
22
  end
22
23
  end
24
+ end
@@ -1,3 +1,4 @@
1
+ module Sightstone
1
2
  # Class to represent the runebook of a summoner
2
3
  # @attr [Numeric] summonerId id of the summoner
3
4
  # @attr [Array<RunePage>] pages of the runebook
@@ -47,4 +48,5 @@ class Rune
47
48
  @name = data['name']
48
49
  @tier = data['tier']
49
50
  end
51
+ end
50
52
  end
@@ -1,3 +1,4 @@
1
+ module Sightstone
1
2
  # Class to represent a summoner
2
3
  # @attr [String] name name
3
4
  # @attr [Long] id summoner id (used for other calls)
@@ -18,4 +19,5 @@ class Summoner
18
19
  end
19
20
 
20
21
 
22
+ end
21
23
  end
@@ -1,3 +1,4 @@
1
+ module Sightstone
1
2
  # A Team
2
3
  # @attr [Fixnum] createDate UNIX timestamp of team creation
3
4
  # @attr [String] fullId id of the team
@@ -112,4 +113,5 @@ class TeamHistoryGame
112
113
  @win = data['win']
113
114
  @opposingTeamKills = data['opposingTeamKills']
114
115
  end
116
+ end
115
117
  end
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: 1.1.1
4
+ version: 1.2.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: 2014-01-05 00:00:00.000000000 Z
11
+ date: 2014-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -46,6 +46,7 @@ extra_rdoc_files: []
46
46
  files:
47
47
  - lib/sightstone.rb
48
48
  - lib/sightstone/champion.rb
49
+ - lib/sightstone/exceptions.rb
49
50
  - lib/sightstone/league.rb
50
51
  - lib/sightstone/masterybook.rb
51
52
  - lib/sightstone/match_history.rb