lolxin 0.12.1 → 0.13.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.
Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +34 -3
  5. data/Rakefile +1 -1
  6. data/bin/bundle +105 -0
  7. data/bin/byebug +29 -0
  8. data/bin/cc-tddium-post-worker +12 -0
  9. data/bin/codeclimate-test-reporter +12 -0
  10. data/bin/coderay +12 -0
  11. data/bin/console +1 -1
  12. data/bin/dotenv +12 -0
  13. data/bin/htmldiff +12 -0
  14. data/bin/ldiff +12 -0
  15. data/bin/pry +12 -0
  16. data/bin/rake +12 -0
  17. data/bin/rspec +12 -0
  18. data/lib/lolxin.rb +29 -18
  19. data/lib/lolxin/api/champion.rb +24 -0
  20. data/lib/lolxin/api/champion_mastery.rb +38 -0
  21. data/lib/lolxin/api/league.rb +39 -0
  22. data/lib/lolxin/api/lol_static_data.rb +116 -0
  23. data/lib/lolxin/api/lol_status.rb +7 -0
  24. data/lib/lolxin/api/match.rb +41 -0
  25. data/lib/lolxin/api/spectator.rb +180 -0
  26. data/lib/lolxin/api/summoner.rb +25 -0
  27. data/lib/lolxin/api/third_party_code.rb +15 -0
  28. data/lib/lolxin/client.rb +26 -78
  29. data/lib/lolxin/dto/champion_dto.rb +29 -0
  30. data/lib/lolxin/dto/champion_mastery_dto.rb +33 -0
  31. data/lib/lolxin/dto/dto.rb +10 -0
  32. data/lib/lolxin/dto/game_info_dto.rb +31 -0
  33. data/lib/lolxin/dto/league_item_dto.rb +38 -0
  34. data/lib/lolxin/dto/league_list_dto.rb +27 -0
  35. data/lib/lolxin/dto/league_position_dto.rb +45 -0
  36. data/lib/lolxin/dto/mini_series_dto.rb +27 -0
  37. data/lib/lolxin/helpers/api.rb +20 -0
  38. data/lib/lolxin/helpers/api_version.rb +15 -0
  39. data/lib/lolxin/helpers/region.rb +21 -0
  40. data/lib/lolxin/helpers/version.rb +3 -0
  41. data/lolxin.gemspec +5 -2
  42. metadata +72 -22
  43. data/lib/lolxin/api_version.rb +0 -16
  44. data/lib/lolxin/champion.rb +0 -25
  45. data/lib/lolxin/champion_mastery.rb +0 -69
  46. data/lib/lolxin/current_game.rb +0 -44
  47. data/lib/lolxin/featured_games.rb +0 -23
  48. data/lib/lolxin/game.rb +0 -25
  49. data/lib/lolxin/league.rb +0 -58
  50. data/lib/lolxin/lol_static_data.rb +0 -41
  51. data/lib/lolxin/lol_status.rb +0 -21
  52. data/lib/lolxin/match.rb +0 -25
  53. data/lib/lolxin/match_list.rb +0 -40
  54. data/lib/lolxin/region.rb +0 -22
  55. data/lib/lolxin/stats.rb +0 -30
  56. data/lib/lolxin/summoner.rb +0 -55
  57. data/lib/lolxin/version.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e336a645871970184eb29220938115e535b583de
4
- data.tar.gz: 2970573bface04dfa9f63cefd21905e293f1a45e
2
+ SHA256:
3
+ metadata.gz: acb0f973de32a14351952c5120383a3d3f34e85382d8d9060e4995fa73874884
4
+ data.tar.gz: 70f7cbc80e2f0dce05302c71f1e14357d089c1899bb56ee967e29d613655eb6d
5
5
  SHA512:
6
- metadata.gz: 140009b2b968686dbedb0a18bf7c4b70a0a4fc03249e15dedbd0213fc8abd8f79fb242d07b6f01ede578cae468a0333573a9006a17f8cee840b23ef788371030
7
- data.tar.gz: 93931194de8eaf2ae2cb28871abc8a61a4b668455576d20829f8ee4c3a2821ec7fd8770c26b34365099f7e1fbb81d48760c97005cdffcf1f9c54b7da30179887
6
+ metadata.gz: 69d73cdee75655713b85de68eaf471da855de5dbc59183c29c005b80c99f8f01c559d4fee4ee1591f57c228036ff71c04909ae4c9768921c2ef63855d633f24d
7
+ data.tar.gz: a42628ce55221b78a7df87436e0eb2b324566d450036e4ebb26076d953617d021b41b1a8334d313d4d09094e2997b6670a7d0b39a237d716b88544fe1eeb69ad
data/.gitignore CHANGED
@@ -29,3 +29,4 @@ demo/
29
29
  TODO
30
30
  .env
31
31
  tags
32
+ .byebug_history
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Jon Ho
3
+ Copyright (c) 2017 Jon Ho
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -6,7 +6,23 @@
6
6
 
7
7
  # Lolxin
8
8
 
9
- The not-so-smooth API wrapper for League of Legends.
9
+ The not-so-smooth API wrapper for League of Legends. Pronounced lo-shin like
10
+ lotion! Too clever I know.
11
+
12
+ ## Supported endpoints
13
+ | Endpoint | Version |
14
+ | ----------------- | ------- |
15
+ | CHAMPION-MASTERY | 3 |
16
+ | CHAMPION | 3 |
17
+ | LEAGUE | 3 |
18
+ | LOL-STATIC-DATA | 3 |
19
+ | LOL-STATUS | 3 |
20
+ | MATCH | 3 |
21
+ | SPECTATOR | 3 |
22
+ | SUMMONER | 3 |
23
+ | THIRD-PARTY-CODE | ? |
24
+ | TOURNAMENT-STUB | N/A |
25
+ | TOURNAMENT | N/A |
10
26
 
11
27
  ## Installation
12
28
 
@@ -26,7 +42,14 @@ Or install it yourself as:
26
42
 
27
43
  ## Usage
28
44
 
29
- TODO: Document how to use
45
+ Refer to the source code for methods to hit the RIOT API. For the most part just set up your
46
+ environment variable API_KEY that you get from the RIOT developer [console](https://developer.riotgames.com/)
47
+
48
+ Quick example usage...
49
+ ```
50
+ client = Client.new(ENV['API_KEY'], region: :na1)
51
+ client.lol_static_data.champions
52
+ ```
30
53
 
31
54
  ## Development
32
55
 
@@ -48,6 +71,15 @@ run `bundle exec rake release`, which will create a git tag for the version,
48
71
  push git commits and tags, and push the `.gem` file to
49
72
  [rubygems.org](https://rubygems.org).
50
73
 
74
+ ## Testing
75
+ Change up the regions per spec file so that you don't run into rate limiting issues often.
76
+
77
+ ## TODO
78
+ - Add the remaining DTOs
79
+ - Parse API responses with DTOs
80
+ - TOURNAMENT/TOURNAMENT-STUB endpoints
81
+ - VCR record http responses?
82
+
51
83
  ## Contributing
52
84
 
53
85
  Bug reports and pull requests are welcome on GitHub at
@@ -55,7 +87,6 @@ https://github.com/jonwho/lolxin. This project is intended to be a safe,
55
87
  welcoming space for collaboration, and contributors are expected to adhere
56
88
  to the [Contributor Covenant](contributor-covenant.org) code of conduct.
57
89
 
58
-
59
90
  ## License
60
91
 
61
92
  The gem is available as open source under the terms of the
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1 || ">= 0.a"
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||= begin
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version || "#{Gem::Requirement.default}.a"
67
+ end
68
+ end
69
+
70
+ def load_bundler!
71
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
72
+
73
+ # must dup string for RG < 1.8 compatibility
74
+ activate_bundler(bundler_version.dup)
75
+ end
76
+
77
+ def activate_bundler(bundler_version)
78
+ if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
79
+ bundler_version = "< 2"
80
+ end
81
+ gem_error = activation_error_handling do
82
+ gem "bundler", bundler_version
83
+ end
84
+ return if gem_error.nil?
85
+ require_error = activation_error_handling do
86
+ require "bundler/version"
87
+ end
88
+ return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
89
+ warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
90
+ exit 42
91
+ end
92
+
93
+ def activation_error_handling
94
+ yield
95
+ nil
96
+ rescue StandardError, LoadError => e
97
+ e
98
+ end
99
+ end
100
+
101
+ m.load_bundler!
102
+
103
+ if m.invoked_as_script?
104
+ load Gem.bin_path("bundler", "bundle")
105
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'byebug' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("byebug", "byebug")
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -11,6 +12,17 @@ require "pathname"
11
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
13
  Pathname.new(__FILE__).realpath)
13
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
14
26
  require "rubygems"
15
27
  require "bundler/setup"
16
28
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -11,6 +12,17 @@ require "pathname"
11
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
13
  Pathname.new(__FILE__).realpath)
13
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
14
26
  require "rubygems"
15
27
  require "bundler/setup"
16
28
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -11,6 +12,17 @@ require "pathname"
11
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
13
  Pathname.new(__FILE__).realpath)
13
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
14
26
  require "rubygems"
15
27
  require "bundler/setup"
16
28
 
@@ -12,4 +12,4 @@ Dotenv.load
12
12
 
13
13
  # If you use this, don't forget to add pry to your Gemfile!
14
14
  require "pry"
15
- Pry.start(Client.new(ENV['API_KEY'], region: :na))
15
+ Pry.start(Client.new(ENV['API_KEY'], region: :na1))
data/bin/dotenv CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -11,6 +12,17 @@ require "pathname"
11
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
13
  Pathname.new(__FILE__).realpath)
13
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
14
26
  require "rubygems"
15
27
  require "bundler/setup"
16
28
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -11,6 +12,17 @@ require "pathname"
11
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
13
  Pathname.new(__FILE__).realpath)
13
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
14
26
  require "rubygems"
15
27
  require "bundler/setup"
16
28
 
data/bin/ldiff CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -11,6 +12,17 @@ require "pathname"
11
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
13
  Pathname.new(__FILE__).realpath)
13
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
14
26
  require "rubygems"
15
27
  require "bundler/setup"
16
28
 
data/bin/pry CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -11,6 +12,17 @@ require "pathname"
11
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
13
  Pathname.new(__FILE__).realpath)
13
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
14
26
  require "rubygems"
15
27
  require "bundler/setup"
16
28
 
data/bin/rake CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -11,6 +12,17 @@ require "pathname"
11
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
13
  Pathname.new(__FILE__).realpath)
13
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
14
26
  require "rubygems"
15
27
  require "bundler/setup"
16
28
 
data/bin/rspec CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  #
4
5
  # This file was generated by Bundler.
5
6
  #
@@ -11,6 +12,17 @@ require "pathname"
11
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
13
  Pathname.new(__FILE__).realpath)
13
14
 
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
14
26
  require "rubygems"
15
27
  require "bundler/setup"
16
28