riot_games_api 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a0582a84f782a7eed7d62f680ddad53403349cb9
4
+ data.tar.gz: 6954173fa2a5208e9f34105bb0e401436558c7bb
5
+ SHA512:
6
+ metadata.gz: e2e2540150fda6f49efb18c30a482ed1fc7ea2392c5352efc29ae5137c4532c82bb3f770f8c2a98bd0125abf2ba9576ca9db24faf1a84723946ad69afad74ef1
7
+ data.tar.gz: 96653cf8820ea6df8b514c39fa77088130a89b59df405ca1752f3790a31c1b32e0ded6671a7041e39463e2f0c85896c0fe92171fadf65088f527a04befb35d85
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .pryrc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rubocop.yml ADDED
@@ -0,0 +1,28 @@
1
+ AllCops:
2
+ Include:
3
+ - Rakefile
4
+ - Gemfile
5
+ - config.ru
6
+ Exclude:
7
+ - bin/*
8
+ - db/schema.rb
9
+ - db/migrate/*
10
+ RunRailsCops: true
11
+
12
+ Documentation:
13
+ Enabled: false
14
+
15
+ LineLength:
16
+ Max: 160
17
+
18
+ MethodLength:
19
+ Max: 15
20
+
21
+ ClassAndModuleChildren:
22
+ Enabled: false
23
+
24
+ CollectionMethods:
25
+ Enabled: false
26
+
27
+ SingleLineBlockParams:
28
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ script: 'bundle exec rake spec'
3
+ rvm:
4
+ - 2.1.0
5
+ - 1.9.3
6
+ - jruby-19mode
7
+ env:
8
+ - RIOT_GAMES_API_KEY="test_key" SPEC_OPTS="--color --format documentation" CODECLIMATE_REPO_TOKEN="81eb5c871ceafdf53bb05f2311220c146d7ffdb7d0e1854583902ed979fc8620"
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in riot_games_api.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Shigenobu Nishikawa
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,192 @@
1
+ [![Build Status](https://drone.io/github.com/shishi/riot_games_api/status.png)](https://drone.io/github.com/shishi/riot_games_api/latest)
2
+ [![Build Status](https://travis-ci.org/shishi/riot_games_api.svg?branch=master)](https://travis-ci.org/shishi/riot_games_api)
3
+ [![Code Climate](https://codeclimate.com/github/shishi/riot_games_api.png)](https://codeclimate.com/github/shishi/riot_games_api) [![Code Climate](https://codeclimate.com/github/shishi/riot_games_api/coverage.png
4
+ )](https://codeclimate.com/github/shishi/riot_games_api)
5
+ [![Dependency Status](https://gemnasium.com/shishi/riot_games_api.svg)](https://gemnasium.com/shishi/riot_games_api)
6
+
7
+ # RiotGamesApi
8
+
9
+ Make access easy to access Riot Games API to get their game data like League of Legends.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'riot_games_api'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install riot_games_api
24
+
25
+ ## Usage
26
+
27
+ **First, You should love to play, watch, or do something with League of Legends.**
28
+
29
+ Very thanks to Riot for greatest game.
30
+
31
+ * English
32
+ * You need to get your RIOT Games API key. You may need to register your app. Defaul key for development is too restricted to use.
33
+
34
+ * Japanese
35
+ * RIOT Games API キーを取得してきて下さい。アプリケーションを登録してキーをもらったほうが良いかもしれません。デフォルトの開発用キーは普通に使うには制限が強すぎます。
36
+
37
+ https://developer.riotgames.com/
38
+
39
+ ``` ruby
40
+
41
+ client = RiotGamesApi::LOL::Client.new api_key: 'your_api_key'
42
+ # from summoner resource
43
+ summoner = client.summoner.by_name 'shishisn'
44
+ # from team resource
45
+ teams = client.team.by_summoner_id summoner.id
46
+
47
+ # English
48
+ # You can use champions and items id list (created 4/20/2014)
49
+ # You can see and edit lists in lib/riot_games_api/lol/constant/
50
+
51
+ # Japnese
52
+ # チャンピオンとアイテムのIDのリストを作ってあります (2014/4/20 時点)
53
+ # lib/riot_games_api/lol/constant/ にファイルがあるので編集もできます
54
+
55
+ # from static_data resource
56
+ jinx = client.static_data.champion_by_id RiotGamesApi::LOL::CHAMPIONS[:jinx]
57
+ jinx_lore = jinx.lore
58
+ b_f_sword = client.static_data.item_by_id RiotGamesApi::LOL::ITEMS[:b_f_sword]
59
+ b_f_sword_stats = b_f_sword.stats
60
+
61
+ # English
62
+ # Now, Riot Games API do not support image file directly, but you can get url for images their official data. Almost same for items, etc.
63
+
64
+ # Japanese
65
+ # 現在 Riot Games API は画像を直接サポートしていませんが、こうするとCDNの公式データを取得するURLを組み立てることが出来ます。アイテムとかでも大体同じようにできます。
66
+
67
+ xin = client.static_data.champion_by_id RiotGamesApi::LOL::CHAMPIONS[:xin_zhao]
68
+ xin_image_filename = xin.image.full
69
+ image_group = xin.image.group
70
+
71
+ realm = client.static_data.realm
72
+ url = realm.cdn
73
+ dd_version = realm.dd
74
+
75
+ image_url = url + dd_version + '/img/' + image_group + xin_image_filename
76
+
77
+ ```
78
+
79
+ ### Public method list
80
+
81
+ You may need to inspect return object to know what they have.
82
+
83
+ 返されるオブジェクトをインスペクトすると、どんなデータを持ってるのか分かりやすいです。
84
+
85
+ ```
86
+ There are some more options, you found in lib/riot_games_api/lol/resource
87
+
88
+ RiotGamesApi::LOL::Resource::Champion
89
+ This resource for champion's status like active, free, enable or not in ranked
90
+
91
+ #all
92
+ return all champions
93
+ #free
94
+ return free champions
95
+ #by_champion_id
96
+ return a specified champion by champion id
97
+
98
+ RiotGamesApi::LOL::Resource::Game
99
+ This resource for recent game records
100
+
101
+ #recent
102
+ return recent 10 game records by summoner id
103
+
104
+ RiotGamesApi::LOL::Resource::League
105
+ This resource for league of legends league system records
106
+
107
+ #by_summoner_id
108
+ return league data include entries by summoner id
109
+ #by_summoner_id_only_own_entry
110
+ return entry league data by summoner id
111
+ #by_team_id
112
+ return league data include entries by team id
113
+ #by_team_id_only_own_entry
114
+ return entry league data by team id
115
+ #challenger_solo_5v5
116
+ return league data include entries in challenger solo 5v5
117
+ #challenger_team_5v5
118
+ return league data include entries in challenger team 5v5
119
+ #challenger_team_3v3
120
+ return league data include entries in challenger team 3v3
121
+
122
+ RiotGamesApi::LOL::Resource::StaticData
123
+ This resource for static data like champion' status, skill data
124
+
125
+ champion
126
+ #champion_all
127
+ return all champion static data (very heavy)
128
+ #champion_by_id
129
+ return a specified champion static data by champion id
130
+ item
131
+ #item_all
132
+ return all item static data
133
+ #item_by_id
134
+ return a specified item static data by item id
135
+ mastery
136
+ #mastery_all
137
+ return all mastery static data
138
+ #mastery_by_id
139
+ return a specified mastery static data by mastery id
140
+ #realm
141
+ return realm data
142
+ rune
143
+ #rune_all
144
+ return all rune static data
145
+ #rune_by_id
146
+ return a specified rune static data by rune id
147
+ summoner_spell
148
+ #summoner_spell_all
149
+ return all summoner spell static data
150
+ #summoner_spell_by_id
151
+ return a specified summoner spell static data by summoner spell id
152
+
153
+ RiotGamesApi::LOL::Resource::Stats
154
+ This resource for statistics of league of legends matches
155
+
156
+ #ranked
157
+ return statistics of ranekd match by summoner id
158
+ #summary
159
+ return statistics of matches by summoner id
160
+
161
+ RiotGamesApi::LOL::Resource::Summoner
162
+ This resource for summoner data
163
+
164
+ #by_name
165
+ return a summoner data by summoner name
166
+ #by_id
167
+ return a summoner data by summoner id
168
+ #masteries
169
+ return summoner masteries data by summoner id
170
+ #name
171
+ retuen summoner name by summoner id
172
+ #runes
173
+ return summoner runes data by summoner id
174
+
175
+ RiotGamesApi::LOL::Resource::Team
176
+ This resource for ranked team data
177
+
178
+ #by_summoner_id
179
+ return team data by summoner id
180
+ #by_team_id
181
+ retuen team data by team id
182
+
183
+ ```
184
+
185
+
186
+ ## Contributing
187
+
188
+ 1. Fork it ( http://github.com/<my-github-username>/riot_games_api/fork )
189
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
190
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
191
+ 4. Push to the branch (`git push origin my-new-feature`)
192
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+ task :default => :spec
5
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,57 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ class Client
4
+ def initialize(params = {})
5
+ @api_key = params[:api_key] || ENV['RIOT_GAMES_API_KEY']
6
+ @base_url = params[:use_ssl] ? 'https://prod.api.pvp.net/' : 'http://prod.api.pvp.net/'
7
+ @region = params[:region] || 'na'
8
+ @adapter = params[:adapter] || Faraday.default_adapter
9
+ @logger = params[:debug] ? :logger : :raise_error
10
+ @locale = params[:locale] || 'en_US'
11
+
12
+ fail ArgumentError, 'You should need "Riot Games API Key" at leaet.' unless @api_key
13
+ end
14
+
15
+ def connection
16
+ Faraday.new(url: @base_url) do |faraday|
17
+ faraday.request :url_encoded
18
+ faraday.response :rashify
19
+ faraday.response :json
20
+ faraday.response @logger
21
+ faraday.adapter @adapter
22
+ faraday.params[:api_key] = @api_key
23
+ faraday.params[:locale] = @locale
24
+ faraday.headers['User-Agent'] = "RiotGamesApi gem v#{RiotGamesApi::VERSION}"
25
+ end
26
+ end
27
+
28
+ def champions
29
+ RiotGamesApi::LOL::Resource::Champion.new(connection, @region)
30
+ end
31
+
32
+ def games
33
+ RiotGamesApi::LOL::Resource::Game.new(connection, @region)
34
+ end
35
+
36
+ def leagues
37
+ RiotGamesApi::LOL::Resource::League.new(connection, @region)
38
+ end
39
+
40
+ def static_data
41
+ RiotGamesApi::LOL::Resource::StaticData.new(connection, @region)
42
+ end
43
+
44
+ def stats
45
+ RiotGamesApi::LOL::Resource::Stats.new(connection, @region)
46
+ end
47
+
48
+ def summoner
49
+ RiotGamesApi::LOL::Resource::Summoner.new(connection, @region)
50
+ end
51
+
52
+ def team
53
+ RiotGamesApi::LOL::Resource::Team.new(connection, @region)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,125 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ CHAMPIONS = {
4
+ aatrox: 266,
5
+ ahri: 103,
6
+ akali: 84,
7
+ alistar: 12,
8
+ amumu: 32,
9
+ anivia: 34,
10
+ annie: 1,
11
+ ashe: 22,
12
+ blitzcrank: 53,
13
+ brand: 63,
14
+ caitlyn: 51,
15
+ cassiopeia: 69,
16
+ chogath: 31,
17
+ corki: 42,
18
+ darius: 122,
19
+ diana: 131,
20
+ dr_mundo: 36,
21
+ draven: 119,
22
+ elise: 60,
23
+ evelynn: 28,
24
+ ezreal: 81,
25
+ fiddle_sticks: 9,
26
+ fiora: 114,
27
+ fizz: 105,
28
+ galio: 3,
29
+ gangplank: 41,
30
+ garen: 86,
31
+ gragas: 79,
32
+ graves: 104,
33
+ hecarim: 120,
34
+ heimerdinger: 74,
35
+ irelia: 39,
36
+ janna: 40,
37
+ jarvan_iv: 59,
38
+ jax: 24,
39
+ jayce: 126,
40
+ jinx: 222,
41
+ karma: 43,
42
+ karthus: 30,
43
+ kassadin: 38,
44
+ katarina: 55,
45
+ kayle: 10,
46
+ kennen: 85,
47
+ khazix: 121,
48
+ kog_maw: 96,
49
+ leblanc: 7,
50
+ lee_sin: 64,
51
+ leona: 89,
52
+ lissandra: 127,
53
+ lucian: 236,
54
+ lulu: 117,
55
+ lux: 99,
56
+ malphite: 54,
57
+ malzahar: 90,
58
+ maokai: 57,
59
+ master_yi: 11,
60
+ miss_fortune: 21,
61
+ monkey_king: 62, # wukong, riot use this name for wukong
62
+ mordekaiser: 82,
63
+ morgana: 25,
64
+ nami: 267,
65
+ nasus: 75,
66
+ nautilus: 111,
67
+ nidalee: 76,
68
+ nocturne: 56,
69
+ nunu: 20,
70
+ olaf: 2,
71
+ orianna: 61,
72
+ pantheon: 80,
73
+ poppy: 78,
74
+ quinn: 133,
75
+ rammus: 33,
76
+ renekton: 58,
77
+ rengar: 107,
78
+ riven: 92,
79
+ rumble: 68,
80
+ ryze: 13,
81
+ sejuani: 113,
82
+ shaco: 35,
83
+ shen: 98,
84
+ shyvana: 102,
85
+ singed: 27,
86
+ sion: 14,
87
+ sivir: 15,
88
+ skarner: 72,
89
+ sona: 37,
90
+ soraka: 16,
91
+ swain: 50,
92
+ syndra: 134,
93
+ talon: 91,
94
+ taric: 44,
95
+ teemo: 17,
96
+ thresh: 412,
97
+ tristana: 18,
98
+ trundle: 48,
99
+ tryndamere: 23,
100
+ twisted_fate: 4,
101
+ twitch: 29,
102
+ udyr: 77,
103
+ urgot: 6,
104
+ varus: 110,
105
+ vayne: 67,
106
+ veigar: 45,
107
+ velkoz: 161,
108
+ vi: 254,
109
+ viktor: 112,
110
+ vladimir: 8,
111
+ volibear: 106,
112
+ warwick: 19,
113
+ wukong: 62, # alias for monkey_king
114
+ xerath: 101,
115
+ xin_zhao: 5,
116
+ yasuo: 157,
117
+ yorick: 83,
118
+ zac: 154,
119
+ zed: 238,
120
+ ziggs: 115,
121
+ zilean: 26,
122
+ zyra: 143,
123
+ }
124
+ end
125
+ end
@@ -0,0 +1,186 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ ITEMS = {
4
+ abyssal_scepter: 3001,
5
+ aegis_of_the_legion: 3105,
6
+ aether_wisp: 3113,
7
+ amplifying_tome: 1052,
8
+ ancient_coin: 3301,
9
+ archangels_staff: 3003,
10
+ archangels_staff_crystal_scar: 3007,
11
+ athenes_unholy_grail: 3174,
12
+ atmas_impaler: 3005,
13
+ augment_death: 3198,
14
+ augment_gravity: 3197,
15
+ augment_power: 3196,
16
+ avarice_blade: 3093,
17
+ b_f_sword: 1038,
18
+ banner_of_command: 3060,
19
+ banshees_veil: 3102,
20
+ berserkers_greaves: 3006,
21
+ bilgewater_cutlass: 3144,
22
+ blackfire_torch: 3188,
23
+ blade_of_the_ruined_king: 3153,
24
+ blasting_wand: 1026,
25
+ bonetooth_necklace: 3167,
26
+ boots_of_mobility: 3117,
27
+ boots_of_speed: 1001,
28
+ boots_of_swiftness: 3009,
29
+ brawlers_gloves: 1051,
30
+ catalyst_the_protector: 3010,
31
+ chain_vest: 1031,
32
+ chalice_of_harmony: 3028,
33
+ cloak_of_agility: 1018,
34
+ cloth_armor: 1029,
35
+ crystalline_flask: 2041,
36
+ dagger: 1042,
37
+ deathfire_grasp: 3128,
38
+ dervish_blade: 3137,
39
+ dorans_blade: 1055,
40
+ dorans_ring: 1056,
41
+ dorans_shield: 1054,
42
+ elixir_of_brilliance: 2039,
43
+ elixir_of_fortitude: 2037,
44
+ enchantment_alacrity: 3269,
45
+ enchantment_captain: 3271,
46
+ enchantment_distortion: 3268,
47
+ enchantment_furor: 3267,
48
+ enchantment_homeguard: 3270,
49
+ entropy: 3184,
50
+ executioners_calling: 3123,
51
+ explorers_ward: 2050,
52
+ face_of_the_mountain: 3401,
53
+ faerie_charm: 1004,
54
+ farsight_orb: 3363,
55
+ feral_flare: 3160,
56
+ fiendish_codex: 3108,
57
+ forbidden_idol: 3114,
58
+ frost_queens_claim: 3092,
59
+ frostfang: 3098,
60
+ frozen_heart: 3110,
61
+ frozen_mallet: 3022,
62
+ giants_belt: 1011,
63
+ glacial_shroud: 3024,
64
+ greater_stealth_totem: 3361,
65
+ greater_vision_totem: 3362,
66
+ grezs_spectral_lantern: 3159,
67
+ guardians_horn: 2051,
68
+ guardian_angel: 3026,
69
+ guinsoos_rageblade: 3124,
70
+ haunting_guise: 3136,
71
+ health_potion: 2003,
72
+ hexdrinker: 3155,
73
+ hextech_gunblade: 3146,
74
+ hextech_revolver: 3145,
75
+ hextech_sweeper: 3187,
76
+ hunters_machete: 1039,
77
+ iceborn_gauntlet: 3025,
78
+ ichor_of_illumination: 2048,
79
+ ichor_of_rage: 2040,
80
+ infinity_edge: 3031,
81
+ ionian_boots_of_lucidity: 3158,
82
+ kindlegem: 3067,
83
+ last_whisper: 3035,
84
+ liandrys_torment: 3151,
85
+ lich_bane: 3100,
86
+ locket_of_the_iron_solari: 3190,
87
+ long_sword: 1036,
88
+ lord_van_damms_pillager: 3104,
89
+ madreds_razors: 3106,
90
+ mana_potion: 2004,
91
+ manamune: 3004,
92
+ manamune_crystal_scar: 3008,
93
+ maw_of_malmortius: 3156,
94
+ mejais_soulstealer: 3041,
95
+ mercurial_scimitar: 3139,
96
+ mercurys_treads: 3111,
97
+ mikaels_crucible: 3222,
98
+ moonflair_spellblade: 3170,
99
+ morellonomicon: 3165,
100
+ muramana: 3043,
101
+ nashors_tooth: 3115,
102
+ needlessly_large_rod: 1058,
103
+ negatron_cloak: 1057,
104
+ ninja_tabi: 3047,
105
+ nomads_medallion: 3096,
106
+ null_magic_mantle: 1033,
107
+ odyns_veil: 3180,
108
+ ohmwrecker: 3056,
109
+ oracles_extract: 2047,
110
+ oracles_lens: 3364,
111
+ orb_of_winter: 3112,
112
+ overlords_bloodmail: 3084,
113
+ phage: 3044,
114
+ phantom_dancer: 3046,
115
+ pickaxe: 1037,
116
+ poro_snax: 2052,
117
+ prospectors_blade: 1062,
118
+ prospectors_ring: 1063,
119
+ quicksilver_sash: 3140,
120
+ rabadons_deathcap: 3089,
121
+ randuins_omen: 3143,
122
+ ravenous_hydra: 3074,
123
+ recurve_bow: 1043,
124
+ rejuvenation_bead: 1006,
125
+ relic_shield: 3302,
126
+ rod_of_ages: 3027,
127
+ rod_of_ages_crystal_scar: 3029,
128
+ ruby_crystal: 1028,
129
+ ruby_sightstone: 2045,
130
+ runaans_hurricane: 3085,
131
+ rylais_crystal_scepter: 3116,
132
+ sanguine_blade: 3181,
133
+ sapphire_crystal: 1027,
134
+ scrying_orb: 3342,
135
+ seekers_armguard: 3191,
136
+ seraphs_embrace: 3040,
137
+ sheen: 3057,
138
+ sightstone: 2049,
139
+ sorcerers_shoes: 3020,
140
+ spectres_cowl: 3211,
141
+ spellthiefs_edge: 3303,
142
+ spirit_of_the_ancient_golem: 3207,
143
+ spirit_of_the_elder_lizard: 3209,
144
+ spirit_of_the_spectral_wraith: 3206,
145
+ spirit_stone: 1080,
146
+ spirit_visage: 3065,
147
+ statikk_shiv: 3087,
148
+ stealth_ward: 2044,
149
+ stinger: 3101,
150
+ sunfire_cape: 3068,
151
+ sweeping_lens: 3341,
152
+ sword_of_the_divine: 3131,
153
+ sword_of_the_occult: 3141,
154
+ talisman_of_ascension: 3069,
155
+ targons_brace: 3097,
156
+ tear_of_the_goddess: 3070,
157
+ tear_of_the_goddess_crystal_scar: 3073,
158
+ the_black_cleaver: 3071,
159
+ the_bloodthirster: 3072,
160
+ the_brutalizer: 3134,
161
+ the_hex_core: 3200,
162
+ the_lightbringer: 3185,
163
+ thornmail: 3075,
164
+ tiamat: 3077,
165
+ total_biscuit_of_rejuvenation: 2010,
166
+ trinity_force: 3078,
167
+ twin_shadows: 3023,
168
+ vampiric_scepter: 1053,
169
+ vision_ward: 2043,
170
+ void_staff: 3135,
171
+ wardens_mail: 3082,
172
+ warding_totem: 3340,
173
+ warmogs_armor: 3083,
174
+ wicked_hatchet: 3122,
175
+ will_of_the_ancients: 3152,
176
+ wits_end: 3091,
177
+ wooglets_witchcap: 3090,
178
+ wriggles_lantern: 3154,
179
+ youmuus_ghostblade: 3142,
180
+ zeal: 3086,
181
+ zekes_herald: 3050,
182
+ zephyr: 3172,
183
+ zhonyas_hourglass: 3157
184
+ }
185
+ end
186
+ end
@@ -0,0 +1,18 @@
1
+ module RiotGamesApi
2
+ module LOL
3
+ module Model
4
+ module Champion
5
+ class Champion
6
+ include Virtus.model
7
+
8
+ attribute :id, Integer
9
+ attribute :active, Boolean
10
+ attribute :bot_enabled, Boolean
11
+ attribute :free_to_play, Boolean
12
+ attribute :bot_mm_enabled, Boolean
13
+ attribute :ranked_play_enabled, Boolean
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ require 'riot_games_api/lol/model/champion/champion'
2
+
3
+ module RiotGamesApi
4
+ module LOL
5
+ module Model
6
+ module Champion
7
+ end
8
+ end
9
+ end
10
+ end