riot_lol_api 0.1.12 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +86 -69
  3. data/curl_import.rb +226 -0
  4. data/lib/core_ext/hash.rb +1 -1
  5. data/lib/riot_lol_api/{client.rb → clients.rb} +9 -7
  6. data/lib/riot_lol_api/helper_classes.rb +22 -0
  7. data/lib/riot_lol_api/model/{aggregated_stat.rb → aggregated_stats.rb} +0 -0
  8. data/lib/riot_lol_api/model/{altimage.rb → altimages.rb} +0 -0
  9. data/lib/riot_lol_api/model/{block.rb → blocks.rb} +2 -2
  10. data/lib/riot_lol_api/model/champions.rb +23 -0
  11. data/lib/riot_lol_api/model/class_base.rb +14 -0
  12. data/lib/riot_lol_api/model/creepspermindeltas.rb +14 -0
  13. data/lib/riot_lol_api/model/csdiffpermindeltas.rb +14 -0
  14. data/lib/riot_lol_api/model/damagetakendiffpermindeltas.rb +13 -0
  15. data/lib/riot_lol_api/model/damagetakenpermindeltas.rb +14 -0
  16. data/lib/riot_lol_api/model/{datum.rb → data.rb} +0 -0
  17. data/lib/riot_lol_api/model/effects.rb +14 -0
  18. data/lib/riot_lol_api/model/{entry.rb → entries.rb} +0 -0
  19. data/lib/riot_lol_api/model/{fellow_player.rb → fellow_players.rb} +0 -0
  20. data/lib/riot_lol_api/model/{game.rb → games.rb} +3 -3
  21. data/lib/riot_lol_api/model/goldpermindeltas.rb +14 -0
  22. data/lib/riot_lol_api/model/{gold.rb → golds.rb} +0 -0
  23. data/lib/riot_lol_api/model/{image.rb → images.rb} +0 -0
  24. data/lib/riot_lol_api/model/{info.rb → infos.rb} +0 -0
  25. data/lib/riot_lol_api/model/{item.rb → items.rb} +4 -3
  26. data/lib/riot_lol_api/model/{league.rb → leagues.rb} +3 -3
  27. data/lib/riot_lol_api/model/{leveltip.rb → leveltips.rb} +0 -0
  28. data/lib/riot_lol_api/model/{map.rb → maps.rb} +0 -0
  29. data/lib/riot_lol_api/model/{mastery.rb → masteries.rb} +0 -0
  30. data/lib/riot_lol_api/model/matches.rb +14 -0
  31. data/lib/riot_lol_api/model/{mini_sery.rb → mini_series.rb} +0 -0
  32. data/lib/riot_lol_api/model/{page.rb → pages.rb} +3 -3
  33. data/lib/riot_lol_api/model/participantidentities.rb +13 -0
  34. data/lib/riot_lol_api/model/participants.rb +14 -0
  35. data/lib/riot_lol_api/model/{passive.rb → passives.rb} +2 -2
  36. data/lib/riot_lol_api/model/{player_stat_rank.rb → player_stat_ranks.rb} +2 -2
  37. data/lib/riot_lol_api/model/{player_stat_summary.rb → player_stat_summaries.rb} +2 -2
  38. data/lib/riot_lol_api/model/players.rb +13 -0
  39. data/lib/riot_lol_api/model/{recommended.rb → recommendeds.rb} +2 -2
  40. data/lib/riot_lol_api/model/{rune.rb → runes.rb} +0 -0
  41. data/lib/riot_lol_api/model/{skin.rb → skins.rb} +0 -0
  42. data/lib/riot_lol_api/model/{slot.rb → slots.rb} +0 -0
  43. data/lib/riot_lol_api/model/{spell.rb → spells.rb} +5 -5
  44. data/lib/riot_lol_api/model/{stat.rb → stats.rb} +0 -0
  45. data/lib/riot_lol_api/model/{summoner.rb → summoners.rb} +42 -11
  46. data/lib/riot_lol_api/model/timelines.rb +16 -0
  47. data/lib/riot_lol_api/model/{var.rb → vars.rb} +0 -0
  48. data/lib/riot_lol_api/model/xpdiffpermindeltas.rb +14 -0
  49. data/lib/riot_lol_api/model/xppermindeltas.rb +14 -0
  50. data/lib/riot_lol_api/models.rb +8 -0
  51. data/lib/riot_lol_api/version.rb +1 -1
  52. data/lib/riot_lol_api.rb +4 -2
  53. data/riot_lol_api.gemspec +6 -4
  54. data/spec/factories/game.rb +6 -6
  55. data/spec/factories/page.rb +1 -1
  56. data/spec/factories/summoner.rb +3 -3
  57. data/spec/mock_response/get_all_champions_by_ids.json +3 -3
  58. data/spec/mock_response/get_all_champions_by_ids_all_data.json +3 -3
  59. data/spec/mock_response/get_all_item.json +3 -3
  60. data/spec/mock_response/get_all_masteries.json +3 -3
  61. data/spec/mock_response/get_all_runes.json +3 -3
  62. data/spec/mock_response/get_all_summoner_spells.json +3 -3
  63. data/spec/mock_response/get_all_summoner_spells_by_ids.json +3 -3
  64. data/spec/mock_response/get_champion_by_id.json +2 -2
  65. data/spec/mock_response/get_champion_by_id_all_data.json +3 -3
  66. data/spec/mock_response/get_item_by_id.json +3 -3
  67. data/spec/mock_response/get_mastery_by_id.json +3 -3
  68. data/spec/mock_response/get_match_by_id.json +13 -0
  69. data/spec/mock_response/get_match_history.json +13 -0
  70. data/spec/mock_response/get_player_league.json +5 -3
  71. data/spec/mock_response/get_player_stat_ranked.json +4 -3
  72. data/spec/mock_response/get_player_stat_summaries.json +5 -5
  73. data/spec/mock_response/get_realm.json +4 -4
  74. data/spec/mock_response/get_rune_by_id.json +2 -2
  75. data/spec/mock_response/get_summoner_by_id.json +5 -4
  76. data/spec/mock_response/get_summoner_by_name.json +5 -4
  77. data/spec/mock_response/get_summoner_games_by_id.json +4 -3
  78. data/spec/mock_response/get_summoner_masteries_by_id.json +5 -4
  79. data/spec/mock_response/get_summoner_runes_by_id.json +5 -4
  80. data/spec/mock_response/get_summoner_spell_by_id.json +3 -3
  81. data/spec/mock_response/get_version.json +4 -4
  82. data/spec/mock_response/summoner.json +13 -0
  83. data/spec/riot_lol_api_spec.rb +559 -608
  84. metadata +83 -33
  85. data/lib/riot_lol_api/model/champion.rb +0 -23
  86. data/lib/riot_lol_api/model.rb +0 -8
data/lib/core_ext/hash.rb CHANGED
@@ -26,4 +26,4 @@ class Hash
26
26
  end
27
27
  new_hash
28
28
  end
29
- end
29
+ end
@@ -3,8 +3,10 @@ require 'json'
3
3
 
4
4
  module RiotLolApi
5
5
  class Client
6
- # Constant URL
7
6
 
7
+ include RiotLolApi::HelperClass
8
+
9
+ # Constant URL
8
10
  BASE_URL_API = "api.pvp.net/api/lol/"
9
11
 
10
12
  # attr
@@ -34,7 +36,7 @@ module RiotLolApi
34
36
 
35
37
  # TO DO
36
38
  # Set callback to get realm constants
37
- #
39
+ #
38
40
 
39
41
  def self.get url, domaine,data = nil
40
42
  unless RiotLolApi::TOKEN.nil?
@@ -104,7 +106,7 @@ module RiotLolApi
104
106
  else
105
107
  data.merge!({:locale => locale})
106
108
  end
107
-
109
+
108
110
  response = Client.get("static-data/#{@region}/v1.2/champion/#{id}","global",data)
109
111
  unless response.nil?
110
112
  RiotLolApi::Model::Champion.new(response.to_symbol)
@@ -133,7 +135,7 @@ module RiotLolApi
133
135
  end
134
136
 
135
137
  # ITEM
136
-
138
+
137
139
  def get_all_items data = nil, locale = 'fr_FR'
138
140
  if data.nil?
139
141
  data = {:locale => locale}
@@ -169,7 +171,7 @@ module RiotLolApi
169
171
  end
170
172
 
171
173
  # MASTERY
172
-
174
+
173
175
  def get_all_masteries data = nil, locale = 'fr_FR'
174
176
  if data.nil?
175
177
  data = {:locale => locale}
@@ -205,7 +207,7 @@ module RiotLolApi
205
207
  end
206
208
 
207
209
  # RUNE
208
-
210
+
209
211
  def get_all_runes data = nil, locale = 'fr_FR'
210
212
  if data.nil?
211
213
  data = {:locale => locale}
@@ -286,4 +288,4 @@ module RiotLolApi
286
288
  end
287
289
 
288
290
  end
289
- end
291
+ end
@@ -0,0 +1,22 @@
1
+ module RiotLolApi
2
+ module HelperClass
3
+
4
+ # Instance methods
5
+
6
+ def list_methods
7
+ self.class.instance_methods(false).map{|i| i.to_sym}
8
+ end
9
+
10
+ # Class methods
11
+
12
+ def self.included(object)
13
+ object.extend(ClassMethods)
14
+ end
15
+
16
+ module ClassMethods
17
+ def list_methods
18
+ self.instance_methods(false).map{|i| i.to_sym}
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,4 +1,4 @@
1
- require 'riot_lol_api/model/item'
1
+ require 'riot_lol_api/model/items'
2
2
 
3
3
  module RiotLolApi
4
4
  module Model
@@ -13,4 +13,4 @@ module RiotLolApi
13
13
 
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -0,0 +1,23 @@
1
+ require 'riot_lol_api/model/stats'
2
+ require 'riot_lol_api/model/recommendeds'
3
+ require 'riot_lol_api/model/images'
4
+ require 'riot_lol_api/model/spells'
5
+ require 'riot_lol_api/model/infos'
6
+ require 'riot_lol_api/model/passives'
7
+ require 'riot_lol_api/model/skins'
8
+ require 'riot_lol_api/model/data'
9
+
10
+ module RiotLolApi
11
+ module Model
12
+ class Champion
13
+
14
+ def initialize(options = {})
15
+ options.each do |key, value|
16
+ self.class.send(:attr_accessor, key.to_sym)
17
+ instance_variable_set("@#{key}", value)
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class ClassBase
4
+
5
+ def initialize(options = {})
6
+ options.each do |key, value|
7
+ self.class.send(:attr_accessor, key.to_sym)
8
+ instance_variable_set("@#{key}", value)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class CreepsPerMinDelta
4
+
5
+ def initialize(options = {})
6
+ options.each do |key, value|
7
+ self.class.send(:attr_accessor, key.to_sym)
8
+ instance_variable_set("@#{key}", value)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class CsDiffPerMinDelta
4
+
5
+ def initialize(options = {})
6
+ options.each do |key, value|
7
+ self.class.send(:attr_accessor, key.to_sym)
8
+ instance_variable_set("@#{key}", value)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class DamageTakenDiffPerMinDelta
4
+ def initialize(options = {})
5
+ options.each do |key, value|
6
+ self.class.send(:attr_accessor, key.to_sym)
7
+ instance_variable_set("@#{key}", value)
8
+ end
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class DamageTakenPerMinDelta
4
+
5
+ def initialize(options = {})
6
+ options.each do |key, value|
7
+ self.class.send(:attr_accessor, key.to_sym)
8
+ instance_variable_set("@#{key}", value)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
File without changes
@@ -0,0 +1,14 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Effect
4
+
5
+ def initialize(options = {})
6
+ options.each do |key, value|
7
+ self.class.send(:attr_accessor, key.to_sym)
8
+ instance_variable_set("@#{key}", value)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
File without changes
@@ -1,5 +1,5 @@
1
- require 'riot_lol_api/model/fellow_player.rb'
2
- require 'riot_lol_api/model/stat'
1
+ require 'riot_lol_api/model/fellow_players'
2
+ require 'riot_lol_api/model/stats'
3
3
 
4
4
  module RiotLolApi
5
5
  module Model
@@ -16,4 +16,4 @@ module RiotLolApi
16
16
 
17
17
  end
18
18
  end
19
- end
19
+ end
@@ -0,0 +1,14 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class GoldPerMinDelta
4
+
5
+ def initialize(options = {})
6
+ options.each do |key, value|
7
+ self.class.send(:attr_accessor, key.to_sym)
8
+ instance_variable_set("@#{key}", value)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
File without changes
File without changes
File without changes
@@ -1,5 +1,6 @@
1
- require 'riot_lol_api/model/gold'
2
- require 'riot_lol_api/model/map'
1
+ require 'riot_lol_api/model/golds'
2
+ require 'riot_lol_api/model/effects'
3
+ require 'riot_lol_api/model/maps'
3
4
 
4
5
  module RiotLolApi
5
6
  module Model
@@ -14,4 +15,4 @@ module RiotLolApi
14
15
 
15
16
  end
16
17
  end
17
- end
18
+ end
@@ -1,5 +1,5 @@
1
- require 'riot_lol_api/model/entry'
2
- require 'riot_lol_api/model/mini_sery'
1
+ require 'riot_lol_api/model/entries'
2
+ require 'riot_lol_api/model/mini_series'
3
3
 
4
4
  module RiotLolApi
5
5
  module Model
@@ -14,4 +14,4 @@ module RiotLolApi
14
14
 
15
15
  end
16
16
  end
17
- end
17
+ end
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Match
4
+
5
+ def initialize(options = {})
6
+ options.each do |key, value|
7
+ self.class.send(:attr_accessor, key.to_sym)
8
+ instance_variable_set("@#{key}", value)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -1,6 +1,6 @@
1
- require 'riot_lol_api/model/mastery'
2
- require 'riot_lol_api/model/slot'
3
- require 'riot_lol_api/model/rune'
1
+ require 'riot_lol_api/model/masteries'
2
+ require 'riot_lol_api/model/slots'
3
+ require 'riot_lol_api/model/runes'
4
4
 
5
5
  module RiotLolApi
6
6
  module Model
@@ -0,0 +1,13 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class ParticipantIdentity
4
+ def initialize(options = {})
5
+ options.each do |key, value|
6
+ self.class.send(:attr_accessor, key.to_sym)
7
+ instance_variable_set("@#{key}", value)
8
+ end
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Participant
4
+
5
+ def initialize(options = {})
6
+ options.each do |key, value|
7
+ self.class.send(:attr_accessor, key.to_sym)
8
+ instance_variable_set("@#{key}", value)
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -1,4 +1,4 @@
1
- require 'riot_lol_api/model/image'
1
+ require 'riot_lol_api/model/images'
2
2
 
3
3
  module RiotLolApi
4
4
  module Model
@@ -13,4 +13,4 @@ module RiotLolApi
13
13
 
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -1,4 +1,4 @@
1
- require 'riot_lol_api/model/aggregated_stat'
1
+ require 'riot_lol_api/model/aggregated_stats'
2
2
 
3
3
  module RiotLolApi
4
4
  module Model
@@ -13,4 +13,4 @@ module RiotLolApi
13
13
 
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -1,4 +1,4 @@
1
- require 'riot_lol_api/model/aggregated_stat'
1
+ require 'riot_lol_api/model/aggregated_stats'
2
2
 
3
3
  module RiotLolApi
4
4
  module Model
@@ -13,4 +13,4 @@ module RiotLolApi
13
13
 
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -0,0 +1,13 @@
1
+ module RiotLolApi
2
+ module Model
3
+ class Player
4
+ def initialize(options = {})
5
+ options.each do |key, value|
6
+ self.class.send(:attr_accessor, key.to_sym)
7
+ instance_variable_set("@#{key}", value)
8
+ end
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
- require 'riot_lol_api/model/block'
1
+ require 'riot_lol_api/model/blocks'
2
2
 
3
3
  module RiotLolApi
4
4
  module Model
@@ -13,4 +13,4 @@ module RiotLolApi
13
13
 
14
14
  end
15
15
  end
16
- end
16
+ end
File without changes
File without changes