scoreoid 1.1.0 → 1.1.2
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 +7 -0
- data/.travis.yml +2 -0
- data/CHANGES.md +5 -0
- data/Gemfile +6 -2
- data/README.md +42 -18
- data/lib/scoreoid/api.rb +19 -5
- data/lib/scoreoid/player.rb +141 -4
- data/lib/scoreoid/version.rb +1 -1
- data/scoreoid.gemspec +2 -0
- data/spec/{api_spec.rb → scoreoid/api_spec.rb} +9 -0
- data/spec/scoreoid/player_spec.rb +73 -0
- data/spec/scoreoid/version_spec.rb +9 -0
- metadata +23 -31
- data/spec/player_spec.rb +0 -20
- data/spec/version_spec.rb +0 -7
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 755a8d3ea357e52d4a9a5896c0758c066fdab338a4418092feda961f267043fb
|
4
|
+
data.tar.gz: d6c4ff91047f9e0d8f2cfbcbaa6f3028e3ca52e55aa7ebd85a39e103950e49f4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7b4ecbfa30377aea2a5365d126e74de10ef3440d7f64ede50d34408335f9afe0a34b1ccb088dc633b6fbf047039f7e7b9851ab11d2868804d05bfc865e185ff1
|
7
|
+
data.tar.gz: 1110618c570b362f8883710942a4213ddd6444384794b699faa1b8e3df46e0bd421dc66cb793c2792e935bc125954455647e25959195a30fd6b05d9299de381e
|
data/.travis.yml
ADDED
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,62 +1,79 @@
|
|
1
|
+
## NOTICE: Project is unmaintained because the Scoroid API no longer exists.
|
2
|
+
|
3
|
+
This repository is left for historical reasons.
|
4
|
+
|
1
5
|
Scoreoid Ruby
|
2
6
|
=============
|
3
7
|
|
8
|
+
[](https://travis-ci.org/xtagon/scoreoid-gem)
|
9
|
+
|
4
10
|
Summary
|
5
11
|
-------
|
6
12
|
|
7
|
-
Scoreoid Ruby is a wrapper for the [Scoreoid]
|
13
|
+
Scoreoid Ruby is a wrapper for the [Scoreoid][1] API.
|
8
14
|
|
9
15
|
Installation
|
10
16
|
------------
|
11
17
|
|
12
18
|
Add this line to your application's Gemfile:
|
13
19
|
|
14
|
-
|
20
|
+
``` ruby
|
21
|
+
gem 'scoreoid'
|
22
|
+
```
|
15
23
|
|
16
24
|
And then execute:
|
17
25
|
|
18
|
-
|
26
|
+
``` shell
|
27
|
+
$ bundle
|
28
|
+
```
|
19
29
|
|
20
30
|
Or install it yourself as:
|
21
31
|
|
22
|
-
|
32
|
+
``` shell
|
33
|
+
$ gem install scoreoid
|
34
|
+
```
|
23
35
|
|
24
36
|
Usage
|
25
37
|
-----
|
26
38
|
|
27
|
-
Full documentation is [available online]
|
39
|
+
Full documentation is [available online][2].
|
28
40
|
|
29
41
|
To get started, configure Scoreoid Ruby with your API key and game ID:
|
30
42
|
|
31
|
-
|
32
|
-
|
33
|
-
|
43
|
+
``` ruby
|
44
|
+
require 'scoreoid'
|
45
|
+
|
46
|
+
Scoreoid.configure(api_key: 'YOUR_API_KEY', game_id: 'YOUR_GAME_ID')
|
47
|
+
```
|
34
48
|
|
35
49
|
Then you can start querying Scoreoid API methods:
|
36
50
|
|
37
|
-
|
51
|
+
``` ruby
|
52
|
+
new_players_count = Scoreoid::API.query('countPlayers', start_date: '2009-08-04')
|
53
|
+
new_players_count['players'] # => 34
|
54
|
+
```
|
55
|
+
|
56
|
+
Any Scoreoid API method may be called in this manner. See the [Scoreoid Wiki][3] for information on available API methods.
|
38
57
|
|
39
|
-
|
58
|
+
Future versions of Scoreoid Ruby will provide a more object-oriented manner of querying data. Then it will look more like this:
|
40
59
|
|
41
|
-
|
60
|
+
``` ruby
|
61
|
+
Scoreoid::Player.count # => 34
|
62
|
+
```
|
42
63
|
|
43
64
|
Contributing
|
44
65
|
------------
|
45
66
|
|
46
67
|
Contributions are most welcome!
|
47
68
|
|
48
|
-
|
49
|
-
2. Create your feature branch (`git checkout -b feature/my-new-feature`)
|
50
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
51
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
52
|
-
5. Create new Pull Request
|
69
|
+
You can fork the source code on [GitHub][4] or [BitBucket][5].
|
53
70
|
|
54
|
-
Please use the [issue tracker]
|
71
|
+
Please use the [issue tracker][6] if you encounter a bug or have a feature request.
|
55
72
|
|
56
73
|
License
|
57
74
|
-------
|
58
75
|
|
59
|
-
Copyright © 2012 [Justin Workman](mailto:xtagon@gmail.com)
|
76
|
+
Copyright © 2012-2013 [Justin Workman](mailto:xtagon@gmail.com)
|
60
77
|
|
61
78
|
MIT License
|
62
79
|
|
@@ -78,3 +95,10 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
78
95
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
79
96
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
80
97
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
98
|
+
|
99
|
+
[1]: https://rubygems.org/gems/scoreoid
|
100
|
+
[2]: http://rubydoc.info/gems/scoreoid/frames
|
101
|
+
[3]: http://wiki.scoreoid.net/category/api/
|
102
|
+
[4]: https://github.com/xtagon/scoreoid-gem
|
103
|
+
[5]: https://bitbucket.org/xtagon/scoreoid-gem
|
104
|
+
[6]: https://github.com/xtagon/scoreoid-gem/issues
|
data/lib/scoreoid/api.rb
CHANGED
@@ -9,6 +9,11 @@ module Scoreoid
|
|
9
9
|
# A singleton class with methods for querying the Scoreoid API.
|
10
10
|
class API
|
11
11
|
class << self
|
12
|
+
# Default API request parameters used by {.query}
|
13
|
+
#
|
14
|
+
# This would normally be set with {Scoreoid.configure}
|
15
|
+
attr_accessor :default_params
|
16
|
+
|
12
17
|
# Query a given Scoreoid API method and return the repsonse as a string.
|
13
18
|
#
|
14
19
|
# Supplied parameters will be prepared with {.prepare_params} before sending.
|
@@ -35,18 +40,32 @@ module Scoreoid
|
|
35
40
|
# @param [Hash] params Parameters to include in the API request.
|
36
41
|
#
|
37
42
|
# @raise [Scoreoid::APIError] if the Scoreoid API returns an error response.
|
43
|
+
# @raise [MultiJson::DecodeError] if the Scoreoid API response can't be parsed
|
44
|
+
# (report a bug if this happens!)
|
38
45
|
#
|
39
46
|
# @return [Hash] The Scoreoid API response parsed into a Hash.
|
40
47
|
#
|
41
48
|
# @see .query
|
42
49
|
def query_and_parse(api_method, params={})
|
50
|
+
# We're gonna parse JSON, so ask for JSON
|
43
51
|
params = params.merge(response: 'json')
|
44
52
|
|
53
|
+
# Query Scoreoid
|
45
54
|
api_response = self.query(api_method, params)
|
55
|
+
|
56
|
+
# Fix for API responses that return arrays (they can't be parsed by MultiJson)
|
57
|
+
if api_response =~ /\A\[/ and api_response =~ /\]\Z/
|
58
|
+
api_response.sub!(/\A\[/, '') # Remove leading bracket
|
59
|
+
api_response.sub!(/\]\Z/, '') # Remove trailing bracket
|
60
|
+
end
|
61
|
+
|
62
|
+
# Parse the response
|
46
63
|
parsed_result = MultiJson.load(api_response)
|
47
64
|
|
65
|
+
# Raise an error if the response JSON contained one
|
48
66
|
raise APIError, parsed_result['error'] if parsed_result.key? 'error'
|
49
67
|
|
68
|
+
# Return the parsed result
|
50
69
|
parsed_result
|
51
70
|
end
|
52
71
|
|
@@ -75,11 +94,6 @@ module Scoreoid
|
|
75
94
|
end
|
76
95
|
params
|
77
96
|
end
|
78
|
-
|
79
|
-
# Default API request parameters used by {.query}
|
80
|
-
#
|
81
|
-
# This would normally be set with {Scoreoid.configure}
|
82
|
-
attr_accessor :default_params
|
83
97
|
end
|
84
98
|
end
|
85
99
|
end
|
data/lib/scoreoid/player.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Scoreoid
|
2
2
|
# Represents the game players.
|
3
3
|
class Player
|
4
|
-
# Get the number of players for
|
4
|
+
# Get the number of players for a game.
|
5
5
|
#
|
6
6
|
# @example Count the total number of players
|
7
7
|
# puts "This game has #{Scoreoid::Player.count} total players."
|
@@ -10,13 +10,150 @@ module Scoreoid
|
|
10
10
|
# count = Scoreoid::Player.count(start_date: '2012-11-01')
|
11
11
|
# puts "There are #{count} new players since 2012-11-01."
|
12
12
|
#
|
13
|
-
# @param [Hash] params
|
14
|
-
#
|
15
|
-
#
|
13
|
+
# @param [Hash] params Parameters to include in the API request.
|
14
|
+
# Default parameters set with {Scoreoid.configure} will be included for you.
|
15
|
+
#
|
16
|
+
# @option params [String] :api_key Your Scoreoid API key
|
17
|
+
# @option params [String] :game_id The game ID
|
18
|
+
# @option params [Date, Time, String] :start_date optional
|
19
|
+
# @option params [Date, Time, String] :end_date optional
|
16
20
|
#
|
17
21
|
# @return [Integer] The number of players.
|
18
22
|
def self.count(params={})
|
19
23
|
Scoreoid::API.query_and_parse('countPlayers', params)['players']
|
20
24
|
end
|
25
|
+
|
26
|
+
# Create a new player for a game.
|
27
|
+
#
|
28
|
+
# @example Create a player named Bob
|
29
|
+
# Scoreoid::Player.create(username: 'bob', first_name: 'Bob', last_name: 'Ross')
|
30
|
+
#
|
31
|
+
# @param [Hash] params Parameters to include in the API request.
|
32
|
+
# Default parameters set with {Scoreoid.configure} will be included for you.
|
33
|
+
#
|
34
|
+
# @option params [String] :api_key Your Scoreoid API key
|
35
|
+
# @option params [String] :game_id The game ID
|
36
|
+
# @option params [String] :username The player's username (required)
|
37
|
+
# @option params [String] :password Optional
|
38
|
+
# @option params [String] :score optional
|
39
|
+
# @option params [String] :difficulty optional
|
40
|
+
# @option params [String] :unique_id optional
|
41
|
+
# @option params [String] :first_name optional
|
42
|
+
# @option params [String] :last_name optional
|
43
|
+
# @option params [String] :email optional
|
44
|
+
# @option params [String] :created optional
|
45
|
+
# @option params [String] :updated optional
|
46
|
+
# @option params [String] :bonus optional
|
47
|
+
# @option params [String] :achievements optional
|
48
|
+
# @option params [String] :best_score optional
|
49
|
+
# @option params [String] :gold optional
|
50
|
+
# @option params [String] :money optional
|
51
|
+
# @option params [String] :kills optional
|
52
|
+
# @option params [String] :lives optional
|
53
|
+
# @option params [String] :time_played optional
|
54
|
+
# @option params [String] :unlocked_levels optional
|
55
|
+
# @option params [String] :unlocked_items optional
|
56
|
+
# @option params [String] :inventory optional
|
57
|
+
# @option params [String] :last_level optional
|
58
|
+
# @option params [String] :current_level optional
|
59
|
+
# @option params [String] :current_time optional
|
60
|
+
# @option params [String] :current_bonus optional
|
61
|
+
# @option params [String] :current_kills optional
|
62
|
+
# @option params [String] :current_achievements optional
|
63
|
+
# @option params [String] :current_gold optional
|
64
|
+
# @option params [String] :current_unlocked_levels optional
|
65
|
+
# @option params [String] :current_unlocked_items optional
|
66
|
+
# @option params [String] :current_lives optional
|
67
|
+
# @option params [String] :xp optional
|
68
|
+
# @option params [String] :energy optional
|
69
|
+
# @option params [String] :boost optional
|
70
|
+
# @option params [String] :latitude optional
|
71
|
+
# @option params [String] :longitude optional
|
72
|
+
# @option params [String] :game_state optional
|
73
|
+
# @option params [String] :platform optional
|
74
|
+
#
|
75
|
+
# @raise [Scoreoid::APIError] if the player could not be created
|
76
|
+
#
|
77
|
+
# @return [Hash] The API response from Scoreoid (should contain a success message)
|
78
|
+
def self.create(params={})
|
79
|
+
Scoreoid::API.query_and_parse('createPlayer', params)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Edit player information.
|
83
|
+
#
|
84
|
+
# @example Update John's first and last name
|
85
|
+
# Scoreoid::Player.edit(username: 'john', first_name: 'John', last_name: 'Dough')
|
86
|
+
#
|
87
|
+
# @param [Hash] params Parameters to include in the API request.
|
88
|
+
# Default parameters set with {Scoreoid.configure} will be included for you.
|
89
|
+
#
|
90
|
+
# @option params [String] :api_key Your Scoreoid API key
|
91
|
+
# @option params [String] :game_id The game ID
|
92
|
+
# @option params [String] :username The player's username (required)
|
93
|
+
# @option params [String] :password Optional
|
94
|
+
# @option params [String] :score optional
|
95
|
+
# @option params [String] :difficulty optional
|
96
|
+
# @option params [String] :unique_id optional
|
97
|
+
# @option params [String] :first_name optional
|
98
|
+
# @option params [String] :last_name optional
|
99
|
+
# @option params [String] :email optional
|
100
|
+
# @option params [String] :created optional
|
101
|
+
# @option params [String] :updated optional
|
102
|
+
# @option params [String] :bonus optional
|
103
|
+
# @option params [String] :achievements optional
|
104
|
+
# @option params [String] :best_score optional
|
105
|
+
# @option params [String] :gold optional
|
106
|
+
# @option params [String] :money optional
|
107
|
+
# @option params [String] :kills optional
|
108
|
+
# @option params [String] :lives optional
|
109
|
+
# @option params [String] :time_played optional
|
110
|
+
# @option params [String] :unlocked_levels optional
|
111
|
+
# @option params [String] :unlocked_items optional
|
112
|
+
# @option params [String] :inventory optional
|
113
|
+
# @option params [String] :last_level optional
|
114
|
+
# @option params [String] :current_level optional
|
115
|
+
# @option params [String] :current_time optional
|
116
|
+
# @option params [String] :current_bonus optional
|
117
|
+
# @option params [String] :current_kills optional
|
118
|
+
# @option params [String] :current_achievements optional
|
119
|
+
# @option params [String] :current_gold optional
|
120
|
+
# @option params [String] :current_unlocked_levels optional
|
121
|
+
# @option params [String] :current_unlocked_items optional
|
122
|
+
# @option params [String] :current_lives optional
|
123
|
+
# @option params [String] :xp optional
|
124
|
+
# @option params [String] :energy optional
|
125
|
+
# @option params [String] :boost optional
|
126
|
+
# @option params [String] :latitude optional
|
127
|
+
# @option params [String] :longitude optional
|
128
|
+
# @option params [String] :game_state optional
|
129
|
+
# @option params [String] :platform optional
|
130
|
+
#
|
131
|
+
# @raise [Scoreoid::APIError] if the player could not be updated
|
132
|
+
#
|
133
|
+
# @return [Hash] The API response from Scoreoid (should contain a success message)
|
134
|
+
def self.edit(params={})
|
135
|
+
Scoreoid::API.query_and_parse('editPlayer', params)
|
136
|
+
end
|
137
|
+
|
138
|
+
# Updates a players field.
|
139
|
+
#
|
140
|
+
# @example Update John's e-mail address
|
141
|
+
# Scoreoid::Player.update_field(username: 'john', field: 'email', value: 'john@example.com')
|
142
|
+
#
|
143
|
+
# @param [Hash] params Parameters to include in the API request.
|
144
|
+
# Default parameters set with {Scoreoid.configure} will be included for you.
|
145
|
+
#
|
146
|
+
# @option params [String] :api_key Your Scoreoid API key
|
147
|
+
# @option params [String] :game_id The game ID
|
148
|
+
# @option params [String] :username The player's username (required)
|
149
|
+
# @option params [String] :field The field name to update (see {.edit})
|
150
|
+
# @option params [String] :value The value to set
|
151
|
+
#
|
152
|
+
# @raise [Scoreoid::APIError] if the field could not be updated
|
153
|
+
#
|
154
|
+
# @return [Hash] The API response from Scoreoid (should contain a success message)
|
155
|
+
def self.update_field(params={})
|
156
|
+
Scoreoid::API.query_and_parse('updatePlayerField', params)
|
157
|
+
end
|
21
158
|
end
|
22
159
|
end
|
data/lib/scoreoid/version.rb
CHANGED
data/scoreoid.gemspec
CHANGED
@@ -11,6 +11,8 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.summary = 'Scoreoid Ruby is a wrapper for the Scoreoid API.'
|
12
12
|
gem.license = 'MIT'
|
13
13
|
|
14
|
+
gem.metadata = { 'rubygems_mfa_required' => 'true' }
|
15
|
+
|
14
16
|
gem.required_ruby_version = '1.9.2'
|
15
17
|
gem.add_runtime_dependency 'chronic', '~> 0.8.0'
|
16
18
|
gem.add_runtime_dependency 'multi_json', '~> 1.3'
|
@@ -66,5 +66,14 @@ describe Scoreoid::API do
|
|
66
66
|
Scoreoid::API.query_and_parse('getScores')
|
67
67
|
end.to raise_error(Scoreoid::APIError, 'The API key is broken or the game is not active')
|
68
68
|
end
|
69
|
+
|
70
|
+
it 'should not raise an error if the the response is an array' do
|
71
|
+
example_response = %q([{"Player": {"username": "pwner"}}])
|
72
|
+
Scoreoid::API.stub(:query).and_return(example_response)
|
73
|
+
|
74
|
+
expect do
|
75
|
+
Scoreoid::API.query_and_parse('getPlayer', username: 'someuser')
|
76
|
+
end.to_not raise_error
|
77
|
+
end
|
69
78
|
end
|
70
79
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scoreoid::Player do
|
4
|
+
describe '.create' do
|
5
|
+
it 'should return true on successfully creating a player' do
|
6
|
+
success_response = %q({"success":["The player has been created"]})
|
7
|
+
params = {username: 'AzureDiamond', password: 'hunter2'}
|
8
|
+
|
9
|
+
Scoreoid::API.stub(:query_and_parse).and_return(success_response)
|
10
|
+
Scoreoid::API.should_receive(:query_and_parse).with('createPlayer', params)
|
11
|
+
|
12
|
+
expect do
|
13
|
+
Scoreoid::Player.create(params).should be_true
|
14
|
+
end.to_not raise_error
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '.count' do
|
19
|
+
it 'should count players with no query parameters' do
|
20
|
+
Scoreoid::API.stub(:query_and_parse).and_return({'players' => 7})
|
21
|
+
Scoreoid::API.should_receive(:query_and_parse).with('countPlayers', {})
|
22
|
+
count = Scoreoid::Player.count
|
23
|
+
count.should == 7
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should count players with query parameters' do
|
27
|
+
params = {start_date: '2011-11-01', end_date: Time.now}
|
28
|
+
Scoreoid::API.stub(:query_and_parse).and_return({'players' => 7})
|
29
|
+
Scoreoid::API.should_receive(:query_and_parse).with('countPlayers', params)
|
30
|
+
count = Scoreoid::Player.count(params)
|
31
|
+
count.should == 7
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '.create' do
|
36
|
+
it 'should create the player and return the parsed API response' do
|
37
|
+
success_response = {'success' => ['The player has been created']}
|
38
|
+
params = {username: 'AzureDiamond', password: 'hunter2'}
|
39
|
+
|
40
|
+
Scoreoid::API.stub(:query_and_parse).and_return(success_response)
|
41
|
+
Scoreoid::API.should_receive(:query_and_parse).with('createPlayer', params)
|
42
|
+
|
43
|
+
response = Scoreoid::Player.create(params)
|
44
|
+
response.should == success_response
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '.edit' do
|
49
|
+
it 'should edit the player and return the parsed API response' do
|
50
|
+
success_response = {'success' => ['The player has been updated']}
|
51
|
+
params = {username: 'AzureDiamond', password: '*******'}
|
52
|
+
|
53
|
+
Scoreoid::API.stub(:query_and_parse).and_return(success_response)
|
54
|
+
Scoreoid::API.should_receive(:query_and_parse).with('editPlayer', params)
|
55
|
+
|
56
|
+
response = Scoreoid::Player.edit(params)
|
57
|
+
response.should == success_response
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '.update_field' do
|
62
|
+
it 'should update the player field and return the parsed API response' do
|
63
|
+
success_response = {'success' => ['The player field last_name has been updated']}
|
64
|
+
params = {username: 'john', field: 'last_name', value: 'Doe'}
|
65
|
+
|
66
|
+
Scoreoid::API.stub(:query_and_parse).and_return(success_response)
|
67
|
+
Scoreoid::API.should_receive(:query_and_parse).with('updatePlayerField', params)
|
68
|
+
|
69
|
+
response = Scoreoid::Player.update_field(params)
|
70
|
+
response.should == success_response
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Scoreoid do
|
4
|
+
it 'has a valid version constant' do
|
5
|
+
# This regex is far from perfect, but it should keep me from accidentally
|
6
|
+
# doing something stupid to the version.
|
7
|
+
Scoreoid::VERSION.should =~ /\A\d+\.\d+\.\d+(\.\w+)?\Z/
|
8
|
+
end
|
9
|
+
end
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scoreoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Justin Workman
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2022-07-15 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: chronic
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 0.8.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.8.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: multi_json
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '1.3'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '1.3'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rest-client
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '1.6'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '1.6'
|
62
55
|
description:
|
@@ -65,9 +58,10 @@ executables: []
|
|
65
58
|
extensions: []
|
66
59
|
extra_rdoc_files: []
|
67
60
|
files:
|
68
|
-
- .gitignore
|
69
|
-
- .rspec
|
70
|
-
- .
|
61
|
+
- ".gitignore"
|
62
|
+
- ".rspec"
|
63
|
+
- ".travis.yml"
|
64
|
+
- ".yardopts"
|
71
65
|
- CHANGES.md
|
72
66
|
- Gemfile
|
73
67
|
- LICENSE.txt
|
@@ -78,40 +72,38 @@ files:
|
|
78
72
|
- lib/scoreoid/player.rb
|
79
73
|
- lib/scoreoid/version.rb
|
80
74
|
- scoreoid.gemspec
|
81
|
-
- spec/api_spec.rb
|
82
|
-
- spec/player_spec.rb
|
75
|
+
- spec/scoreoid/api_spec.rb
|
76
|
+
- spec/scoreoid/player_spec.rb
|
77
|
+
- spec/scoreoid/version_spec.rb
|
83
78
|
- spec/scoreoid_spec.rb
|
84
79
|
- spec/spec_helper.rb
|
85
|
-
- spec/version_spec.rb
|
86
80
|
homepage:
|
87
81
|
licenses:
|
88
82
|
- MIT
|
83
|
+
metadata:
|
84
|
+
rubygems_mfa_required: 'true'
|
89
85
|
post_install_message:
|
90
86
|
rdoc_options: []
|
91
87
|
require_paths:
|
92
88
|
- lib
|
93
89
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
90
|
requirements:
|
96
91
|
- - '='
|
97
92
|
- !ruby/object:Gem::Version
|
98
93
|
version: 1.9.2
|
99
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
95
|
requirements:
|
102
|
-
- -
|
96
|
+
- - ">="
|
103
97
|
- !ruby/object:Gem::Version
|
104
98
|
version: '0'
|
105
99
|
requirements: []
|
106
|
-
|
107
|
-
rubygems_version: 1.8.24
|
100
|
+
rubygems_version: 3.3.18
|
108
101
|
signing_key:
|
109
|
-
specification_version:
|
102
|
+
specification_version: 4
|
110
103
|
summary: Scoreoid Ruby is a wrapper for the Scoreoid API.
|
111
104
|
test_files:
|
112
|
-
- spec/api_spec.rb
|
113
|
-
- spec/player_spec.rb
|
105
|
+
- spec/scoreoid/api_spec.rb
|
106
|
+
- spec/scoreoid/player_spec.rb
|
107
|
+
- spec/scoreoid/version_spec.rb
|
114
108
|
- spec/scoreoid_spec.rb
|
115
109
|
- spec/spec_helper.rb
|
116
|
-
- spec/version_spec.rb
|
117
|
-
has_rdoc:
|
data/spec/player_spec.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Scoreoid::Player do
|
4
|
-
describe '.count' do
|
5
|
-
it 'should count players with no query parameters' do
|
6
|
-
Scoreoid::API.stub(:query_and_parse).and_return({'players' => 7})
|
7
|
-
Scoreoid::API.should_receive(:query_and_parse).with('countPlayers', {})
|
8
|
-
count = Scoreoid::Player.count
|
9
|
-
count.should == 7
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should count players with query parameters' do
|
13
|
-
params = {start_date: '2011-11-01', end_date: Time.now}
|
14
|
-
Scoreoid::API.stub(:query_and_parse).and_return({'players' => 7})
|
15
|
-
Scoreoid::API.should_receive(:query_and_parse).with('countPlayers', params)
|
16
|
-
count = Scoreoid::Player.count(params)
|
17
|
-
count.should == 7
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|