halo-api 0.3.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 64d185252ce2e1aa3141aef30fa2d920271d7f1c
4
- data.tar.gz: ecf4da6883b446f590d0fcfa8764de508760de99
2
+ SHA256:
3
+ metadata.gz: 2a42d4f434fff2d9750332094368fa2716e424ae174813fd69829821872909a7
4
+ data.tar.gz: ba71b0569f573e75df90b2d9e02b68dcefa2e4506d6cc3d69ee2e05d5556e9d8
5
5
  SHA512:
6
- metadata.gz: 23c8dc1d1b6c53d17bf88ac0d8f696478ba5ade17d641e3421416c2926cd9bc35adbb06da8114845508cbb0c896f7150ef4c8105bd1d559c0e396db797f75593
7
- data.tar.gz: f7359da19034d9f54523f8c971fa8e5453365ed92de7ef23a1860a4a88a0dce1f9d16a783e47e9de28d6b48671689a6d8e9132ee159cd035ede6ad07f369901b
6
+ metadata.gz: fc36634a971d5d312414465e7fad6bce69443524b69fcd9aeff2ad2251c9ae303e6c220ec1698f5bbe09575e4b403a005e80c3a4132ff5ea2944bbc158285da1
7
+ data.tar.gz: 9fefbfa29add4bcd940a6ad0dddd6ecb34ecfd48218bbd90befc9ada8aab8e9988f35884fc82bdb89b805ddf483f5a4a0d3729f851b705e0a5bc28f8881814a4
data/.env.example ADDED
@@ -0,0 +1,4 @@
1
+ HALO_API_KEY=123456
2
+ HALO_REGION=en
3
+ HALO_REDIS=redis://localhost:6379
4
+ HALO_TTL=1800
@@ -0,0 +1,34 @@
1
+ name: CI
2
+
3
+ on: [ 'push', 'pull_request' ]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ services:
10
+ redis:
11
+ image: redis
12
+ ports:
13
+ - 6379:6379
14
+
15
+ strategy:
16
+ matrix:
17
+ ruby-version: [ '2.5', '2.6', '2.7', '3.0' ]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby-version }}
26
+ bundler-cache: true
27
+
28
+ - name: Run tests
29
+ env:
30
+ HALO_API_KEY: ${{ secrets.HALO_API_KEY }}
31
+ HALO_REGION: ${{ secrets.HALO_REGION }}
32
+ HALO_REDIS: ${{ secrets.HALO_REDIS }}
33
+ HALO_TTL: ${{ secrets.HALO_TTL }}
34
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -10,5 +10,10 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+
14
+ # Environment
13
15
  .env
14
- /.idea
16
+
17
+ # rvm
18
+ .ruby-gemset
19
+ .ruby-version
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
1
  --format documentation
2
2
  --color
3
- --require spec_helper
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,79 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.5
7
+ NewCops: enable
8
+ SuggestExtensions: false
9
+ Exclude:
10
+ - '*.md'
11
+
12
+ Layout/SpaceInsideHashLiteralBraces:
13
+ EnforcedStyle: no_space
14
+
15
+ Metrics/BlockLength:
16
+ Max: 36
17
+ Exclude:
18
+ - spec/**/*.rb
19
+ - halo-api.gemspec
20
+
21
+ Metrics/BlockNesting:
22
+ Max: 2
23
+
24
+ Layout/LineLength:
25
+ AllowURI: true
26
+ Enabled: false
27
+
28
+ Metrics/MethodLength:
29
+ CountComments: false
30
+ Max: 15
31
+
32
+ Metrics/ModuleLength:
33
+ Max: 120
34
+
35
+ Metrics/ClassLength:
36
+ Max: 120
37
+
38
+ Metrics/ParameterLists:
39
+ Max: 5
40
+ CountKeywordArgs: true
41
+
42
+ Style/Documentation:
43
+ Enabled: false
44
+
45
+ Layout/DotPosition:
46
+ EnforcedStyle: trailing
47
+
48
+ Naming/FileName:
49
+ Enabled: false
50
+
51
+ Layout/AccessModifierIndentation:
52
+ Enabled: false
53
+
54
+ Style/TrailingCommaInArrayLiteral:
55
+ EnforcedStyleForMultiline: 'no_comma'
56
+
57
+ Style/TrailingCommaInHashLiteral:
58
+ EnforcedStyleForMultiline: 'no_comma'
59
+
60
+ RSpec/MultipleExpectations:
61
+ Max: 30
62
+
63
+ RSpec/ExampleLength:
64
+ Max: 35
65
+
66
+ RSpec/FilePath:
67
+ Enabled: false
68
+
69
+ RSpec/BeforeAfterAll:
70
+ Enabled: false
71
+
72
+ RSpec/NamedSubject:
73
+ Enabled: false
74
+
75
+ RSpec/EmptyExampleGroup:
76
+ Enabled: false
77
+
78
+ RSpec/MultipleMemoizedHelpers:
79
+ Max: 10
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,9 @@
1
+ ## How to contribute
2
+
3
+ Bug reports and pull requests are welcome!
4
+
5
+ 1. Fork it
6
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
7
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
8
+ 4. Push to the branch (`git push origin my-new-feature`)
9
+ 5. Create new Pull Request
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # HaloAPI
2
2
  [![Gem Version](https://badge.fury.io/rb/halo-api.svg)](https://badge.fury.io/rb/halo-api)
3
- [![Dependency Status](https://gemnasium.com/badges/github.com/xarlybovi/halo-api.svg)](https://gemnasium.com/github.com/xarlybovi/halo-api)
4
3
  [![Code Climate](https://codeclimate.com/github/xarlybovi/halo-api.png)](https://codeclimate.com/github/xarlybovi/halo-api)
5
- [![Build Status](https://travis-ci.org/xarlybovi/halo-api.svg?branch=master)](https://travis-ci.org/xarlybovi/halo-api)
6
- [![Coverage Status](https://coveralls.io/repos/github/xarlybovi/halo-api/badge.svg?branch=master)](https://coveralls.io/github/xarlybovi/halo-api?branch=master)
4
+ [![Actions Status](https://github.com/xarlybovi/halo-api/workflows/CI/badge.svg)](https://github.com/xarlybovi/halo-api/actions)
5
+ [![codecov](https://codecov.io/gh/xarlybovi/halo-api/branch/master/graph/badge.svg?token=NJLMA4MDU1)](https://codecov.io/gh/xarlybovi/halo-api)
7
6
 
8
7
  Wrapper for Halo Public API (BETA). https://developer.haloapi.com
9
8
 
@@ -12,7 +11,7 @@ Wrapper for Halo Public API (BETA). https://developer.haloapi.com
12
11
  Add this line to your application's Gemfile:
13
12
 
14
13
  ```ruby
15
- gem 'halo-api'
14
+ gem 'halo-api', '~> 1.0.0'
16
15
  ```
17
16
 
18
17
  And then execute:
@@ -25,40 +24,51 @@ Or install it yourself as:
25
24
 
26
25
  ## Usage
27
26
 
28
- Basic examples:
27
+ Basic configuration:
29
28
  ````ruby
30
29
  Halo.configure do |config|
31
30
  config.api_key = ENV['HALO_API_KEY']
32
- config.region = ENV['HALO_REGION']
31
+ end
32
+ ````
33
+
34
+ Configuration with redis and region (optional parameters)
35
+ ````ruby
36
+ Halo.configure do |config|
37
+ config.api_key = ENV['HALO_API_KEY']
38
+ config.region = ENV['HALO_REGION'] # default 'en'
39
+ config.redis = ENV['HALO_REDIS']
40
+ config.ttl = ENV['HALO_TTL'] # default 1800
33
41
  end
34
42
  ````
35
43
 
36
44
  ````ruby
37
45
  halo5_client = Halo.halo5
46
+ # => Halo::Halo5
38
47
  halo_wars2_client = Halo.halo_wars2
48
+ # => Halo::HaloWars2
39
49
 
40
50
  h5_missions = halo5_client.metadata.campaign_missions
51
+ # => Array
52
+ h5_enemies = halo5_client.metadata.enemies
53
+ # => Array
41
54
  h5_player_appearance = halo5_client.profile(player: 'xarly bovi').player_appearance
42
- h2w_campaign_levels = halo_wars2_client.metadata.campaign_levels
43
-
55
+ # => Array
56
+ hw2_campaign_levels = halo_wars2_client.metadata.campaign_levels
57
+ # => Array
58
+ hw2_seasons = halo_wars2_client.metadata.seasons
59
+ # => Array
44
60
  ````
45
61
 
46
62
  ## TODO
47
63
 
48
64
  - [x] Halo 5 endpoints
49
65
  - [x] Halo Wars 2 endpoints
66
+ - [x] Redis response caching support
67
+ - [ ] Request rate limiter
68
+ - [ ] Custom query builder
69
+ - [ ] Paged requests
50
70
  - [ ] Documentation
51
71
 
52
- ## Contributing
53
-
54
- Bug reports and pull requests are welcome!
55
-
56
- 1. Fork it
57
- 2. Create your feature branch (`git checkout -b my-new-feature`)
58
- 3. Commit your changes (`git commit -am 'Add some feature'`)
59
- 4. Push to the branch (`git push origin my-new-feature`)
60
- 5. Create new Pull Request
61
-
62
72
  ## License
63
73
 
64
74
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "halo-api"
4
+ require 'bundler/setup'
5
+ require 'halo-api'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "halo-api"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
data/halo-api.gemspec CHANGED
@@ -1,8 +1,6 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'halo-api/version'
3
+ require_relative 'lib/halo-api/version'
6
4
 
7
5
  Gem::Specification.new do |spec|
8
6
  spec.name = 'halo-api'
@@ -15,25 +13,30 @@ Gem::Specification.new do |spec|
15
13
  spec.homepage = 'https://github.com/xarlybovi/halo-api.git'
16
14
  spec.license = 'MIT'
17
15
 
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
16
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
20
18
  end
21
19
  spec.bindir = 'exe'
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
23
21
  spec.require_paths = ['lib']
24
22
 
25
- # This gem will work with 2.0.0 or greater
26
- spec.required_ruby_version = '>= 2.0.0'
23
+ # This gem will work with 2.5.8 or greater
24
+ spec.required_ruby_version = '>= 2.5.8'
27
25
 
28
- spec.add_runtime_dependency 'httparty', '~> 0.15.6'
29
- spec.add_runtime_dependency 'addressable', '~> 2.5', '>= 2.5.2'
26
+ spec.add_runtime_dependency 'addressable', '~> 2.8', '>= 2.8.0'
27
+ spec.add_runtime_dependency 'httparty', '~> 0.18.1'
28
+ spec.add_runtime_dependency 'redis', '~> 4.3'
30
29
 
31
- spec.add_development_dependency 'bundler', '~> 1.15'
32
- spec.add_development_dependency 'rake', '~> 12.0'
33
- spec.add_development_dependency 'rspec', '~> 3.0'
30
+ spec.add_development_dependency 'bundler', '~> 2.2.24'
31
+ spec.add_development_dependency 'codecov', '~> 0.5.2'
34
32
  spec.add_development_dependency 'dotenv', '~> 2.2', '>= 2.2.1'
35
- spec.add_development_dependency 'rubocop', '~> 0.49.1'
36
- spec.add_development_dependency 'coveralls', '~> 0.8.21'
37
- spec.add_development_dependency 'pry', '~> 0.10.3'
38
- spec.add_development_dependency 'wwtd', '~> 1.3'
33
+ spec.add_development_dependency 'pry', '~> 0.11'
34
+ spec.add_development_dependency 'rake', '~> 13.0.6'
35
+ spec.add_development_dependency 'rspec', '~> 3.10.0'
36
+ spec.add_development_dependency 'rubocop', '~> 1.18'
37
+ spec.add_development_dependency 'rubocop-performance', '~> 1.11'
38
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.4.0'
39
+ spec.add_development_dependency 'simplecov', '~> 0.21'
40
+ spec.add_development_dependency 'vcr', '~> 6.0'
41
+ spec.add_development_dependency 'webmock', '~> 3.13'
39
42
  end
data/lib/halo-api.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'halo-api/version'
2
4
  require 'halo-api/configuration'
3
5
  require 'halo-api/client'
@@ -6,12 +8,10 @@ require 'halo-api/api_response'
6
8
  require 'halo-api/clients/halo5_client'
7
9
  require 'halo-api/clients/halo_wars2_client'
8
10
 
9
-
10
11
  module Halo
11
12
  extend Configuration
12
13
 
13
14
  class << self
14
-
15
15
  def halo5(options = {})
16
16
  Halo::Clients::Halo5Client.new(options)
17
17
  end
@@ -19,6 +19,5 @@ module Halo
19
19
  def halo_wars2(options = {})
20
20
  Halo::Clients::HaloWars2Client.new(options)
21
21
  end
22
-
23
22
  end
24
- end
23
+ end
@@ -1,18 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'httparty'
4
+ require 'addressable/uri'
5
+ require 'redis'
6
+
1
7
  module Halo
2
- class APIResponse
8
+ class InvalidCacheStore < StandardError; end
3
9
 
4
- attr_accessor :data
10
+ class APIResponse
11
+ include HTTParty
5
12
 
6
13
  def initialize(options = {})
7
- @data = []
8
- @client = options[:client]
14
+ client = options.delete(:client)
15
+ @api_key = client.api_key
16
+ @region = client.region || Halo::Configuration::DEFAULT_REGION
17
+ @cache_store = client.cache_store || {}
18
+
19
+ raise InvalidCacheStore if cached? && !redis_store.is_a?(Redis)
20
+
21
+ self.class.base_uri 'https://www.haloapi.com'
22
+ end
23
+
24
+ def get_data(path, options = {})
25
+ store_key = "#{path}#{options}#{@region}"
26
+ if cached?
27
+ result = redis_store.get(store_key)
28
+ return JSON.parse(result) if result
29
+ end
30
+ response = perform_uncached_request(:get, path, options)
31
+ redis_store.setex(store_key, ttl, response.to_json) if cached?
32
+ response
9
33
  end
10
34
 
11
- def get_data(path, options)
12
- return if @client.nil?
13
- response = @client.get(path, options)
14
- @data = response.parsed_response
35
+ def perform_uncached_request(verb, path, params = {})
36
+ options = {}
37
+ headers = {
38
+ 'Ocp-Apim-Subscription-Key' => @api_key,
39
+ 'Accept-Language' => @region
40
+ }
41
+
42
+ options[:headers] = headers unless headers.empty?
43
+ options[:query] = params unless params.empty?
44
+
45
+ response = self.class.send(verb, Addressable::URI.encode(path), options)
46
+
47
+ response.respond_to?(:parsed_response) ? response.parsed_response : response
48
+ end
49
+
50
+ # @return [Redis] returns the cache store
51
+ def redis_store
52
+ @cache_store[:redis]
53
+ end
54
+
55
+ # @return [Boolean] true if the request should be cached
56
+ def cached?
57
+ @cache_store[:cached]
15
58
  end
16
59
 
60
+ # @return [Integer] the ttl to apply to cached keys
61
+ def ttl
62
+ @cache_store[:ttl]
63
+ end
17
64
  end
18
- end
65
+ end
@@ -1,46 +1,41 @@
1
- require 'halo-api/version'
2
- require 'halo-api/api_response'
3
- require 'httparty'
4
- require 'addressable/uri'
5
-
1
+ # frozen_string_literal: true
6
2
 
7
3
  module Halo
8
4
  class Client
9
- include HTTParty
10
-
11
5
  attr_accessor(*Configuration::OPTIONS)
12
6
 
13
7
  def initialize(options = {})
14
- @api_key = options[:api_key]
15
- @region = options[:region]
16
- @endpoint = options[:endpoint]
17
-
18
8
  options = Halo.options.merge(options)
19
9
 
20
10
  Halo::Configuration::OPTIONS.each do |key|
21
11
  send("#{key}=", options[key])
22
12
  end
23
13
 
24
- self.class.base_uri "https://www.haloapi.com#{@endpoint}"
14
+ set_up_cache(options.delete(:redis), options.delete(:ttl))
25
15
  end
26
16
 
27
- def get(path, params = {})
28
- make_request :get, path, params
17
+ def set_up_cache(redis_url, ttl)
18
+ return @cached = false unless redis_url
19
+
20
+ @ttl = ttl || Halo::Configuration::DEFAULT_TTL
21
+ @cached = true
22
+ @redis = Redis.new url: redis_url
29
23
  end
30
24
 
31
- def make_request(verb, path, params = {})
32
- options = {}
33
- headers = {
34
- 'Ocp-Apim-Subscription-Key' => @api_key,
35
- 'Accept-Language' => @region
25
+ # Returns an options hash with cache keys
26
+ # @return [Hash]
27
+ def cache_store
28
+ {
29
+ redis: @redis,
30
+ ttl: @ttl,
31
+ cached: @cached
36
32
  }
37
-
38
- options[:headers] = headers unless headers.empty?
39
- options[:query] = params unless params.empty?
40
-
41
- self.class.send(verb, Addressable::URI.encode(path), options)
42
33
  end
43
34
 
35
+ # @return [Boolean] true if the request should be cached
36
+ def cached?
37
+ cache_store[:cached]
38
+ end
44
39
 
45
40
  private
46
41
 
@@ -49,4 +44,4 @@ module Halo
49
44
  obj.new(opts)
50
45
  end
51
46
  end
52
- end
47
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'halo-api/client'
2
4
 
3
5
  require 'halo-api/modules/halo5/metadata'
@@ -5,13 +7,10 @@ require 'halo-api/modules/halo5/profile'
5
7
  require 'halo-api/modules/halo5/stats'
6
8
  require 'halo-api/modules/halo5/ugc'
7
9
 
8
-
9
10
  module Halo
10
11
  module Clients
11
-
12
12
  # Halo 5 Client
13
13
  class Halo5Client < Client
14
-
15
14
  def initialize(options = {})
16
15
  super(options)
17
16
  end
@@ -31,7 +30,6 @@ module Halo
31
30
  def ugc(options = {})
32
31
  merge_options_and_return_obj(options, Halo::Halo5::Ugc)
33
32
  end
34
-
35
33
  end
36
34
  end
37
35
  end
@@ -1,15 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'halo-api/client'
2
4
 
3
5
  require 'halo-api/modules/halo_wars2/metadata'
4
6
  require 'halo-api/modules/halo_wars2/stats'
5
7
 
6
-
7
8
  module Halo
8
9
  module Clients
9
-
10
10
  # Halo Wars 2 Client
11
11
  class HaloWars2Client < Client
12
-
13
12
  def initialize(options = {})
14
13
  super(options)
15
14
  end
@@ -21,7 +20,6 @@ module Halo
21
20
  def stats(options = {})
22
21
  merge_options_and_return_obj(options, Halo::HaloWars2::Stats)
23
22
  end
24
-
25
23
  end
26
24
  end
27
25
  end
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Halo
2
4
  module Configuration
3
-
4
- OPTIONS = %i[api_key region].freeze
5
+ OPTIONS = %i[api_key region redis ttl].freeze
5
6
 
6
7
  DEFAULT_API_KEY = nil
7
- DEFAULT_REGION = :en
8
+ DEFAULT_REGION = 'en'
9
+ DEFAULT_REDIS = 'redis://localhost:6379'
10
+ DEFAULT_TTL = 1800 # 30m
8
11
 
9
12
  attr_accessor(*OPTIONS)
10
13
 
@@ -17,6 +20,5 @@ module Halo
17
20
  option.merge!(key => send(key))
18
21
  end
19
22
  end
20
-
21
23
  end
22
- end
24
+ end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Halo
2
4
  module Halo5
3
5
  class Metadata < APIResponse
4
-
5
6
  def initialize(options = {})
6
7
  @endpoint = '/metadata/h5/metadata'
7
8
 
@@ -16,6 +17,10 @@ module Halo
16
17
  get_data("#{@endpoint}/commendations", options)
17
18
  end
18
19
 
20
+ def company_commendations(options = {})
21
+ get_data("#{@endpoint}/company-commendations", options)
22
+ end
23
+
19
24
  def csr_designations(options = {})
20
25
  get_data("#{@endpoint}/csr-designations", options)
21
26
  end
@@ -52,8 +57,8 @@ module Halo
52
57
  get_data("#{@endpoint}/medals", options)
53
58
  end
54
59
 
55
- def playlist(options = {})
56
- get_data("#{@endpoint}/playlist", options)
60
+ def playlists(options = {})
61
+ get_data("#{@endpoint}/playlists", options)
57
62
  end
58
63
 
59
64
  def requisition(id, options = {})
@@ -87,7 +92,6 @@ module Halo
87
92
  def weapons(options = {})
88
93
  get_data("#{@endpoint}/weapons", options)
89
94
  end
90
-
91
95
  end
92
96
  end
93
97
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Halo
2
4
  module Halo5
3
5
  class Profile < APIResponse
4
-
5
6
  def initialize(options = {})
6
7
  @player = options.delete(:player)
7
8
  @endpoint = "/profile/h5/profiles/#{@player}"
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Halo
2
4
  module Halo5
3
5
  class Stats < APIResponse
4
-
5
6
  def initialize(options = {})
6
7
  @endpoint = '/stats/h5'
7
8
  super(options)
@@ -74,7 +75,6 @@ module Halo
74
75
  def pc_psr_custom(players, options = {})
75
76
  get_data("#{@endpoint}pc/servicerecords/custom", options.merge(players: players))
76
77
  end
77
-
78
78
  end
79
79
  end
80
80
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Halo
2
4
  module Halo5
3
5
  class Ugc < APIResponse
4
-
5
6
  def initialize(options = {})
6
7
  @player = options.delete(:player)
7
8
  @endpoint = "/ugc/h5/players/#{@player}"
@@ -24,7 +25,6 @@ module Halo
24
25
  def player_map_variants(options = {})
25
26
  get_data("#{@endpoint}/mapvariants", options)
26
27
  end
27
-
28
28
  end
29
29
  end
30
30
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Halo
2
4
  module HaloWars2
3
5
  class Metadata < APIResponse
4
-
5
6
  def initialize(options = {})
6
7
  @endpoint = '/metadata/hw2'
7
8
 
@@ -71,7 +72,6 @@ module Halo
71
72
  def techs(options = {})
72
73
  get_data("#{@endpoint}/techs", options)
73
74
  end
74
-
75
75
  end
76
76
  end
77
77
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Halo
2
4
  module HaloWars2
3
5
  class Stats < APIResponse
4
-
5
6
  def initialize(options = {})
6
7
  @endpoint = '/stats/hw2'
7
8
 
@@ -43,7 +44,6 @@ module Halo
43
44
  def player_xp(players, options = {})
44
45
  get_data("#{@endpoint}/xp", options.merge(players: players))
45
46
  end
46
-
47
47
  end
48
48
  end
49
49
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Halo
2
- VERSION = '0.3.1'.freeze
4
+ VERSION = '1.0.0'
3
5
  end
metadata CHANGED
@@ -1,91 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: halo-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Ruiz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-11 00:00:00.000000000 Z
11
+ date: 2021-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: httparty
14
+ name: addressable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.8.0
17
20
  - - "~>"
18
21
  - !ruby/object:Gem::Version
19
- version: 0.15.6
22
+ version: '2.8'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.8.0
24
30
  - - "~>"
25
31
  - !ruby/object:Gem::Version
26
- version: 0.15.6
32
+ version: '2.8'
27
33
  - !ruby/object:Gem::Dependency
28
- name: addressable
34
+ name: httparty
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '2.5'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 2.5.2
39
+ version: 0.18.1
37
40
  type: :runtime
38
41
  prerelease: false
39
42
  version_requirements: !ruby/object:Gem::Requirement
40
43
  requirements:
41
44
  - - "~>"
42
45
  - !ruby/object:Gem::Version
43
- version: '2.5'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 2.5.2
46
+ version: 0.18.1
47
47
  - !ruby/object:Gem::Dependency
48
- name: bundler
48
+ name: redis
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '1.15'
54
- type: :development
53
+ version: '4.3'
54
+ type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '1.15'
60
+ version: '4.3'
61
61
  - !ruby/object:Gem::Dependency
62
- name: rake
62
+ name: bundler
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '12.0'
67
+ version: 2.2.24
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '12.0'
74
+ version: 2.2.24
75
75
  - !ruby/object:Gem::Dependency
76
- name: rspec
76
+ name: codecov
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '3.0'
81
+ version: 0.5.2
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '3.0'
88
+ version: 0.5.2
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: dotenv
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -106,62 +106,132 @@ dependencies:
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: 2.2.1
109
+ - !ruby/object:Gem::Dependency
110
+ name: pry
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '0.11'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '0.11'
123
+ - !ruby/object:Gem::Dependency
124
+ name: rake
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: 13.0.6
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: 13.0.6
137
+ - !ruby/object:Gem::Dependency
138
+ name: rspec
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: 3.10.0
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: 3.10.0
109
151
  - !ruby/object:Gem::Dependency
110
152
  name: rubocop
111
153
  requirement: !ruby/object:Gem::Requirement
112
154
  requirements:
113
155
  - - "~>"
114
156
  - !ruby/object:Gem::Version
115
- version: 0.49.1
157
+ version: '1.18'
116
158
  type: :development
117
159
  prerelease: false
118
160
  version_requirements: !ruby/object:Gem::Requirement
119
161
  requirements:
120
162
  - - "~>"
121
163
  - !ruby/object:Gem::Version
122
- version: 0.49.1
164
+ version: '1.18'
123
165
  - !ruby/object:Gem::Dependency
124
- name: coveralls
166
+ name: rubocop-performance
125
167
  requirement: !ruby/object:Gem::Requirement
126
168
  requirements:
127
169
  - - "~>"
128
170
  - !ruby/object:Gem::Version
129
- version: 0.8.21
171
+ version: '1.11'
130
172
  type: :development
131
173
  prerelease: false
132
174
  version_requirements: !ruby/object:Gem::Requirement
133
175
  requirements:
134
176
  - - "~>"
135
177
  - !ruby/object:Gem::Version
136
- version: 0.8.21
178
+ version: '1.11'
137
179
  - !ruby/object:Gem::Dependency
138
- name: pry
180
+ name: rubocop-rspec
181
+ requirement: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - "~>"
184
+ - !ruby/object:Gem::Version
185
+ version: 2.4.0
186
+ type: :development
187
+ prerelease: false
188
+ version_requirements: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - "~>"
191
+ - !ruby/object:Gem::Version
192
+ version: 2.4.0
193
+ - !ruby/object:Gem::Dependency
194
+ name: simplecov
195
+ requirement: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - "~>"
198
+ - !ruby/object:Gem::Version
199
+ version: '0.21'
200
+ type: :development
201
+ prerelease: false
202
+ version_requirements: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - "~>"
205
+ - !ruby/object:Gem::Version
206
+ version: '0.21'
207
+ - !ruby/object:Gem::Dependency
208
+ name: vcr
139
209
  requirement: !ruby/object:Gem::Requirement
140
210
  requirements:
141
211
  - - "~>"
142
212
  - !ruby/object:Gem::Version
143
- version: 0.10.3
213
+ version: '6.0'
144
214
  type: :development
145
215
  prerelease: false
146
216
  version_requirements: !ruby/object:Gem::Requirement
147
217
  requirements:
148
218
  - - "~>"
149
219
  - !ruby/object:Gem::Version
150
- version: 0.10.3
220
+ version: '6.0'
151
221
  - !ruby/object:Gem::Dependency
152
- name: wwtd
222
+ name: webmock
153
223
  requirement: !ruby/object:Gem::Requirement
154
224
  requirements:
155
225
  - - "~>"
156
226
  - !ruby/object:Gem::Version
157
- version: '1.3'
227
+ version: '3.13'
158
228
  type: :development
159
229
  prerelease: false
160
230
  version_requirements: !ruby/object:Gem::Requirement
161
231
  requirements:
162
232
  - - "~>"
163
233
  - !ruby/object:Gem::Version
164
- version: '1.3'
234
+ version: '3.13'
165
235
  description: Wrapper for Halo Public API (BETA). https://developer.haloapi.com
166
236
  email:
167
237
  - xarlybovi@gmail.com
@@ -169,11 +239,12 @@ executables: []
169
239
  extensions: []
170
240
  extra_rdoc_files: []
171
241
  files:
242
+ - ".env.example"
243
+ - ".github/workflows/main.yml"
172
244
  - ".gitignore"
173
245
  - ".rspec"
174
- - ".ruby-gemset"
175
- - ".ruby-version"
176
- - ".travis.yml"
246
+ - ".rubocop.yml"
247
+ - CONTRIBUTING.md
177
248
  - Gemfile
178
249
  - LICENSE.txt
179
250
  - README.md
@@ -206,15 +277,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
277
  requirements:
207
278
  - - ">="
208
279
  - !ruby/object:Gem::Version
209
- version: 2.0.0
280
+ version: 2.5.8
210
281
  required_rubygems_version: !ruby/object:Gem::Requirement
211
282
  requirements:
212
283
  - - ">="
213
284
  - !ruby/object:Gem::Version
214
285
  version: '0'
215
286
  requirements: []
216
- rubyforge_project:
217
- rubygems_version: 2.6.11
287
+ rubygems_version: 3.0.3.1
218
288
  signing_key:
219
289
  specification_version: 4
220
290
  summary: Wrapper for Halo Public API.
data/.ruby-gemset DELETED
@@ -1 +0,0 @@
1
- halo-api
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- ruby-2.4.1
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.0.0
5
- - 2.1.10
6
- - 2.2.0
7
- - 2.3.0
8
- - 2.4.1
9
- - ruby-head
10
- before_install: gem install bundler -v 1.15.4