xbox_leaders 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +23 -19
- data/README.md +5 -2
- data/lib/xbox_leaders/api.rb +4 -4
- data/lib/xbox_leaders/version.rb +1 -1
- data/spec/spec_helper.rb +7 -0
- data/spec/support/vcr_cassettes/achievements.yml +1314 -0
- data/spec/support/vcr_cassettes/bad_profile.yml +95 -0
- data/spec/support/vcr_cassettes/friends.yml +1121 -0
- data/spec/support/vcr_cassettes/games.yml +16027 -0
- data/spec/support/vcr_cassettes/profile.yml +116 -0
- data/spec/xbox_leaders/api_spec.rb +35 -13
- data/xbox_leaders.gemspec +2 -0
- metadata +56 -18
@@ -0,0 +1,116 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.xboxleaders.com/api/2.0/profile.json?gamertag=Major%20Nelson
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 301
|
13
|
+
message: Moved Permanently
|
14
|
+
headers:
|
15
|
+
date:
|
16
|
+
- Sat, 03 May 2014 01:57:32 GMT
|
17
|
+
server:
|
18
|
+
- Apache/2.2.22 (Ubuntu)
|
19
|
+
location:
|
20
|
+
- https://www.xboxleaders.com/api/profile.json?gamertag=Major%20Nelson
|
21
|
+
cache-control:
|
22
|
+
- max-age=0
|
23
|
+
expires:
|
24
|
+
- Sat, 03 May 2014 01:57:32 GMT
|
25
|
+
vary:
|
26
|
+
- Accept-Encoding
|
27
|
+
content-length:
|
28
|
+
- '362'
|
29
|
+
connection:
|
30
|
+
- close
|
31
|
+
content-type:
|
32
|
+
- text/html; charset=iso-8859-1
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: |
|
36
|
+
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
|
37
|
+
<html><head>
|
38
|
+
<title>301 Moved Permanently</title>
|
39
|
+
</head><body>
|
40
|
+
<h1>Moved Permanently</h1>
|
41
|
+
<p>The document has moved <a href="https://www.xboxleaders.com/api/profile.json?gamertag=Major%20Nelson">here</a>.</p>
|
42
|
+
<hr>
|
43
|
+
<address>Apache/2.2.22 (Ubuntu) Server at www.xboxleaders.com Port 443</address>
|
44
|
+
</body></html>
|
45
|
+
http_version: '1.1'
|
46
|
+
recorded_at: Sat, 03 May 2014 01:57:32 GMT
|
47
|
+
- request:
|
48
|
+
method: get
|
49
|
+
uri: https://www.xboxleaders.com/api/profile.json?gamertag=Major%20Nelson
|
50
|
+
body:
|
51
|
+
encoding: US-ASCII
|
52
|
+
string: ''
|
53
|
+
headers: {}
|
54
|
+
response:
|
55
|
+
status:
|
56
|
+
code: 200
|
57
|
+
message: OK
|
58
|
+
headers:
|
59
|
+
date:
|
60
|
+
- Sat, 03 May 2014 01:57:32 GMT
|
61
|
+
server:
|
62
|
+
- Apache/2.2.22 (Ubuntu)
|
63
|
+
x-powered-by:
|
64
|
+
- PHP/5.4.27-1+deb.sury.org~precise+1
|
65
|
+
access-control-allow-origin:
|
66
|
+
- "*"
|
67
|
+
access-control-max-age:
|
68
|
+
- '3628800'
|
69
|
+
cache-control:
|
70
|
+
- no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform
|
71
|
+
expires:
|
72
|
+
- Sat, 03 May 2014 01:57:32 GMT
|
73
|
+
pragma:
|
74
|
+
- no-cache
|
75
|
+
content-length:
|
76
|
+
- '1209'
|
77
|
+
connection:
|
78
|
+
- close
|
79
|
+
content-type:
|
80
|
+
- application/json; charset=utf-8
|
81
|
+
body:
|
82
|
+
encoding: UTF-8
|
83
|
+
string: |-
|
84
|
+
{
|
85
|
+
"status": "success",
|
86
|
+
"version": "2.0",
|
87
|
+
"data": {
|
88
|
+
"gamertag": "Major Nelson",
|
89
|
+
"tier": "gold",
|
90
|
+
"badges": {
|
91
|
+
"xboxlaunchteam": true,
|
92
|
+
"nxelaunchteam": true,
|
93
|
+
"kinectlaunchteam": true
|
94
|
+
},
|
95
|
+
"avatar": {
|
96
|
+
"full": "http://avatar.xboxlive.com/avatar/Major Nelson/avatar-body.png",
|
97
|
+
"small": "http://avatar.xboxlive.com/avatar/Major Nelson/avatarpic-s.png",
|
98
|
+
"large": "http://avatar.xboxlive.com/avatar/Major Nelson/avatarpic-l.png",
|
99
|
+
"tile": "http://avatar.xboxlive.com/avatar/Major%20Nelson/avatarpic-l.png"
|
100
|
+
},
|
101
|
+
"gamerscore": 68567,
|
102
|
+
"reputation": 20,
|
103
|
+
"presence": "Last seen 7 hours ago playing Xbox.com",
|
104
|
+
"online": false,
|
105
|
+
"motto": "Find me @majornelson",
|
106
|
+
"name": "Larry Hryb, Xbox LIVE's Major Nelson",
|
107
|
+
"location": "In your Xbox",
|
108
|
+
"biography": "Yes I work for Xbox. Please send text messages only since it's easier for me to respond. If you need help be sure to follow Xbox Support on Twitter. Twitter.com/@Xboxsupport",
|
109
|
+
"recentactivity": null,
|
110
|
+
"freshness": "new"
|
111
|
+
},
|
112
|
+
"runtime": 2.743
|
113
|
+
}
|
114
|
+
http_version: '1.1'
|
115
|
+
recorded_at: Sat, 03 May 2014 01:57:35 GMT
|
116
|
+
recorded_with: VCR 2.9.0
|
@@ -1,43 +1,65 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe XboxLeaders::Api do
|
4
|
+
let(:url) { 'https://www.xboxleaders.com/api/2.0' }
|
5
|
+
|
4
6
|
describe '#initialize' do
|
7
|
+
it 'requires a url' do
|
8
|
+
expect {
|
9
|
+
XboxLeaders::Api.new
|
10
|
+
}.to raise_error(ArgumentError)
|
11
|
+
end
|
12
|
+
|
5
13
|
it 'allows a specified timeout in seconds' do
|
6
|
-
api = XboxLeaders::Api.new(10)
|
14
|
+
api = XboxLeaders::Api.new(url, 10)
|
7
15
|
api.timeout.should == 10
|
8
16
|
end
|
9
17
|
|
10
18
|
it 'defaults to a 6-second timeout' do
|
11
|
-
api = XboxLeaders::Api.new
|
19
|
+
api = XboxLeaders::Api.new(url)
|
12
20
|
api.timeout.should == 6
|
13
21
|
end
|
14
22
|
end
|
15
23
|
|
16
24
|
context 'making requests' do
|
25
|
+
let(:api) { XboxLeaders::Api.new(url) }
|
26
|
+
|
17
27
|
it 'validates the gamertag' do
|
18
|
-
|
19
|
-
|
20
|
-
|
28
|
+
VCR.use_cassette('profile') do
|
29
|
+
lambda { api.fetch_profile('Major Nelson') }.should_not raise_exception
|
30
|
+
end
|
31
|
+
|
32
|
+
VCR.use_cassette('bad_profile') do
|
33
|
+
lambda { api.fetch_profile('fajdkfjdife99fgsd<F2>') }.should raise_exception
|
34
|
+
end
|
21
35
|
end
|
22
36
|
|
23
37
|
it 'fetches a profile' do
|
24
|
-
|
25
|
-
|
38
|
+
VCR.use_cassette('profile') do
|
39
|
+
response = api.fetch_profile('Major Nelson')
|
40
|
+
response['gamertag'].should == 'Major Nelson'
|
41
|
+
end
|
26
42
|
end
|
27
43
|
|
28
44
|
it 'fetches a list of games' do
|
29
|
-
|
30
|
-
|
45
|
+
VCR.use_cassette('games') do
|
46
|
+
response = api.fetch_games('Major Nelson')
|
47
|
+
response['games'].count.should be > 0
|
48
|
+
end
|
31
49
|
end
|
32
50
|
|
33
51
|
it 'fetches a list of achievements' do
|
34
|
-
|
35
|
-
|
52
|
+
VCR.use_cassette('achievements') do
|
53
|
+
response = api.fetch_achievements('Major Nelson', '1297287449')
|
54
|
+
response['game'].should_not be_nil
|
55
|
+
end
|
36
56
|
end
|
37
57
|
|
38
58
|
it 'fetches a list of friends' do
|
39
|
-
|
40
|
-
|
59
|
+
VCR.use_cassette('friends') do
|
60
|
+
response = api.fetch_friends('Major Nelson')
|
61
|
+
response['total'].should be > 0
|
62
|
+
end
|
41
63
|
end
|
42
64
|
end
|
43
65
|
end
|
data/xbox_leaders.gemspec
CHANGED
metadata
CHANGED
@@ -1,69 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xbox_leaders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.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:
|
11
|
+
date: 2014-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: vcr
|
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: fakeweb
|
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
|
+
- - ">="
|
67
95
|
- !ruby/object:Gem::Version
|
68
96
|
version: '0'
|
69
97
|
description: 'A wrapper for the Xbox Live API provided by Xbox Leaders: https://www.xboxleaders.com/'
|
@@ -73,11 +101,11 @@ executables: []
|
|
73
101
|
extensions: []
|
74
102
|
extra_rdoc_files: []
|
75
103
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .irbrc
|
78
|
-
- .rspec
|
79
|
-
- .ruby-gemset
|
80
|
-
- .ruby-version
|
104
|
+
- ".gitignore"
|
105
|
+
- ".irbrc"
|
106
|
+
- ".rspec"
|
107
|
+
- ".ruby-gemset"
|
108
|
+
- ".ruby-version"
|
81
109
|
- Gemfile
|
82
110
|
- Gemfile.lock
|
83
111
|
- LICENSE.txt
|
@@ -87,6 +115,11 @@ files:
|
|
87
115
|
- lib/xbox_leaders/api.rb
|
88
116
|
- lib/xbox_leaders/version.rb
|
89
117
|
- spec/spec_helper.rb
|
118
|
+
- spec/support/vcr_cassettes/achievements.yml
|
119
|
+
- spec/support/vcr_cassettes/bad_profile.yml
|
120
|
+
- spec/support/vcr_cassettes/friends.yml
|
121
|
+
- spec/support/vcr_cassettes/games.yml
|
122
|
+
- spec/support/vcr_cassettes/profile.yml
|
90
123
|
- spec/xbox_leaders/api_spec.rb
|
91
124
|
- xbox_leaders.gemspec
|
92
125
|
homepage: https://github.com/nevern02/xbox_leaders
|
@@ -99,20 +132,25 @@ require_paths:
|
|
99
132
|
- lib
|
100
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
134
|
requirements:
|
102
|
-
- -
|
135
|
+
- - ">="
|
103
136
|
- !ruby/object:Gem::Version
|
104
137
|
version: 2.0.0
|
105
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
139
|
requirements:
|
107
|
-
- -
|
140
|
+
- - ">="
|
108
141
|
- !ruby/object:Gem::Version
|
109
142
|
version: '0'
|
110
143
|
requirements: []
|
111
144
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.2.2
|
113
146
|
signing_key:
|
114
147
|
specification_version: 4
|
115
148
|
summary: An Xbox Live API wrapper
|
116
149
|
test_files:
|
117
150
|
- spec/spec_helper.rb
|
151
|
+
- spec/support/vcr_cassettes/achievements.yml
|
152
|
+
- spec/support/vcr_cassettes/bad_profile.yml
|
153
|
+
- spec/support/vcr_cassettes/friends.yml
|
154
|
+
- spec/support/vcr_cassettes/games.yml
|
155
|
+
- spec/support/vcr_cassettes/profile.yml
|
118
156
|
- spec/xbox_leaders/api_spec.rb
|