xbox_leaders 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bf7dda0463634f9357d9a441f3a4f268efdef0f
4
- data.tar.gz: f8dc1ed47d924fdeac9e5f4c8bcc981589984454
3
+ metadata.gz: 6868953a2d45dcfbd67dda2e228866ddadb45a37
4
+ data.tar.gz: a748f44b54eb858144d9cfe2ed574aca48dce1bb
5
5
  SHA512:
6
- metadata.gz: 66d98be9bc9da75cd9cde06e44d3867bee7d56f38cbb6affc50fa8235dd5dd276fe2cc6be2e18a1927da1e909bde4269e4fab26f58452223be194e40c950ae88
7
- data.tar.gz: f3565d79a76a4c58c1869092227463c9c2b80791d881a2f4581d1763bc5095de3e91bc4e0e15f1e7ea573a662132fc6bf4849030bb58704523d9a7a9eab58c0d
6
+ metadata.gz: 521e1108cb88177414c261a799776100b37561017d4fff6c96be6692200e950b374c78d7fb8c59de3bb28ab02a52c9fe923c854b718057921724e3188352f683
7
+ data.tar.gz: fddf8984fbee43178d41c63584ba7a7866ee2255bad798a8695e2ccc4ffd64139388b82f7b34fd80faa2191fea0a1ca63fb38257b08958c825d8bed7ca7acc9b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xbox_leaders (1.1.0)
4
+ xbox_leaders (2.0.0)
5
5
  httparty
6
6
 
7
7
  GEM
@@ -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/1.0'
6
+ base_uri 'https://www.xboxleaders.com/api/2.0'
7
7
 
8
8
  attr_accessor :timeout
9
9
 
10
- def initialize(timeout: 6)
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 error = response['Error']
36
- raise ArgumentError, error
35
+ if response['status'] == 'error'
36
+ raise ArgumentError, "#{response['data']['code']}: #{response['data']['message']}"
37
37
  end
38
38
 
39
- response['Data']
39
+ response['data']
40
40
  end
41
41
 
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module XboxLeaders
2
- VERSION = '1.1.0'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -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(timeout: 10)
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('nevern02') }.should_not raise_exception
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('nevern02')
25
- response['IsValid'].should == 1
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('nevern02')
30
- response['GameCount'].should be > 0
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('nevern02', '1096157379')
35
- response['Achievements'].should_not be_nil
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('nevern02')
40
- response['Friends'].should_not be_nil
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: 1.1.0
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-03 00:00:00.000000000 Z
11
+ date: 2013-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty