xbox_leaders 1.1.0 → 2.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/xbox_leaders/api.rb +5 -5
- data/lib/xbox_leaders/version.rb +1 -1
- data/spec/xbox_leaders/api_spec.rb +10 -10
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6868953a2d45dcfbd67dda2e228866ddadb45a37
|
|
4
|
+
data.tar.gz: a748f44b54eb858144d9cfe2ed574aca48dce1bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 521e1108cb88177414c261a799776100b37561017d4fff6c96be6692200e950b374c78d7fb8c59de3bb28ab02a52c9fe923c854b718057921724e3188352f683
|
|
7
|
+
data.tar.gz: fddf8984fbee43178d41c63584ba7a7866ee2255bad798a8695e2ccc4ffd64139388b82f7b34fd80faa2191fea0a1ca63fb38257b08958c825d8bed7ca7acc9b
|
data/Gemfile.lock
CHANGED
data/lib/xbox_leaders/api.rb
CHANGED
|
@@ -3,11 +3,11 @@ require 'httparty'
|
|
|
3
3
|
class XboxLeaders::Api
|
|
4
4
|
|
|
5
5
|
include HTTParty
|
|
6
|
-
base_uri 'https://www.xboxleaders.com/api/
|
|
6
|
+
base_uri 'https://www.xboxleaders.com/api/2.0'
|
|
7
7
|
|
|
8
8
|
attr_accessor :timeout
|
|
9
9
|
|
|
10
|
-
def initialize(timeout
|
|
10
|
+
def initialize(timeout = 6)
|
|
11
11
|
@timeout = timeout
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -32,11 +32,11 @@ class XboxLeaders::Api
|
|
|
32
32
|
def get(path, query={})
|
|
33
33
|
response = self.class.get(path + ".json", timeout: timeout, query: query).to_hash
|
|
34
34
|
|
|
35
|
-
if
|
|
36
|
-
raise ArgumentError,
|
|
35
|
+
if response['status'] == 'error'
|
|
36
|
+
raise ArgumentError, "#{response['data']['code']}: #{response['data']['message']}"
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
response['
|
|
39
|
+
response['data']
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
end
|
data/lib/xbox_leaders/version.rb
CHANGED
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
|
3
3
|
describe XboxLeaders::Api do
|
|
4
4
|
describe '#initialize' do
|
|
5
5
|
it 'allows a specified timeout in seconds' do
|
|
6
|
-
api = XboxLeaders::Api.new(
|
|
6
|
+
api = XboxLeaders::Api.new(10)
|
|
7
7
|
api.timeout.should == 10
|
|
8
8
|
end
|
|
9
9
|
|
|
@@ -16,28 +16,28 @@ describe XboxLeaders::Api do
|
|
|
16
16
|
context 'making requests' do
|
|
17
17
|
it 'validates the gamertag' do
|
|
18
18
|
api = XboxLeaders::Api.new
|
|
19
|
-
lambda { api.fetch_profile('
|
|
19
|
+
lambda { api.fetch_profile('Major Nelson') }.should_not raise_exception
|
|
20
20
|
lambda { api.fetch_profile('fajdkfjdife99fgsd<F2>') }.should raise_exception
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it 'fetches a profile' do
|
|
24
|
-
response = XboxLeaders::Api.new.fetch_profile('
|
|
25
|
-
response['
|
|
24
|
+
response = XboxLeaders::Api.new.fetch_profile('Major Nelson')
|
|
25
|
+
response['gamertag'].should == 'Major Nelson'
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it 'fetches a list of games' do
|
|
29
|
-
response = XboxLeaders::Api.new.fetch_games('
|
|
30
|
-
response['
|
|
29
|
+
response = XboxLeaders::Api.new.fetch_games('Major Nelson')
|
|
30
|
+
response['games'].count.should be > 0
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
it 'fetches a list of achievements' do
|
|
34
|
-
response = XboxLeaders::Api.new.fetch_achievements('
|
|
35
|
-
response['
|
|
34
|
+
response = XboxLeaders::Api.new.fetch_achievements('Major Nelson', '1297287449')
|
|
35
|
+
response['game'].should_not be_nil
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
it 'fetches a list of friends' do
|
|
39
|
-
response = XboxLeaders::Api.new.fetch_friends('
|
|
40
|
-
response['
|
|
39
|
+
response = XboxLeaders::Api.new.fetch_friends('Major Nelson')
|
|
40
|
+
response['total'].should be > 0
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xbox_leaders
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brandon Rice
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-10-
|
|
11
|
+
date: 2013-10-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|