riot_games_api 0.0.2

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.
Files changed (180) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.rubocop.yml +28 -0
  4. data/.travis.yml +8 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +192 -0
  8. data/Rakefile +5 -0
  9. data/lib/riot_games_api/lol/client.rb +57 -0
  10. data/lib/riot_games_api/lol/constant/champions.rb +125 -0
  11. data/lib/riot_games_api/lol/constant/items.rb +186 -0
  12. data/lib/riot_games_api/lol/model/champion/champion.rb +18 -0
  13. data/lib/riot_games_api/lol/model/champion.rb +10 -0
  14. data/lib/riot_games_api/lol/model/corecion/time.rb +16 -0
  15. data/lib/riot_games_api/lol/model/game/game.rb +27 -0
  16. data/lib/riot_games_api/lol/model/game/player.rb +15 -0
  17. data/lib/riot_games_api/lol/model/game/raw_stats.rb +88 -0
  18. data/lib/riot_games_api/lol/model/game/recent_game.rb +14 -0
  19. data/lib/riot_games_api/lol/model/game.rb +13 -0
  20. data/lib/riot_games_api/lol/model/league/league.rb +17 -0
  21. data/lib/riot_games_api/lol/model/league/league_item.rb +35 -0
  22. data/lib/riot_games_api/lol/model/league/mini_series.rb +17 -0
  23. data/lib/riot_games_api/lol/model/league.rb +12 -0
  24. data/lib/riot_games_api/lol/model/static_data/basic_data.rb +35 -0
  25. data/lib/riot_games_api/lol/model/static_data/basic_data_stats.rb +77 -0
  26. data/lib/riot_games_api/lol/model/static_data/block.rb +14 -0
  27. data/lib/riot_games_api/lol/model/static_data/block_item.rb +14 -0
  28. data/lib/riot_games_api/lol/model/static_data/champion.rb +29 -0
  29. data/lib/riot_games_api/lol/model/static_data/champion_list.rb +17 -0
  30. data/lib/riot_games_api/lol/model/static_data/champion_list_data_by_id.rb +11 -0
  31. data/lib/riot_games_api/lol/model/static_data/champion_spell.rb +32 -0
  32. data/lib/riot_games_api/lol/model/static_data/gold.rb +16 -0
  33. data/lib/riot_games_api/lol/model/static_data/group.rb +14 -0
  34. data/lib/riot_games_api/lol/model/static_data/image.rb +19 -0
  35. data/lib/riot_games_api/lol/model/static_data/info.rb +16 -0
  36. data/lib/riot_games_api/lol/model/static_data/item.rb +35 -0
  37. data/lib/riot_games_api/lol/model/static_data/item_list.rb +18 -0
  38. data/lib/riot_games_api/lol/model/static_data/item_tree.rb +14 -0
  39. data/lib/riot_games_api/lol/model/static_data/level_tip.rb +14 -0
  40. data/lib/riot_games_api/lol/model/static_data/mastery.rb +19 -0
  41. data/lib/riot_games_api/lol/model/static_data/mastery_list.rb +16 -0
  42. data/lib/riot_games_api/lol/model/static_data/mastery_tree.rb +15 -0
  43. data/lib/riot_games_api/lol/model/static_data/mastery_tree_item.rb +14 -0
  44. data/lib/riot_games_api/lol/model/static_data/mastery_tree_list.rb +13 -0
  45. data/lib/riot_games_api/lol/model/static_data/meta_data.rb +18 -0
  46. data/lib/riot_games_api/lol/model/static_data/passive.rb +16 -0
  47. data/lib/riot_games_api/lol/model/static_data/realm.rb +21 -0
  48. data/lib/riot_games_api/lol/model/static_data/recommended.rb +19 -0
  49. data/lib/riot_games_api/lol/model/static_data/rune.rb +35 -0
  50. data/lib/riot_games_api/lol/model/static_data/rune_list.rb +16 -0
  51. data/lib/riot_games_api/lol/model/static_data/skin.rb +15 -0
  52. data/lib/riot_games_api/lol/model/static_data/spell_vars.rb +16 -0
  53. data/lib/riot_games_api/lol/model/static_data/stats.rb +32 -0
  54. data/lib/riot_games_api/lol/model/static_data/summoner_spell.rb +35 -0
  55. data/lib/riot_games_api/lol/model/static_data/summoner_spell_list.rb +15 -0
  56. data/lib/riot_games_api/lol/model/static_data/summoner_spell_list_data_by_id.rb +11 -0
  57. data/lib/riot_games_api/lol/model/static_data.rb +47 -0
  58. data/lib/riot_games_api/lol/model/stats/aggregated_stats.rb +68 -0
  59. data/lib/riot_games_api/lol/model/stats/champion_stats.rb +14 -0
  60. data/lib/riot_games_api/lol/model/stats/player_stats_summary.rb +17 -0
  61. data/lib/riot_games_api/lol/model/stats/player_stats_summary_list.rb +14 -0
  62. data/lib/riot_games_api/lol/model/stats/ranked_stats.rb +15 -0
  63. data/lib/riot_games_api/lol/model/stats.rb +15 -0
  64. data/lib/riot_games_api/lol/model/summoner/mastery.rb +14 -0
  65. data/lib/riot_games_api/lol/model/summoner/mastery_page.rb +16 -0
  66. data/lib/riot_games_api/lol/model/summoner/mastery_page_list.rb +14 -0
  67. data/lib/riot_games_api/lol/model/summoner/rune_page.rb +16 -0
  68. data/lib/riot_games_api/lol/model/summoner/rune_page_list.rb +14 -0
  69. data/lib/riot_games_api/lol/model/summoner/rune_slot.rb +14 -0
  70. data/lib/riot_games_api/lol/model/summoner/summoner.rb +17 -0
  71. data/lib/riot_games_api/lol/model/summoner.rb +16 -0
  72. data/lib/riot_games_api/lol/model/team/match_history_summary.rb +23 -0
  73. data/lib/riot_games_api/lol/model/team/message_of_day.rb +15 -0
  74. data/lib/riot_games_api/lol/model/team/roster.rb +14 -0
  75. data/lib/riot_games_api/lol/model/team/team.rb +27 -0
  76. data/lib/riot_games_api/lol/model/team/team_member_info.rb +16 -0
  77. data/lib/riot_games_api/lol/model/team/team_stat_detail.rb +17 -0
  78. data/lib/riot_games_api/lol/model/team/team_stat_summary.rb +14 -0
  79. data/lib/riot_games_api/lol/model/team.rb +16 -0
  80. data/lib/riot_games_api/lol/model.rb +16 -0
  81. data/lib/riot_games_api/lol/resource/base.rb +22 -0
  82. data/lib/riot_games_api/lol/resource/champion.rb +39 -0
  83. data/lib/riot_games_api/lol/resource/game.rb +23 -0
  84. data/lib/riot_games_api/lol/resource/league.rb +65 -0
  85. data/lib/riot_games_api/lol/resource/static_data.rb +91 -0
  86. data/lib/riot_games_api/lol/resource/stats.rb +28 -0
  87. data/lib/riot_games_api/lol/resource/summoner.rb +52 -0
  88. data/lib/riot_games_api/lol/resource/team.rb +34 -0
  89. data/lib/riot_games_api/lol/resource.rb +15 -0
  90. data/lib/riot_games_api/version.rb +3 -0
  91. data/lib/riot_games_api.rb +15 -0
  92. data/riot_games_api.gemspec +34 -0
  93. data/spec/lol/resource/champion_spec.rb +27 -0
  94. data/spec/lol/resource/game_spec.rb +40 -0
  95. data/spec/lol/resource/league_spec.rb +93 -0
  96. data/spec/lol/resource/static_data_spec.rb +215 -0
  97. data/spec/lol/resource/stats_spec.rb +57 -0
  98. data/spec/lol/resource/summoner_spec.rb +80 -0
  99. data/spec/lol/resource/team_spec.rb +31 -0
  100. data/spec/spec_helper.rb +21 -0
  101. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Champion/_all/should_first_record_is_Aatrox.yml +44 -0
  102. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Champion/_by_champion_id/should_be_Teemo.yml +44 -0
  103. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Champion/_free/should_be_only_free_champions.yml +44 -0
  104. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Game/_recent/should_champinons_is_Talon_in_first_game_record.yml +44 -0
  105. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Game/_recent/should_first_fellow_player_s_team_is_blue.yml +44 -0
  106. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Game/_recent/should_first_game_is_win.yml +44 -0
  107. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Game/_recent/should_game_record_have_player_model.yml +44 -0
  108. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Game/_recent/should_game_record_have_raw_stats_model.yml +44 -0
  109. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Game/_recent/should_game_records_count_is_10.yml +44 -0
  110. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Game/_recent/should_have_summoner_id.yml +44 -0
  111. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_by_summoner_id/should_have_league_item_entries.yml +1497 -0
  112. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_by_summoner_id/should_phantoml0ad_is_in_league_which_name_is_Nasus_s_Agents.yml +1497 -0
  113. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_by_summoner_id_only_own_entry/should_ojarusang_is_in_series.yml +43 -0
  114. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_by_summoner_id_only_own_entry/should_ojarusang_s_tier_is_platinum.yml +43 -0
  115. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_by_team_id/should_have_league_item_entries.yml +864 -0
  116. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_by_team_id/should_rascal_jester_is_in_league_which_name_is_Nunu_s_Outriders.yml +864 -0
  117. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_by_team_id_only_own_entry/should_ffg_practice_is_not_in_series.yml +44 -0
  118. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_by_team_id_only_own_entry/should_ffg_practice_tier_is_challenger.yml +44 -0
  119. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_challenger_solo_5v5/should_queue_is_ranked_solo_5v5.yml +1281 -0
  120. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_challenger_solo_5v5/should_tier_is_challenger.yml +1281 -0
  121. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_challenger_team_3v3/should_queue_is_ranked_team_3v3.yml +123 -0
  122. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_challenger_team_3v3/should_tier_is_challenger.yml +123 -0
  123. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_challenger_team_5v5/should_queue_is_ranked_team_5v5.yml +61 -0
  124. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_League/_challenger_team_5v5/should_tier_is_challenger.yml +61 -0
  125. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/_realm/should_have_data_cdn_is_cdn_url.yml +44 -0
  126. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/_realm/should_have_static_data_of_realm.yml +44 -0
  127. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/champion/_champion_all/key_by_id_is_false/should_have_inputed_data_version.yml +38011 -0
  128. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/champion/_champion_all/key_by_id_is_false/should_have_static_data_key_with_champion_name.yml +38011 -0
  129. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/champion/_champion_all/key_by_id_is_false/should_have_static_data_of_champions.yml +38011 -0
  130. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/champion/_champion_all/key_by_id_is_true/should_have_static_data_keys_is_champion_id.yml +38000 -0
  131. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/champion/_champion_all/key_by_id_is_true/should_have_static_data_of_champion.yml +38000 -0
  132. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/champion/_champion_by_id/should_have_data_key_is_shaco.yml +151 -0
  133. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/champion/_champion_by_id/should_have_static_data_of_champion.yml +151 -0
  134. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/item/_item_all/should_have_inputed_data_version.yml +2388 -0
  135. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/item/_item_all/should_have_static_data_of_items.yml +2388 -0
  136. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/item/_item_all/should_have_static_data_with_item_name.yml +2388 -0
  137. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/item/_item_by_id/should_have_data_name_is_biscuit.yml +46 -0
  138. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/item/_item_by_id/should_have_static_data_of_item.yml +46 -0
  139. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/mastery/_mastery_all/should_have_inputed_data_version.yml +240 -0
  140. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/mastery/_mastery_all/should_have_static_data_of_masterys.yml +240 -0
  141. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/mastery/_mastery_all/should_have_static_data_with_mastery_name.yml +240 -0
  142. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/mastery/_mastery_by_id/should_have_data_name_is_sorcery.yml +47 -0
  143. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/mastery/_mastery_by_id/should_have_static_data_of_mastery.yml +47 -0
  144. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/rune/_rune_all/should_have_inputed_data_version.yml +733 -0
  145. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/rune/_rune_all/should_have_static_data_of_runes.yml +733 -0
  146. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/rune/_rune_all/should_have_static_data_with_rune_name.yml +733 -0
  147. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/rune/_rune_by_id/should_have_data_name_is_rune_name.yml +45 -0
  148. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/rune/_rune_by_id/should_have_static_data_of_rune.yml +45 -0
  149. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/summoner_spell/_summoner_spell_all/key_by_id_is_false/should_have_inputed_data_version.yml +156 -0
  150. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/summoner_spell/_summoner_spell_all/key_by_id_is_false/should_have_static_data_key_with_summoner_spell_name.yml +156 -0
  151. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/summoner_spell/_summoner_spell_all/key_by_id_is_false/should_have_static_data_of_summoner_spell.yml +156 -0
  152. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/summoner_spell/_summoner_spell_all/key_by_id_is_true/should_have_static_data_keys_is_sumoner_spell_id.yml +156 -0
  153. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/summoner_spell/_summoner_spell_all/key_by_id_is_true/should_have_static_data_of_summoner_spell.yml +156 -0
  154. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/summoner_spell/_summoner_spell_by_id/should_have_data_name_is_teleport.yml +55 -0
  155. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_StaticData/summoner_spell/_summoner_spell_by_id/should_have_static_data_of_summoner_spell.yml +55 -0
  156. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Stats/_ranked/latest_season/should_not_found_ranked_stats.yml +57 -0
  157. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Stats/_ranked/season3/should_have_champion_stats.yml +44 -0
  158. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Stats/_ranked/season3/should_have_modify_data_which_unixtime_milliseconds.yml +44 -0
  159. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Stats/_summary/latest_season/should_have_player_stat_summaries.yml +44 -0
  160. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Stats/_summary/latest_season/should_have_summoner_id_inputed.yml +44 -0
  161. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Stats/_summary/season3/should_have_player_stat_summaries.yml +44 -0
  162. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Stats/_summary/season3/should_have_summoner_id_inputed.yml +44 -0
  163. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_by_id/should_have_key_which_is_summoner_id.yml +44 -0
  164. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_by_id/should_have_summoner_model.yml +44 -0
  165. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_by_id/should_summoner_model_have_summoner_level.yml +44 -0
  166. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_by_name/should_have_key_which_is_summoner_name.yml +44 -0
  167. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_by_name/should_have_summoner_model.yml +44 -0
  168. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_by_name/should_summoner_model_have_summoner_level.yml +44 -0
  169. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_masteries/should_have_key_which_is_summoner_id.yml +52 -0
  170. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_masteries/should_have_mastery_page_list_model.yml +52 -0
  171. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_masteries/should_have_mastery_page_model.yml +52 -0
  172. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_name/should_have_summoner_name.yml +44 -0
  173. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_runes/should_have_key_which_is_summoner_id.yml +56 -0
  174. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_runes/should_have_rune_page_list_model.yml +56 -0
  175. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Summoner/_runes/should_have_rune_page_model.yml +56 -0
  176. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Team/_by_summoner_id/should_have_focus_me_s_full_id.yml +314 -0
  177. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Team/_by_summoner_id/should_have_team_model.yml +314 -0
  178. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Team/_by_team_id/should_have_key_which_is_team_id.yml +165 -0
  179. data/spec/vcr_cassettes/RiotGamesApi_LOL_Resource_Team/_by_team_id/should_have_team_model.yml +165 -0
  180. metadata +484 -0
@@ -0,0 +1,16 @@
1
+ require 'riot_games_api/lol/model/summoner/rune_slot'
2
+ require 'riot_games_api/lol/model/summoner/rune_page'
3
+ require 'riot_games_api/lol/model/summoner/rune_page_list'
4
+ require 'riot_games_api/lol/model/summoner/mastery'
5
+ require 'riot_games_api/lol/model/summoner/mastery_page'
6
+ require 'riot_games_api/lol/model/summoner/mastery_page_list'
7
+ require 'riot_games_api/lol/model/summoner/summoner'
8
+
9
+ module RiotGamesApi
10
+ module LOL
11
+ module Model
12
+ module Summoner
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Model
4
+ module Team
5
+ class MatchHistorySummary
6
+ include Virtus.model
7
+
8
+ attribute :assists, Integer
9
+ attribute :date, RiotGamesApi::LOL::Model::Corecion::Time
10
+ attribute :deaths, Integer
11
+ attribute :game_id, Integer
12
+ attribute :game_mode, String
13
+ attribute :invalid, Boolean
14
+ attribute :kills, Integer
15
+ attribute :map_id, Integer
16
+ attribute :opposing_team_kills, Integer
17
+ attribute :opposing_team_name, String
18
+ attribute :win, Boolean
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Model
4
+ module Team
5
+ class MessageOfDay
6
+ include Virtus.model
7
+
8
+ attribute :create_date, RiotGamesApi::LOL::Model::Corecion::Time
9
+ attribute :message, String
10
+ attribute :version, Integer
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Model
4
+ module Team
5
+ class Roster
6
+ include Virtus.model
7
+
8
+ attribute :member_list, Array[RiotGamesApi::LOL::Model::Team::TeamMemberInfo]
9
+ attribute :owner_id, Integer
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,27 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Model
4
+ module Team
5
+ class Team
6
+ include Virtus.model
7
+
8
+ attribute :create_date, RiotGamesApi::LOL::Model::Corecion::Time
9
+ attribute :full_id, String
10
+ attribute :last_game_date, RiotGamesApi::LOL::Model::Corecion::Time
11
+ attribute :last_join_date, RiotGamesApi::LOL::Model::Corecion::Time
12
+ attribute :last_joined_ranked_team_queue_date, RiotGamesApi::LOL::Model::Corecion::Time
13
+ attribute :match_history, Array[RiotGamesApi::LOL::Model::Team::MatchHistorySummary]
14
+ attribute :message_of_day, RiotGamesApi::LOL::Model::Team::MessageOfDay
15
+ attribute :modify_date, RiotGamesApi::LOL::Model::Corecion::Time
16
+ attribute :name, String
17
+ attribute :roster, RiotGamesApi::LOL::Model::Team::Roster
18
+ attribute :second_last_join_date, RiotGamesApi::LOL::Model::Corecion::Time
19
+ attribute :status, String
20
+ attribute :tag, String
21
+ attribute :team_stat_summary, RiotGamesApi::LOL::Model::Team::TeamStatSummary
22
+ attribute :third_last_join_date, RiotGamesApi::LOL::Model::Corecion::Time
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,16 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Model
4
+ module Team
5
+ class TeamMemberInfo
6
+ include Virtus.model
7
+
8
+ attribute :invite_date, RiotGamesApi::LOL::Model::Corecion::Time
9
+ attribute :join_date, RiotGamesApi::LOL::Model::Corecion::Time
10
+ attribute :player_id, Integer
11
+ attribute :status, String
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Model
4
+ module Team
5
+ class TeamStatDetail
6
+ include Virtus.model
7
+
8
+ attribute :average_games_played, Integer
9
+ attribute :full_id, String
10
+ attribute :losses, Integer
11
+ attribute :team_stat_type, String
12
+ attribute :wins, Integer
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Model
4
+ module Team
5
+ class TeamStatSummary
6
+ include Virtus.model
7
+
8
+ attribute :full_id, String
9
+ attribute :team_stat_details, Array[RiotGamesApi::LOL::Model::Team::TeamStatDetail]
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ require 'riot_games_api/lol/model/team/team_stat_detail'
2
+ require 'riot_games_api/lol/model/team/team_member_info'
3
+ require 'riot_games_api/lol/model/team/team_stat_summary'
4
+ require 'riot_games_api/lol/model/team/roster'
5
+ require 'riot_games_api/lol/model/team/message_of_day'
6
+ require 'riot_games_api/lol/model/team/match_history_summary'
7
+ require 'riot_games_api/lol/model/team/team'
8
+
9
+ module RiotGamesApi
10
+ module LOL
11
+ module Model
12
+ module Team
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require 'riot_games_api/lol/model/corecion/time'
2
+
3
+ require 'riot_games_api/lol/model/champion'
4
+ require 'riot_games_api/lol/model/game'
5
+ require 'riot_games_api/lol/model/league'
6
+ require 'riot_games_api/lol/model/static_data'
7
+ require 'riot_games_api/lol/model/stats'
8
+ require 'riot_games_api/lol/model/summoner'
9
+ require 'riot_games_api/lol/model/team'
10
+
11
+ module RiotGamesApi
12
+ module LOL
13
+ module Model
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Resource
4
+ class Base
5
+ def initialize(connection, region)
6
+ @connection = connection
7
+ @region = region
8
+ end
9
+
10
+ private
11
+
12
+ def get(resource_path, version, options = {})
13
+ @connection.get(api_endpoint(resource_path, version), options).body
14
+ end
15
+
16
+ def api_endpoint(resource_path, api_version)
17
+ "api/lol/#{@region}/#{api_version}/#{resource_path}"
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,39 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Resource
4
+ class Champion < Base
5
+ def initialize(connection, region)
6
+ super
7
+ @version = 'v1.2'
8
+ end
9
+
10
+ def all
11
+ get(resource_path, @version).champions.map do |champion|
12
+ RiotGamesApi::LOL::Model::Champion::Champion.new champion
13
+ end
14
+ end
15
+
16
+ def free
17
+ get(resource_path, @version, freeToPlay: true).champions.map do |champion|
18
+ RiotGamesApi::LOL::Model::Champion::Champion.new champion
19
+ end
20
+ end
21
+
22
+ def by_champion_id(champion_id)
23
+ champion = get(resource_path(champion_id), @version)
24
+ RiotGamesApi::LOL::Model::Champion::Champion.new champion
25
+ end
26
+
27
+ private
28
+
29
+ def resource_path(champion_id = nil)
30
+ if champion_id
31
+ "champion/#{champion_id}"
32
+ else
33
+ 'champion'
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,23 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Resource
4
+ class Game < Base
5
+ def initialize(connection, region)
6
+ super
7
+ @version = 'v1.3'
8
+ end
9
+
10
+ def recent(summoner_id)
11
+ recent_game = get(resource_path(summoner_id), @version)
12
+ RiotGamesApi::LOL::Model::Game::RecentGame.new recent_game
13
+ end
14
+
15
+ private
16
+
17
+ def resource_path(summoner_id)
18
+ "game/by-summoner/#{summoner_id}/recent"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,65 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Resource
4
+ class League < Base
5
+ def initialize(connection, region)
6
+ super
7
+ @version = 'v2.3'
8
+ end
9
+
10
+ def by_summoner_id(summoner_id)
11
+ get(resource_path('by-summoner', summoner_id), @version).map do |league|
12
+ RiotGamesApi::LOL::Model::League::League.new league
13
+ end
14
+ end
15
+
16
+ def by_summoner_id_only_own_entry(summoner_id)
17
+ get(resource_path('by-summoner', summoner_id, true), @version).map do |league_item|
18
+ RiotGamesApi::LOL::Model::League::LeagueItem.new league_item
19
+ end
20
+ end
21
+
22
+ def by_team_id(team_id)
23
+ get(resource_path('by-team', team_id), @version).map do |league|
24
+ RiotGamesApi::LOL::Model::League::League.new league
25
+ end
26
+ end
27
+
28
+ def by_team_id_only_own_entry(team_id)
29
+ get(resource_path('by-team', team_id, true), @version).map do |league_item|
30
+ RiotGamesApi::LOL::Model::League::LeagueItem.new league_item
31
+ end
32
+ end
33
+
34
+ def challenger_solo_5v5
35
+ league = get(resource_path_by_challenger, @version, type: 'RANKED_SOLO_5x5')
36
+ RiotGamesApi::LOL::Model::League::League.new league
37
+ end
38
+
39
+ def challenger_team_5v5
40
+ league = get(resource_path_by_challenger, @version, type: 'RANKED_TEAM_5x5')
41
+ RiotGamesApi::LOL::Model::League::League.new league
42
+ end
43
+
44
+ def challenger_team_3v3
45
+ league = get(resource_path_by_challenger, @version, type: 'RANKED_TEAM_3x3')
46
+ RiotGamesApi::LOL::Model::League::League.new league
47
+ end
48
+
49
+ private
50
+
51
+ def resource_path(path, target_id, entry = false)
52
+ if entry
53
+ "league/#{path}/#{target_id}/entry"
54
+ else
55
+ "league/#{path}/#{target_id}"
56
+ end
57
+ end
58
+
59
+ def resource_path_by_challenger
60
+ 'league/challenger'
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,91 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Resource
4
+ class StaticData < Base
5
+ def initialize(connection, region)
6
+ super
7
+ @version = 'v1.2'
8
+ end
9
+
10
+ def champion_all(key_by_id = false, data_version = nil)
11
+ champion_list = get(resource_path('champion'), @version, champData: 'all', dataById: key_by_id, version: data_version)
12
+
13
+ if key_by_id
14
+ RiotGamesApi::LOL::Model::StaticData::ChampionListDataById.new champion_list
15
+ else
16
+ RiotGamesApi::LOL::Model::StaticData::ChampionList.new champion_list
17
+ end
18
+ end
19
+
20
+ def champion_by_id(champion_id, data_version = nil)
21
+ champion = get(resource_path('champion', champion_id), @version, champData: 'all', version: data_version)
22
+ RiotGamesApi::LOL::Model::StaticData::Champion.new champion
23
+ end
24
+
25
+ def item_all(data_version = nil)
26
+ item_list = get(resource_path('item'), @version, itemListData: 'all', version: data_version)
27
+ RiotGamesApi::LOL::Model::StaticData::ItemList.new item_list
28
+ end
29
+
30
+ def item_by_id(item_id, data_version = nil)
31
+ item = get(resource_path('item', item_id), @version, itemData: 'all', version: data_version)
32
+ RiotGamesApi::LOL::Model::StaticData::Item.new item
33
+ end
34
+
35
+ def mastery_all(data_version = nil)
36
+ mastery_list = get(resource_path('mastery'), @version, masteryListData: 'all', version: data_version)
37
+ RiotGamesApi::LOL::Model::StaticData::MasteryList.new mastery_list
38
+ end
39
+
40
+ def mastery_by_id(mastery_id, data_version = nil)
41
+ mastery = get(resource_path('mastery', mastery_id), @version, masteryData: 'all', version: data_version)
42
+ RiotGamesApi::LOL::Model::StaticData::Mastery.new mastery
43
+ end
44
+
45
+ def realm
46
+ realm = get(resource_path('realm'), @version)
47
+ RiotGamesApi::LOL::Model::StaticData::Realm.new realm
48
+ end
49
+
50
+ def rune_all(data_version = nil)
51
+ rune_list = get(resource_path('rune'), @version, runeListData: 'all', version: data_version)
52
+ RiotGamesApi::LOL::Model::StaticData::RuneList.new rune_list
53
+ end
54
+
55
+ def rune_by_id(rune_id, data_version = nil)
56
+ rune = get(resource_path('rune', rune_id), @version, runeData: 'all', version: data_version)
57
+ RiotGamesApi::LOL::Model::StaticData::Rune.new rune
58
+ end
59
+
60
+ def summoner_spell_all(key_by_id = false, data_version = nil)
61
+ summoner_spell_list = get(resource_path('summoner-spell'), @version, spellData: 'all', dataById: key_by_id, version: data_version)
62
+
63
+ if key_by_id
64
+ RiotGamesApi::LOL::Model::StaticData::SummonerSpellListDataById.new summoner_spell_list
65
+ else
66
+ RiotGamesApi::LOL::Model::StaticData::SummonerSpellList.new summoner_spell_list
67
+ end
68
+ end
69
+
70
+ def summoner_spell_by_id(summoner_spell_id, data_version = nil)
71
+ summoner_spell = get(resource_path('summoner-spell', summoner_spell_id), @version, spellData: 'all', version: data_version)
72
+ RiotGamesApi::LOL::Model::StaticData::SummonerSpell.new summoner_spell
73
+ end
74
+
75
+ private
76
+
77
+ def api_endpoint(resource_path, api_version)
78
+ "api/lol/static-data/#{@region}/#{api_version}/#{resource_path}"
79
+ end
80
+
81
+ def resource_path(path, target_id = nil)
82
+ if target_id
83
+ "#{path}/#{target_id}"
84
+ else
85
+ "#{path}"
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,28 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Resource
4
+ class Stats < Base
5
+ def initialize(connection, region)
6
+ super
7
+ @version = 'v1.3'
8
+ end
9
+
10
+ def ranked(summoner_id, season = nil) # e.g. season = 'SEASON3'
11
+ stats = get(resource_path('ranked', summoner_id), @version, season: season)
12
+ RiotGamesApi::LOL::Model::Stats::RankedStats.new stats
13
+ end
14
+
15
+ def summary(summoner_id, season = nil) # e.g. season = 'SEASON3'
16
+ stats = get(resource_path('summary', summoner_id), @version, season: season)
17
+ RiotGamesApi::LOL::Model::Stats::PlayerStatsSummaryList.new stats
18
+ end
19
+
20
+ private
21
+
22
+ def resource_path(path, summoner_id)
23
+ "stats/by-summoner/#{summoner_id}/#{path}"
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,52 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Resource
4
+ class Summoner < Base
5
+ def initialize(connection, region)
6
+ super
7
+ @version = 'v1.4'
8
+ end
9
+
10
+ def by_name(summoner_name)
11
+ summoner_name = summoner_name.gsub(/\s/, '')
12
+ summoner = get(resource_path_by_name(summoner_name), @version)
13
+ { summoner.keys.first => RiotGamesApi::LOL::Model::Summoner::Summoner.new(summoner.values.first) }
14
+ end
15
+
16
+ def by_id(summoner_id)
17
+ summoner = get(resource_path_by_id(summoner_id), @version)
18
+ { summoner.keys.first.to_i => RiotGamesApi::LOL::Model::Summoner::Summoner.new(summoner.values.first) }
19
+ end
20
+
21
+ def masteries(summoner_id)
22
+ masteries = get(resource_path_by_id('masteries', summoner_id), @version)
23
+ { masteries.keys.first.to_i => RiotGamesApi::LOL::Model::Summoner::MasteryPageList.new(masteries.values.first) }
24
+ end
25
+
26
+ def name(summoner_id)
27
+ name = get(resource_path_by_id('name', summoner_id), @version)
28
+ { name.keys.first.to_i => name.values.first}
29
+ end
30
+
31
+ def runes(summoner_id)
32
+ runes = get(resource_path_by_id('runes', summoner_id), @version)
33
+ { runes.keys.first.to_i => RiotGamesApi::LOL::Model::Summoner::RunePageList.new(runes.values.first) }
34
+ end
35
+
36
+ private
37
+
38
+ def resource_path_by_name(summoner_name)
39
+ "summoner/by-name/#{summoner_name}"
40
+ end
41
+
42
+ def resource_path_by_id(path = nil, summoner_id)
43
+ if path
44
+ "summoner/#{summoner_id}/#{path}"
45
+ else
46
+ "summoner/#{summoner_id}"
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,34 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Resource
4
+ class Team < Base
5
+ def initialize(connection, region)
6
+ super
7
+ @version = 'v2.2'
8
+ end
9
+
10
+ def by_summoner_id(summoner_id)
11
+ get(resource_path(summoner_id, true), @version).map do |team|
12
+ RiotGamesApi::LOL::Model::Team::Team.new team
13
+ end
14
+ end
15
+
16
+ def by_team_id(team_id)
17
+ team = get(resource_path(team_id), @version)
18
+ team_key = team.keys.first.gsub(/team/, 'TEAM').gsub(/_/, '-') # undo rashify
19
+ { team_key => RiotGamesApi::LOL::Model::Team::Team.new(team.values.first) }
20
+ end
21
+
22
+ private
23
+
24
+ def resource_path(summoner_or_team_id, by_summoner = false)
25
+ if by_summoner
26
+ "team/by-summoner/#{summoner_or_team_id}"
27
+ else
28
+ "team/#{summoner_or_team_id}"
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,15 @@
1
+ require 'riot_games_api/lol/resource/base'
2
+ require 'riot_games_api/lol/resource/champion'
3
+ require 'riot_games_api/lol/resource/game'
4
+ require 'riot_games_api/lol/resource/league'
5
+ require 'riot_games_api/lol/resource/static_data'
6
+ require 'riot_games_api/lol/resource/stats'
7
+ require 'riot_games_api/lol/resource/summoner'
8
+ require 'riot_games_api/lol/resource/team'
9
+
10
+ module RiotGamesApi
11
+ module LOL
12
+ module Resource
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module RiotGamesApi
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,15 @@
1
+ require 'riot_games_api/version'
2
+ require 'riot_games_api/lol/client'
3
+ require 'riot_games_api/lol/resource'
4
+ require 'riot_games_api/lol/model'
5
+
6
+ require 'riot_games_api/lol/constant/champions'
7
+ require 'riot_games_api/lol/constant/items'
8
+
9
+ require 'json'
10
+ require 'faraday'
11
+ require 'faraday_middleware'
12
+ require 'virtus'
13
+
14
+ module RiotGamesApi
15
+ end
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'riot_games_api/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "riot_games_api"
8
+ spec.version = RiotGamesApi::VERSION
9
+ spec.authors = ["Shigenobu Nishikawa"]
10
+ spec.email = ["shishi.s.n@gmail.com"]
11
+ spec.summary = %q{ Make access easy to Riot Games API. }
12
+ spec.description = %q{ Make access easy to access Riot Games API to get their game data like League of Legends. }
13
+ spec.homepage = "https://github.com/shishi/riot_games_api"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency 'json'
22
+ spec.add_runtime_dependency 'faraday', ['>= 0.7.4', '< 0.9']
23
+ spec.add_runtime_dependency 'faraday_middleware', '~> 0.9.0'
24
+ spec.add_runtime_dependency 'rash', '~> 0.4.0'
25
+ spec.add_runtime_dependency 'virtus', '~> 1.0.2'
26
+
27
+ spec.add_development_dependency 'bundler'
28
+ spec.add_development_dependency 'rake'
29
+ spec.add_development_dependency 'pry'
30
+ spec.add_development_dependency 'rspec'
31
+ spec.add_development_dependency 'webmock'
32
+ spec.add_development_dependency 'vcr'
33
+ spec.add_development_dependency 'codeclimate-test-reporter'
34
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe RiotGamesApi::LOL::Resource::Champion, :vcr do
4
+ let(:client) { RiotGamesApi::LOL::Client.new }
5
+ let(:champions) { client.champions }
6
+ let(:teemo) { 17 } # I HATE Teemo!
7
+
8
+ describe '#all' do
9
+ it 'should first record is Aatrox' do
10
+ champions.all.first.id.should eq 266
11
+ end
12
+ end
13
+
14
+ describe '#free' do
15
+ it 'should be only free champions' do
16
+ champions.free.each do |c|
17
+ c.free_to_play.should eq true
18
+ end
19
+ end
20
+ end
21
+
22
+ describe '#by_champion_id' do
23
+ it 'should be Teemo' do
24
+ champions.by_champion_id(teemo).id.should eq teemo
25
+ end
26
+ end
27
+ end