reach-api 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rvmrc +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +9 -0
- data/Guardfile +19 -0
- data/Rakefile +11 -0
- data/lib/reach-api.rb +25 -0
- data/lib/reach/api.rb +32 -0
- data/lib/reach/api/file.rb +100 -0
- data/lib/reach/api/game.rb +43 -0
- data/lib/reach/api/player.rb +59 -0
- data/lib/reach/helper.rb +64 -0
- data/lib/reach/version.rb +39 -0
- data/reach-api.gemspec +30 -0
- data/readme.md +31 -0
- data/spec/cases/api_spec.rb +12 -0
- data/spec/cases/helper_spec.rb +41 -0
- data/spec/cases/version_spec.rb +8 -0
- data/spec/helper.rb +6 -0
- metadata +146 -0
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
# Capybara request specs
|
17
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
18
|
+
end
|
19
|
+
|
data/Rakefile
ADDED
data/lib/reach-api.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Reach
|
2
|
+
class << self
|
3
|
+
|
4
|
+
# Alias for Reach::API.new
|
5
|
+
#
|
6
|
+
# Returns a Reach::API object
|
7
|
+
def new(options)
|
8
|
+
Reach::API.new(options)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Delegate to Reach::API
|
12
|
+
def method_missing(method, *args, &block)
|
13
|
+
return super unless new.respond_to?(method)
|
14
|
+
new.send(method, *args, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def respond_to?(method, include_private=false)
|
18
|
+
new.respond_to?(method, include_private) || super(method, include_private)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
autoload :API, "reach/api"
|
23
|
+
autoload :Helper, "reach/helper"
|
24
|
+
autoload :Version, "reach/version"
|
25
|
+
end
|
data/lib/reach/api.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "httparty"
|
2
|
+
require "json"
|
3
|
+
|
4
|
+
module Reach
|
5
|
+
class API
|
6
|
+
include HTTParty
|
7
|
+
|
8
|
+
require "reach/api/game"
|
9
|
+
include Reach::API::Game
|
10
|
+
|
11
|
+
require "reach/api/player"
|
12
|
+
include Reach::API::Player
|
13
|
+
|
14
|
+
require "reach/api/file"
|
15
|
+
include Reach::API::File
|
16
|
+
|
17
|
+
# API endpoint
|
18
|
+
ENDPOINT = "http://www.bungie.net/api/reach/reachapijson.svc/"
|
19
|
+
|
20
|
+
# API key
|
21
|
+
attr_reader :key
|
22
|
+
|
23
|
+
# Public: Creates a new API object
|
24
|
+
#
|
25
|
+
# key - the API key used throughout the application
|
26
|
+
#
|
27
|
+
# Returns a new Reach::API object
|
28
|
+
def initialize(key)
|
29
|
+
@key = key
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module Reach
|
2
|
+
class API
|
3
|
+
module File
|
4
|
+
|
5
|
+
# Public: Fetches a listing of files in a player's
|
6
|
+
# file share
|
7
|
+
#
|
8
|
+
# gamertag - the player to get a file listing for
|
9
|
+
#
|
10
|
+
# Returns a hash
|
11
|
+
def get_player_file_share(gamertag)
|
12
|
+
gamertag = gamertag.gsub(' ', '%20')
|
13
|
+
uri = ENDPOINT + "file/share/#{key}/#{gamertag}"
|
14
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
15
|
+
Reach::Helper::convert_keys(data)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Public: Fetches information on a specific file
|
19
|
+
#
|
20
|
+
# id - the ID of the file to get information on
|
21
|
+
#
|
22
|
+
# Returns a hash
|
23
|
+
def get_file_details(id)
|
24
|
+
uri = ENDPOINT + "file/details/#{key}/#{id}"
|
25
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
26
|
+
Reach::Helper::convert_keys(data)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Public: Fetches a list of a player's recent screenshots
|
30
|
+
#
|
31
|
+
# gamertag - the specified player
|
32
|
+
#
|
33
|
+
# Returns a hash
|
34
|
+
def get_player_recent_screenshots(gamertag)
|
35
|
+
gamertag = gamertag.gsub(' ', '%20')
|
36
|
+
uri = ENDPOINT + "file/screenshots/#{key}/#{gamertag}"
|
37
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
38
|
+
Reach::Helper::convert_keys(data)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Public: Fetches a list of file sets belonging
|
42
|
+
# to a player
|
43
|
+
#
|
44
|
+
# gamertag - the player to get a list of file sets for
|
45
|
+
#
|
46
|
+
# Returns a hash
|
47
|
+
def get_player_file_sets(gamertag)
|
48
|
+
gamertag = gamertag.gsub(' ', '%20')
|
49
|
+
uri = ENDPOINT + "file/sets/#{key}/#{gamertag}"
|
50
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
51
|
+
Reach::Helper::convert_keys(data)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Public: Fetches a list of files in a player's
|
55
|
+
# file set
|
56
|
+
#
|
57
|
+
# gamertag - the specified player
|
58
|
+
# id - the fileset ID
|
59
|
+
#
|
60
|
+
# Returns a hash
|
61
|
+
def get_player_file_set_files(gamertag, id)
|
62
|
+
gamertag = gamertag.gsub(' ', '%20')
|
63
|
+
uri = ENDPOINT + "file/sets/files/#{key}/#{gamertag}/#{id}"
|
64
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
65
|
+
Reach::Helper::convert_keys(data)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Public: Fetches a list of rendered videos
|
69
|
+
# belonging to a player
|
70
|
+
#
|
71
|
+
# gamertag - the specified player
|
72
|
+
# page - an optional page of results to fetch
|
73
|
+
#
|
74
|
+
# Returns a hash
|
75
|
+
def get_player_rendered_videos(gamertag, page = 0)
|
76
|
+
gamertag = gamertag.gsub(' ', '%20')
|
77
|
+
uri = ENDPOINT + "file/videos/#{key}/#{gamertag}/#{page}"
|
78
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
79
|
+
Reach::Helper::convert_keys(data)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Public: Fetches a listing of files matching search criteria
|
83
|
+
#
|
84
|
+
# file_category - the type of file to search for
|
85
|
+
# map_filter - an map to limit results
|
86
|
+
# engine_filter - an game engine type to limit results
|
87
|
+
# date_filter - a required date filter
|
88
|
+
# sort_filter - a required sort parameter
|
89
|
+
# tags - a semicolon-delimited list of tags to search for
|
90
|
+
# page - the page of results to fetch
|
91
|
+
#
|
92
|
+
# Returns a hash containing search results
|
93
|
+
def reach_file_search(file_category, map_filter, engine_filter, date_filter, sort_filter, tags = '', page = 0)
|
94
|
+
uri = ENDPOINT + "file/search/#{key}/#{file_category}/#{map_filter}/#{engine_filter}/#{date_filter}/#{sort_filter}/#{page}?tags=#{tags}"
|
95
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
96
|
+
Reach::Helper::convert_keys(data)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Reach
|
2
|
+
class API
|
3
|
+
module Game
|
4
|
+
|
5
|
+
# Public: Fetches metadata dictionaries
|
6
|
+
#
|
7
|
+
# Returns a hash
|
8
|
+
def get_game_metadata
|
9
|
+
uri = ENDPOINT + "game/metadata/#{key}"
|
10
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
11
|
+
Reach::Helper::convert_keys(data)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Public: Fetches detailed game information
|
15
|
+
#
|
16
|
+
# id - the ID of the game to get details for
|
17
|
+
#
|
18
|
+
# Returns a hash
|
19
|
+
def get_game_details(id)
|
20
|
+
uri = ENDPOINT + "game/details/#{key}/#{id}"
|
21
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
22
|
+
Reach::Helper::convert_keys(data)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Public: Fetches current challenges
|
26
|
+
#
|
27
|
+
# gamertag - optional gamertag to get
|
28
|
+
# challenge progress for
|
29
|
+
#
|
30
|
+
# Returns a hash
|
31
|
+
def get_current_challenges(gamertag = nil)
|
32
|
+
if gamertag
|
33
|
+
gamertag = gamertag.gsub(' ', '%20')
|
34
|
+
uri = ENDPOINT + "game/metadata/#{key}/#{gamertag}"
|
35
|
+
else
|
36
|
+
uri = ENDPOINT + "game/metadata/#{key}"
|
37
|
+
end
|
38
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
39
|
+
Reach::Helper::convert_keys(data)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Reach
|
2
|
+
class API
|
3
|
+
module Player
|
4
|
+
|
5
|
+
# Public: Fetches a player's list of games
|
6
|
+
# in reverse chronological order
|
7
|
+
#
|
8
|
+
# gamertag - player to fetch game history for
|
9
|
+
# variant - which game type to look for ("Unknown" returns all)
|
10
|
+
# page - which page of results to get (pages of 25)
|
11
|
+
#
|
12
|
+
# Returns a hash
|
13
|
+
def get_game_history(gamertag, variant = "Unknown", page = 0)
|
14
|
+
gamertag = gamertag.gsub(' ', '%20')
|
15
|
+
uri = ENDPOINT + "player/gamehistory/#{key}/#{gamertag}/#{variant}/#{page}"
|
16
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
17
|
+
Reach::Helper::convert_keys(data)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Public: Fetches detailed player info, sorted
|
21
|
+
# by map
|
22
|
+
#
|
23
|
+
# gamertag - player to get information about
|
24
|
+
#
|
25
|
+
# Returns a hash
|
26
|
+
def get_player_details_with_stats_by_map(gamertag)
|
27
|
+
gamertag = gamertag.gsub(' ', '%20')
|
28
|
+
uri = ENDPOINT + "player/details/bymap/#{key}/#{gamertag}"
|
29
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
30
|
+
Reach::Helper::convert_keys(data)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Public: Fetches detailed player info, sorted
|
34
|
+
# by playlist
|
35
|
+
#
|
36
|
+
# gamertag - player to get information about
|
37
|
+
#
|
38
|
+
# Returns a hash
|
39
|
+
def get_player_details_with_stats_by_playlist(gamertag)
|
40
|
+
gamertag = gamertag.gsub(' ', '%20')
|
41
|
+
uri = ENDPOINT + "player/details/byplaylist/#{key}/#{gamertag}"
|
42
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
43
|
+
Reach::Helper::convert_keys(data)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Public: Fetches basic player information
|
47
|
+
#
|
48
|
+
# gamertag - player to get information about
|
49
|
+
#
|
50
|
+
# Returns a hash
|
51
|
+
def get_player_details_with_no_stats(gamertag)
|
52
|
+
gamertag = gamertag.gsub(' ', '%20')
|
53
|
+
uri = ENDPOINT + "player/details/nostats/#{key}/#{gamertag}"
|
54
|
+
data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)
|
55
|
+
Reach::Helper::convert_keys(data)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/reach/helper.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
module Reach
|
2
|
+
class Helper
|
3
|
+
|
4
|
+
# Public: Converts a string or key from CamelCase to snake_case
|
5
|
+
#
|
6
|
+
# value - the string or key to be converted
|
7
|
+
#
|
8
|
+
# Example:
|
9
|
+
#
|
10
|
+
# Reach::Helper::to_snake_case("CamelCase")
|
11
|
+
# #=> "camel_case"
|
12
|
+
#
|
13
|
+
# Reach::Helper::to_snake_case(:CamelCase)
|
14
|
+
# #=> :camel_case
|
15
|
+
#
|
16
|
+
# Returns the snake_cased string or key
|
17
|
+
def self.to_snake_case(value)
|
18
|
+
case value
|
19
|
+
when Symbol
|
20
|
+
lowercase(value.to_s).to_sym
|
21
|
+
when String
|
22
|
+
lowercase(value)
|
23
|
+
else
|
24
|
+
false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Public: Converts a hash or array's keys from CamelCase to snake_case
|
29
|
+
#
|
30
|
+
# value - the hash or array to have it's keys converted
|
31
|
+
#
|
32
|
+
# Example:
|
33
|
+
#
|
34
|
+
# Reach::Helper::to_snake_case({:hashKey => "hashValue"})
|
35
|
+
# #=> {:hash_key => "hashValue"}
|
36
|
+
#
|
37
|
+
# Returns the hash/array with snake_case'd keys
|
38
|
+
def self.convert_keys(value)
|
39
|
+
case value
|
40
|
+
when Array
|
41
|
+
value.map(&method(:convert_keys))
|
42
|
+
when Hash
|
43
|
+
Hash[value.map { |k, v| [to_snake_case(k), convert_keys(v)] }]
|
44
|
+
else
|
45
|
+
value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
# Private: Converts a string from CamelCase to snake_case
|
52
|
+
#
|
53
|
+
# string - the string to be converted
|
54
|
+
#
|
55
|
+
# Returns the snake_cased string
|
56
|
+
def self.lowercase(string)
|
57
|
+
string.gsub(/::/, '/').
|
58
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
59
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
60
|
+
tr("-", "_").
|
61
|
+
downcase
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Reach
|
2
|
+
class Version
|
3
|
+
|
4
|
+
# The current major version number
|
5
|
+
#
|
6
|
+
# Returns an int
|
7
|
+
def self.major
|
8
|
+
1
|
9
|
+
end
|
10
|
+
|
11
|
+
# The current minor version number
|
12
|
+
#
|
13
|
+
# Returns an int
|
14
|
+
def self.minor
|
15
|
+
0
|
16
|
+
end
|
17
|
+
|
18
|
+
# The current patch version number
|
19
|
+
#
|
20
|
+
# Returns an int
|
21
|
+
def self.patch
|
22
|
+
0
|
23
|
+
end
|
24
|
+
|
25
|
+
# The current pre version number
|
26
|
+
#
|
27
|
+
# Returns an int
|
28
|
+
def self.pre
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
32
|
+
# Bundles up the version number into a string
|
33
|
+
#
|
34
|
+
# Returns the current version number as a string
|
35
|
+
def self.to_s
|
36
|
+
[major, minor, patch, pre].compact.join('.')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/reach-api.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path '../lib/reach/version', __FILE__
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "reach-api"
|
6
|
+
gem.version = Reach::Version.to_s
|
7
|
+
gem.authors = ["Andrew Stewart"]
|
8
|
+
gem.email = ["andrew@averagestudios.com"]
|
9
|
+
gem.homepage = "https://github.com/stewart/reach-api"
|
10
|
+
gem.summary = %q{A wrapper for the Halo Reach stats API}
|
11
|
+
gem.description = %q{A Ruby wrapper for Bungie's Halo Reach
|
12
|
+
stats API. Returns all API responses as
|
13
|
+
Ruby hashes.}
|
14
|
+
|
15
|
+
gem.rubyforge_project = "reach-api"
|
16
|
+
|
17
|
+
gem.files = `git ls-files`.split("\n")
|
18
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
gem.require_paths = ["lib"]
|
21
|
+
|
22
|
+
gem.add_dependency "httparty", "~> 0.8.1"
|
23
|
+
gem.add_dependency "json", "~> 1.6.5"
|
24
|
+
|
25
|
+
gem.add_development_dependency "guard-rspec", "~> 0.6.0"
|
26
|
+
gem.add_development_dependency "simplecov", "~> 0.5.4"
|
27
|
+
gem.add_development_dependency "rspec", "~> 2.8.0"
|
28
|
+
gem.add_development_dependency "guard", "~> 1.0.0"
|
29
|
+
gem.add_development_dependency "rake", "~> 0.9.2.2"
|
30
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# reach-api
|
2
|
+
|
3
|
+
A Ruby wrapper for the Halo Reach stats API.
|
4
|
+
|
5
|
+
## installation
|
6
|
+
|
7
|
+
[sudo] gem install reach-api
|
8
|
+
|
9
|
+
## usage
|
10
|
+
|
11
|
+
You'll need a Bungie-provided [API key][key]:
|
12
|
+
|
13
|
+
require "reach-api"
|
14
|
+
reach = Reach.new("your_key")
|
15
|
+
|
16
|
+
For information on API methods, please refer to the [wiki][].
|
17
|
+
|
18
|
+
## contributing
|
19
|
+
|
20
|
+
1. Fork it
|
21
|
+
2. Create a feature branch - `git checkout -b new_feature`
|
22
|
+
3. Commit your changes - `git commit -m "Added new feature"`
|
23
|
+
4. Push to GitHub - `git push origin new_feature`
|
24
|
+
5. Create a new Pull Request
|
25
|
+
|
26
|
+
## copyright
|
27
|
+
|
28
|
+
Copyright (c) 2012 Andrew Stewart. See `LICENSE` for more details
|
29
|
+
|
30
|
+
[key]: http://www.bungie.net/fanclub/statsapi/Group/GroupHome.aspx
|
31
|
+
[wiki]: http://www.haloreachapi.net/wiki/Main_Page
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "helper"
|
2
|
+
|
3
|
+
describe Reach::API do
|
4
|
+
it "should store an API key on creation" do
|
5
|
+
reach = Reach.new("example_api_key")
|
6
|
+
reach.key.should == "example_api_key"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should contain an API endpoint" do
|
10
|
+
Reach::API::ENDPOINT.should == "http://www.bungie.net/api/reach/reachapijson.svc/"
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "helper"
|
2
|
+
|
3
|
+
describe Reach::Helper do
|
4
|
+
context "converting strings/symbols from CamelCase to snake_case" do
|
5
|
+
it "shouldn't modify a snake_cased string" do
|
6
|
+
Reach::Helper::to_snake_case("snake_case").should == "snake_case"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should convert a basic string" do
|
10
|
+
Reach::Helper::to_snake_case("CamelCase").should == "camel_case"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should convert a string containing '::'" do
|
14
|
+
Reach::Helper::to_snake_case("Module::Class").should == "module/class"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should convert a string containing a hypen '-'" do
|
18
|
+
Reach::Helper::to_snake_case("Here-Say").should == "here_say"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should convert a symbol" do
|
22
|
+
Reach::Helper::to_snake_case(:CamelCase).should == :camel_case
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should return false on anything else" do
|
26
|
+
Reach::Helper::to_snake_case({:hashKey => "hashvalue"}).should == false
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "converting hash/array keys from CamelCase to snake_case" do
|
31
|
+
it "should convert hash keys" do
|
32
|
+
hash = {:hashKey => "hashValue"}
|
33
|
+
Reach::Helper::convert_keys(hash).should == {:hash_key => "hashValue"}
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should convert hash keys inside arrays" do
|
37
|
+
array = [{:hashKey => "hashValue"}]
|
38
|
+
Reach::Helper::convert_keys(array).should == [{:hash_key => "hashValue"}]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: reach-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andrew Stewart
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-28 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: httparty
|
16
|
+
requirement: &70145548992020 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.8.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70145548992020
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: json
|
27
|
+
requirement: &70145548991220 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.6.5
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70145548991220
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: guard-rspec
|
38
|
+
requirement: &70145548990280 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.6.0
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70145548990280
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: simplecov
|
49
|
+
requirement: &70145548989140 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.5.4
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70145548989140
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec
|
60
|
+
requirement: &70145548988620 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.8.0
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70145548988620
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard
|
71
|
+
requirement: &70145548987980 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.0.0
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70145548987980
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rake
|
82
|
+
requirement: &70145548987520 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.9.2.2
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70145548987520
|
91
|
+
description: ! "A Ruby wrapper for Bungie's Halo Reach\n stats
|
92
|
+
API. Returns all API responses as\n Ruby hashes."
|
93
|
+
email:
|
94
|
+
- andrew@averagestudios.com
|
95
|
+
executables: []
|
96
|
+
extensions: []
|
97
|
+
extra_rdoc_files: []
|
98
|
+
files:
|
99
|
+
- .gitignore
|
100
|
+
- .rvmrc
|
101
|
+
- .travis.yml
|
102
|
+
- Gemfile
|
103
|
+
- Guardfile
|
104
|
+
- Rakefile
|
105
|
+
- lib/reach-api.rb
|
106
|
+
- lib/reach/api.rb
|
107
|
+
- lib/reach/api/file.rb
|
108
|
+
- lib/reach/api/game.rb
|
109
|
+
- lib/reach/api/player.rb
|
110
|
+
- lib/reach/helper.rb
|
111
|
+
- lib/reach/version.rb
|
112
|
+
- reach-api.gemspec
|
113
|
+
- readme.md
|
114
|
+
- spec/cases/api_spec.rb
|
115
|
+
- spec/cases/helper_spec.rb
|
116
|
+
- spec/cases/version_spec.rb
|
117
|
+
- spec/helper.rb
|
118
|
+
homepage: https://github.com/stewart/reach-api
|
119
|
+
licenses: []
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project: reach-api
|
138
|
+
rubygems_version: 1.8.10
|
139
|
+
signing_key:
|
140
|
+
specification_version: 3
|
141
|
+
summary: A wrapper for the Halo Reach stats API
|
142
|
+
test_files:
|
143
|
+
- spec/cases/api_spec.rb
|
144
|
+
- spec/cases/helper_spec.rb
|
145
|
+
- spec/cases/version_spec.rb
|
146
|
+
- spec/helper.rb
|