halo_stats 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9c7c12046e5b01c64284c242cfd7de3241d47ea0
4
+ data.tar.gz: 65ec404f7a07ef4204fe15e0b79f0a8a483b1897
5
+ SHA512:
6
+ metadata.gz: c2d45af109481a96da3de0f086d412c2d168693128060741113b60c17a1f474938475d59501a3c4c162c357d4817a1607f6aca79b02759e5c802289942d6db27
7
+ data.tar.gz: e77911bb3921bcc32bd9aae6ba0c1ce30e723312ef7ecad49b709ea1173e4bd93cf2a091b6c2cb55d8a380050fb7f41caa96b4cbfa37b57ff6ac07dfcf6b2f2d
data/.gitignore ADDED
@@ -0,0 +1,138 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+
24
+ # Created by https://www.gitignore.io
25
+
26
+ ### RubyMine ###
27
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
28
+
29
+ *.iml
30
+
31
+ ## Directory-based project format:
32
+ .idea/
33
+ # if you remove the above rule, at least ignore the following:
34
+
35
+ # User-specific stuff:
36
+ # .idea/workspace.xml
37
+ # .idea/tasks.xml
38
+ # .idea/dictionaries
39
+
40
+ # Sensitive or high-churn files:
41
+ # .idea/dataSources.ids
42
+ # .idea/dataSources.xml
43
+ # .idea/sqlDataSources.xml
44
+ # .idea/dynamic.xml
45
+ # .idea/uiDesigner.xml
46
+
47
+ # Gradle:
48
+ # .idea/gradle.xml
49
+ # .idea/libraries
50
+
51
+ # Mongo Explorer plugin:
52
+ # .idea/mongoSettings.xml
53
+
54
+ ## File-based project format:
55
+ *.ipr
56
+ *.iws
57
+
58
+ ## Plugin-specific files:
59
+
60
+ # IntelliJ
61
+ /out/
62
+
63
+ # mpeltonen/sbt-idea plugin
64
+ .idea_modules/
65
+
66
+ # JIRA plugin
67
+ atlassian-ide-plugin.xml
68
+
69
+ # Crashlytics plugin (for Android Studio and IntelliJ)
70
+ com_crashlytics_export_strings.xml
71
+ crashlytics.properties
72
+ crashlytics-build.properties
73
+
74
+
75
+ ### SublimeText ###
76
+ # cache files for sublime text
77
+ *.tmlanguage.cache
78
+ *.tmPreferences.cache
79
+ *.stTheme.cache
80
+
81
+ # workspace files are user-specific
82
+ *.sublime-workspace
83
+
84
+ # project files should be checked into the repository, unless a significant
85
+ # proportion of contributors will probably not be using SublimeText
86
+ # *.sublime-project
87
+
88
+ # sftp configuration file
89
+ sftp-config.json
90
+
91
+
92
+ ### Vim ###
93
+ [._]*.s[a-w][a-z]
94
+ [._]s[a-w][a-z]
95
+ *.un~
96
+ Session.vim
97
+ .netrwhist
98
+ *~
99
+
100
+
101
+ ### Ruby ###
102
+ *.gem
103
+ *.rbc
104
+ /.config
105
+ /coverage/
106
+ /InstalledFiles
107
+ /pkg/
108
+ /spec/reports/
109
+ /test/tmp/
110
+ /test/version_tmp/
111
+ /tmp/
112
+
113
+ ## Specific to RubyMotion:
114
+ .dat*
115
+ .repl_history
116
+ build/
117
+
118
+ ## Documentation cache and generated files:
119
+ /.yardoc/
120
+ /_yardoc/
121
+ /doc/
122
+ /rdoc/
123
+
124
+ ## Environment normalisation:
125
+ /.bundle/
126
+ /vendor/bundle
127
+ /lib/bundler/man/
128
+
129
+ # for a library or gem, you might want to ignore these files since the code is
130
+ # intended to run in multiple environments; otherwise, check them in:
131
+ # Gemfile.lock
132
+ # .ruby-version
133
+ # .ruby-gemset
134
+
135
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
136
+ .rvmrc
137
+
138
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in takeout.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "guard", "2.12.5", require: false
8
+ gem "guard-rspec", '4.5.0', require: false
9
+ gem "guard-bundler", require: false
10
+ gem "guard-rake", require: false
11
+ gem "terminal-notifier-guard", require: false
12
+ gem 'guard-yard', require: false
13
+ end
data/Guardfile ADDED
@@ -0,0 +1,54 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :bundler do
5
+ require 'guard/bundler'
6
+ require 'guard/bundler/verify'
7
+ helper = Guard::Bundler::Verify.new
8
+
9
+ files = ['Gemfile']
10
+ files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
11
+
12
+ # Assume files are symlinked from somewhere
13
+ files.each { |file| watch(helper.real_path(file)) }
14
+ end
15
+
16
+ # Note: The cmd option is now required due to the increasing number of ways
17
+ # rspec may be run, below are examples of the most common uses.
18
+ # * bundler: 'bundle exec rspec'
19
+ # * bundler binstubs: 'bin/rspec'
20
+ # * spring: 'bin/rspec' (This will use spring if running and you have
21
+ # installed the spring binstubs per the docs)
22
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
23
+ # * 'just' rspec: 'rspec'
24
+
25
+ guard :rspec, cmd: "bundle exec rspec" do
26
+ require "guard/rspec/dsl"
27
+ dsl = Guard::RSpec::Dsl.new(self)
28
+
29
+ # Feel free to open issues for suggestions and improvements
30
+
31
+ # RSpec files
32
+ rspec = dsl.rspec
33
+ watch(rspec.spec_helper) { rspec.spec_dir }
34
+ watch(rspec.spec_support) { rspec.spec_dir }
35
+ watch(rspec.spec_files)
36
+
37
+ # Ruby files
38
+ watch(%r{^lib/halo_stats/(.+)\.rb$}) { |m| puts m; "spec/#{m.last}_spec.rb" }
39
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m.last}_spec.rb" }
40
+ end
41
+
42
+ guard 'rake', task: 'build', run_on_all: true, run_on_start: true do
43
+ watch(%r{^lib/halo-stats})
44
+ end
45
+
46
+ guard 'rake', task: 'install', run_on_all: true, run_on_start: true do
47
+ watch(%r{^lib/halo_stats/})
48
+ end
49
+
50
+ guard 'yard' do
51
+ watch(%r{app/.+\.rb})
52
+ watch(%r{lib/.+\.rb})
53
+ watch(%r{ext/.+\.c})
54
+ end
data/README ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'halo_stats/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "halo_stats"
8
+ spec.version = HaloStats::VERSION
9
+ spec.authors = ["Kyle Lucas"]
10
+ spec.email = ["kglucas93@gmail.com"]
11
+ spec.summary = %q{A stats gem for Halo 5.}
12
+ spec.description = %q{}
13
+ spec.homepage = "http://github.com/kyelgrantlucas/halo_stats"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = '>= 1.9.3'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.6"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_runtime_dependency "takeout", "~> 0.1.2"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "sinatra"
27
+ spec.add_development_dependency "webmock"
28
+
29
+ spec.add_development_dependency "codeclimate-test-reporter"
30
+
31
+ end
@@ -0,0 +1,60 @@
1
+ module HaloStats
2
+ class Metadata
3
+ require 'takeout'
4
+ attr_accessor :metadata_client
5
+
6
+ def initialize(options={})
7
+ title = 'h5'
8
+ key = options[:api_key]
9
+ metadata_prefix = "/metadata/#{title}/metadata"
10
+ metadata_schemas = { get: {
11
+ campaign_missions: "#{metadata_prefix}/campaign-missions",
12
+ commendations: "#{metadata_prefix}/commendations",
13
+ csr_designations: "#{metadata_prefix}/csr-designations",
14
+ enemies: "#{metadata_prefix}/enemies",
15
+ flexible_stats: "#{metadata_prefix}/flexible-stats",
16
+ game_base_variants: "#{metadata_prefix}/game-base-variants",
17
+ game_variants: "#{metadata_prefix}/game-variants/{{id}}",
18
+ impulses: "#{metadata_prefix}/impulses",
19
+ map_variants: "#{metadata_prefix}/map-variants/{{id}}",
20
+ maps: "#{metadata_prefix}/maps",
21
+ medals: "#{metadata_prefix}/medals",
22
+ playlists: "#{metadata_prefix}/playlists",
23
+ requisition_packs: "#{metadata_prefix}/requisition-packs/{{id}}",
24
+ requisitions: "#{metadata_prefix}/requisitions/{{id}}",
25
+ seasons: "#{metadata_prefix}/seasons",
26
+ skulls: "#{metadata_prefix}/skulls",
27
+ spartan_ranks: "#{metadata_prefix}/spartan-ranks",
28
+ team_colors: "#{metadata_prefix}/team-colors",
29
+ vehicles: "#{metadata_prefix}/vehicles",
30
+ weapons: "#{metadata_prefix}/weapons"
31
+ }
32
+ }
33
+ metadata_endpoints = {get: metadata_schemas[:get].keys}
34
+
35
+ self.metadata_client = Takeout::Client.new(uri: "www.haloapi.com", endpoints: metadata_endpoints, schemas: metadata_schemas, headers: {'Ocp-Apim-Subscription-Key' => key}, ssl: true)
36
+
37
+ return self
38
+ end
39
+
40
+ def get_map_variants(id)
41
+ return metadata_client.get_map_variants(id: id)
42
+ end
43
+
44
+ def get_game_variants(id)
45
+ return metadata_client.get_game_variants(id: id)
46
+ end
47
+
48
+ def get_requisition_packs(id)
49
+ return metadata_client.get_requisition_packs(id: id)
50
+ end
51
+
52
+ def get_requisitions(id)
53
+ return metadata_client.get_requisitions(id: id)
54
+ end
55
+
56
+ def method_missing(meth, *args, &block)
57
+ return self.metadata_client.send(meth)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,30 @@
1
+ module HaloStats
2
+ class Profile
3
+ require 'takeout'
4
+ attr_accessor :profile_client
5
+
6
+ def initialize(options={})
7
+ title = 'h5'
8
+ key = options[:api_key]
9
+ profile_prefix = "/profile/#{title}"
10
+ profile_schemas = { get: {
11
+ emblem: "#{profile_prefix}/profiles/{{gamertag}}/emblem",
12
+ spartan_image: "#{profile_prefix}/profiles/{player}/spartan"
13
+ }
14
+ }
15
+ profile_endpoints = {get: profile_schemas[:get].keys}
16
+
17
+ self.profile_client = Takeout::Client.new(uri: "www.haloapi.com", endpoints: profile_endpoints, schemas: profile_schemas, headers: {'Ocp-Apim-Subscription-Key' => key}, ssl: true)
18
+
19
+ return self
20
+ end
21
+
22
+ def get_emblem(gamertag, size=nil)
23
+ return profile_client.get_emblem(gamertag: gamertag, size: size)
24
+ end
25
+
26
+ def get_spartan_image(gamertag, size=nil, crop=nil)
27
+ return profile_client.get_emblem(gamertag: gamertag, size: size, crop: crop)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,66 @@
1
+ module HaloStats
2
+ class Stats
3
+ require 'takeout'
4
+ attr_accessor :stats_client
5
+
6
+
7
+ def initialize(options={})
8
+ title = 'h5'
9
+ key = options[:api_key]
10
+ stats_prefix = "/stats/#{title}"
11
+ stats_schemas = { get: {
12
+ player_matches: "#{stats_prefix}/players/{{gamertag}}/matches",
13
+ arena_matches: "#{stats_prefix}/arena/matches/{{id}}",
14
+ campign_matches: "#{stats_prefix}/campaign/matches/{{id}}",
15
+ warzone_matches: "#{stats_prefix}/warzone/matches/{{id}}",
16
+ custom_game_matches: "#{stats_prefix}/custom/matches/{{id}}",
17
+ arena_service_record: "#{stats_prefix}/servicerecords/arena",
18
+ campaign_service_record: "#{stats_prefix}/servicerecords/campaign",
19
+ warzone_service_record: "#{stats_prefix}/servicerecords/warzone",
20
+ custom_game_service_record: "#{stats_prefix}/servicerecords/custom"
21
+ }
22
+ }
23
+ stats_endpoints = {get: stats_schemas[:get].keys}
24
+
25
+ self.stats_client = Takeout::Client.new(uri: "www.haloapi.com", endpoints: stats_endpoints, schemas: stats_schemas, headers: {'Ocp-Apim-Subscription-Key' => key}, ssl: true)
26
+
27
+ return self
28
+ end
29
+
30
+ def get_matches(gamertag)
31
+ return stats_client.get_player_matches(gamertag: gamertag)
32
+ end
33
+
34
+ def get_arena_carnage_report(id)
35
+ return stats_client.get_arena_matches(id: id)
36
+ end
37
+
38
+ def get_campaign_carnage_report(id)
39
+ return stats_client.get_campaign_matches(id: id)
40
+ end
41
+
42
+ def get_warzone_carnage_report(id)
43
+ return stats_client.get_warzone_matches(id: id)
44
+ end
45
+
46
+ def custom_game_carnage_report(id)
47
+ return stats_client.get_custom_game_matches(id: id)
48
+ end
49
+
50
+ def get_arena_service_record(gamertags)
51
+ return stats_client.get_arena_service_record(players: [gamertags].flatten(1).join(','))
52
+ end
53
+
54
+ def get_campaign_service_record(gamertags)
55
+ return stats_client.get_campaign_service_record(players: [gamertags].flatten(1).join(','))
56
+ end
57
+
58
+ def get_custom_game_service_record(gamertags)
59
+ return stats_client.get_custom_game_service_record(players: [gamertags].flatten(1).join(','))
60
+ end
61
+
62
+ def get_warzone_service_record(gamertags)
63
+ return stats_client.get_warzone_service_record(players: [gamertags].flatten(1).join(','))
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,3 @@
1
+ module HaloStats
2
+ VERSION = "1.0.0"
3
+ end
data/lib/halo_stats.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'halo_stats/profile'
2
+ require 'halo_stats/stats'
3
+ require 'halo_stats/metadata'
4
+
5
+ module HaloStats
6
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: halo_stats
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kyle Lucas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: takeout
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sinatra
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: codeclimate-test-reporter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: ''
112
+ email:
113
+ - kglucas93@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - Gemfile
120
+ - Guardfile
121
+ - README
122
+ - Rakefile
123
+ - halo_stats.gemspec
124
+ - lib/halo_stats.rb
125
+ - lib/halo_stats/metadata.rb
126
+ - lib/halo_stats/profile.rb
127
+ - lib/halo_stats/stats.rb
128
+ - lib/halo_stats/version.rb
129
+ homepage: http://github.com/kyelgrantlucas/halo_stats
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: 1.9.3
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.2.2
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: A stats gem for Halo 5.
153
+ test_files: []
154
+ has_rdoc: