xbox-api 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/.travis.yml +13 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +51 -0
- data/Rakefile +2 -0
- data/lib/xbox-api.rb +5 -0
- data/lib/xbox-api/client.rb +50 -0
- data/lib/xbox-api/gamer.rb +45 -0
- data/lib/xbox-api/version.rb +5 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/vcr/calls_remaining.yml +54 -0
- data/spec/vcr/gamer.yml +58 -0
- data/spec/vcr/presence.yml +109 -0
- data/spec/vcr/presence_offline.yml +54 -0
- data/spec/xbox_api_spec.rb +64 -0
- data/xbox-api.gemspec +22 -0
- metadata +124 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4a9799eca21451dc50be15e540c1e2af8f27c638
|
4
|
+
data.tar.gz: 7547068dd904d54af98f4573c3415d22f1f35434
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 418a667bbafffff28a9cc230f644e87c7f28b0a14aa9fc5ecfdf0985cc2b9b82bbf33a0f4fe117cad3329fd11fa80aa5e1f7c5e07dd2991a745c396d8cd2ded7
|
7
|
+
data.tar.gz: bbc4add68e63d9c4507c9630f65879bd526b902530a464fad22467243a1460802878003e77f85604925d75aae6ff437a33ddb5dceab94b411d3c0d9e7484f7d8
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Desciption
|
2
|
+
|
3
|
+
This is a Ruby wrapper for the unofficial Xbox API located at http://xboxapi.com
|
4
|
+
|
5
|
+
# Usage
|
6
|
+
|
7
|
+
One must first create a client that is able to interface with the Xbox API.
|
8
|
+
The client takes one argument; your xbox API token.
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
require "xbox-api"
|
12
|
+
client = XboxApi::Client.new("424242424242424242424242")
|
13
|
+
#=> <XboxApi::Client:0x007fcc9215c8e8>
|
14
|
+
|
15
|
+
```
|
16
|
+
|
17
|
+
Using that client, one can then return a Gamer object
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
logan = client.gamer("oh hai loganz")
|
21
|
+
```
|
22
|
+
|
23
|
+
The XboxApi::Gamer instance responds to methods that correspond to API endpoints
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
logan.presence
|
27
|
+
logan.gamercard
|
28
|
+
```
|
29
|
+
|
30
|
+
The client also respond to `#calls_emaining`
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
live.calls_remaining
|
34
|
+
#=> {:limit=>"120", :remaining=>"112", :resets_in=>"452"}
|
35
|
+
```
|
36
|
+
|
37
|
+
# The API
|
38
|
+
|
39
|
+
### Currently Supported Endpoints
|
40
|
+
|
41
|
+
| Endpoint | Name | Short Description |
|
42
|
+
|--- |--- |--- |
|
43
|
+
| /v2/{xuid}/profile | Profile | This is the Profile for a specified XUID|
|
44
|
+
| /v2/{xuid}/gamercard | Gamercard | This is the Gamercard information for a specified XUID|
|
45
|
+
| /v2/{xuid}/presence | Presence | This is the current presence information for a specified XUID|
|
46
|
+
| /v2/{xuid}/activity | Activity | This is the current activity information for a specified XUID|
|
47
|
+
| /v2/{xuid}/activity/recent | Recent Activity | This is the recent activity information for a specified XUID|
|
48
|
+
| /v2/{xuid}/friends | Friends | This is the friends information for a specified XUID|
|
49
|
+
| /v2/{xuid}/followers | Followers | This is the followers information for a specified XUID|
|
50
|
+
| /v2/{xuid}/xbox360games | Xbox 360 Games | This is the Xbox 360 Games List for a specified XUID|
|
51
|
+
| /v2/{xuid}/xboxonegames | Xbox ONE Games | This is the Xbox One Games List for a specified XUID|
|
data/Rakefile
ADDED
data/lib/xbox-api.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
module XboxApi
|
2
|
+
|
3
|
+
class Client
|
4
|
+
|
5
|
+
attr_reader :api_key, :base_url
|
6
|
+
|
7
|
+
def initialize(api_key)
|
8
|
+
@api_key = api_key
|
9
|
+
@base_url = "https://xboxapi.com/v2"
|
10
|
+
end
|
11
|
+
|
12
|
+
def gamer(tag)
|
13
|
+
XboxApi::Gamer.new(tag, self)
|
14
|
+
end
|
15
|
+
|
16
|
+
def credentials
|
17
|
+
{token: api_key}
|
18
|
+
end
|
19
|
+
|
20
|
+
def fetch_body_and_parse(endpoint)
|
21
|
+
parse(get_with_token(endpoint).read)
|
22
|
+
end
|
23
|
+
|
24
|
+
def calls_remaining
|
25
|
+
headers = fetch_headers
|
26
|
+
{
|
27
|
+
limit: headers["x-ratelimit-limit"],
|
28
|
+
remaining: headers["x-ratelimit-remaining"],
|
29
|
+
resets_in: headers["x-ratelimit-reset"]
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def parse(json)
|
36
|
+
MultiJson.load(json, symbolize_keys: true)
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_with_token(endpoint)
|
40
|
+
request = URI.parse("#{base_url}/#{endpoint}")
|
41
|
+
open(request, "X-AUTH" => api_key)
|
42
|
+
end
|
43
|
+
|
44
|
+
def fetch_headers
|
45
|
+
get_with_token("accountXuid").meta
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module XboxApi
|
2
|
+
class Gamer
|
3
|
+
|
4
|
+
attr_reader :gamertag, :xuid
|
5
|
+
|
6
|
+
ENDPOINTS = [
|
7
|
+
:presence,
|
8
|
+
:profile,
|
9
|
+
:gamercard,
|
10
|
+
:activity,
|
11
|
+
:friends,
|
12
|
+
:followers,
|
13
|
+
:xbox360games,
|
14
|
+
:xboxonegames
|
15
|
+
]
|
16
|
+
|
17
|
+
def initialize(gamertag, client)
|
18
|
+
@gamertag = gamertag
|
19
|
+
@client = client
|
20
|
+
@xuid = fetch_xuid
|
21
|
+
end
|
22
|
+
|
23
|
+
ENDPOINTS.each do |action|
|
24
|
+
define_method( action ) do
|
25
|
+
endpoint = "#{xuid}/#{__method__}"
|
26
|
+
client.fetch_body_and_parse( endpoint )
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def recent_activity
|
31
|
+
endpoint = "#{xuid}/activity/recent"
|
32
|
+
client.fetch_body_and_parse( endpoint )
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
attr_reader :client
|
38
|
+
|
39
|
+
def fetch_xuid
|
40
|
+
endpoint = "xuid/#{URI.encode(gamertag)}"
|
41
|
+
client.fetch_body_and_parse(endpoint)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
require 'xbox-api'
|
9
|
+
require 'vcr'
|
10
|
+
require 'fakeweb'
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
# config.run_all_when_everything_filtered = true
|
14
|
+
# config.filter_run :focus
|
15
|
+
|
16
|
+
# Run specs in random order to surface order dependencies. If you find an
|
17
|
+
# order dependency and want to debug it, you can fix the order by providing
|
18
|
+
# the seed, which is printed after each run.
|
19
|
+
# --seed 1234
|
20
|
+
# config.order = 'random'
|
21
|
+
end
|
22
|
+
|
23
|
+
VCR.configure do |config|
|
24
|
+
config.cassette_library_dir = "spec/vcr"
|
25
|
+
config.hook_into :fakeweb
|
26
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://xboxapi.com/v2/accountXuid
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
x-auth:
|
11
|
+
- e0662396178e32b0ea6c1f36c842a2b96b3bfb3d
|
12
|
+
accept-encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
accept:
|
15
|
+
- "*/*"
|
16
|
+
user-agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
server:
|
24
|
+
- nginx/1.6.2
|
25
|
+
content-type:
|
26
|
+
- application/json
|
27
|
+
transfer-encoding:
|
28
|
+
- chunked
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
x-powered-by:
|
32
|
+
- PHP/5.5.20-1+deb.sury.org~trusty+1
|
33
|
+
cache-control:
|
34
|
+
- no-cache
|
35
|
+
date:
|
36
|
+
- Tue, 20 Jan 2015 20:58:47 GMT
|
37
|
+
access-control-allow-origin:
|
38
|
+
- "*"
|
39
|
+
x-ratelimit-limit:
|
40
|
+
- '120'
|
41
|
+
x-ratelimit-remaining:
|
42
|
+
- '87'
|
43
|
+
x-ratelimit-reset:
|
44
|
+
- '74'
|
45
|
+
access-control-allow-headers:
|
46
|
+
- content-type, content-length, x-auth, accept-encoding, accept, user-agent,
|
47
|
+
host, Origin, Access-Control-Allow-Origin, Access-Control-Request-Method,
|
48
|
+
Access-Control-Request-Headers, X-Auth
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"xuid":2533274810770211,"gamerTag":"audibleBLiNK","gamertag":"audibleBLiNK"}'
|
52
|
+
http_version: '1.1'
|
53
|
+
recorded_at: Tue, 20 Jan 2015 20:58:46 GMT
|
54
|
+
recorded_with: VCR 2.9.3
|
data/spec/vcr/gamer.yml
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://xboxapi.com/v2/xuid/audibleblink
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
x-auth:
|
11
|
+
- e0662396178e32b0ea6c1f36c842a2b96b3bfb3d
|
12
|
+
accept-encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
accept:
|
15
|
+
- "*/*"
|
16
|
+
user-agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
server:
|
24
|
+
- nginx/1.6.2
|
25
|
+
content-type:
|
26
|
+
- text/plain; charset=UTF-8
|
27
|
+
transfer-encoding:
|
28
|
+
- chunked
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
vary:
|
32
|
+
- Accept-Encoding
|
33
|
+
x-powered-by:
|
34
|
+
- PHP/5.5.20-1+deb.sury.org~trusty+1
|
35
|
+
cache-control:
|
36
|
+
- no-cache
|
37
|
+
date:
|
38
|
+
- Tue, 20 Jan 2015 21:08:55 GMT
|
39
|
+
access-control-allow-origin:
|
40
|
+
- "*"
|
41
|
+
x-ratelimit-limit:
|
42
|
+
- '120'
|
43
|
+
x-ratelimit-remaining:
|
44
|
+
- '120'
|
45
|
+
x-ratelimit-reset:
|
46
|
+
- '3065'
|
47
|
+
access-control-allow-headers:
|
48
|
+
- content-type, content-length, x-auth, accept-encoding, accept, user-agent,
|
49
|
+
host, Origin, Access-Control-Allow-Origin, Access-Control-Request-Method,
|
50
|
+
Access-Control-Request-Headers, X-Auth
|
51
|
+
content-encoding:
|
52
|
+
- gzip
|
53
|
+
body:
|
54
|
+
encoding: UTF-8
|
55
|
+
string: '2533274810770211'
|
56
|
+
http_version: '1.1'
|
57
|
+
recorded_at: Tue, 20 Jan 2015 21:08:54 GMT
|
58
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,109 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://xboxapi.com/v2/xuid/audibleblink
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
x-auth:
|
11
|
+
- e0662396178e32b0ea6c1f36c842a2b96b3bfb3d
|
12
|
+
accept-encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
accept:
|
15
|
+
- "*/*"
|
16
|
+
user-agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
server:
|
24
|
+
- nginx/1.6.2
|
25
|
+
content-type:
|
26
|
+
- text/plain; charset=UTF-8
|
27
|
+
transfer-encoding:
|
28
|
+
- chunked
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
vary:
|
32
|
+
- Accept-Encoding
|
33
|
+
x-powered-by:
|
34
|
+
- PHP/5.5.20-1+deb.sury.org~trusty+1
|
35
|
+
cache-control:
|
36
|
+
- no-cache
|
37
|
+
date:
|
38
|
+
- Tue, 20 Jan 2015 20:58:48 GMT
|
39
|
+
access-control-allow-origin:
|
40
|
+
- "*"
|
41
|
+
x-ratelimit-limit:
|
42
|
+
- '120'
|
43
|
+
x-ratelimit-remaining:
|
44
|
+
- '86'
|
45
|
+
x-ratelimit-reset:
|
46
|
+
- '72'
|
47
|
+
access-control-allow-headers:
|
48
|
+
- content-type, content-length, x-auth, accept-encoding, accept, user-agent,
|
49
|
+
host, Origin, Access-Control-Allow-Origin, Access-Control-Request-Method,
|
50
|
+
Access-Control-Request-Headers, X-Auth
|
51
|
+
content-encoding:
|
52
|
+
- gzip
|
53
|
+
body:
|
54
|
+
encoding: UTF-8
|
55
|
+
string: '2533274810770211'
|
56
|
+
http_version: '1.1'
|
57
|
+
recorded_at: Tue, 20 Jan 2015 20:58:47 GMT
|
58
|
+
- request:
|
59
|
+
method: get
|
60
|
+
uri: https://xboxapi.com/v2/2533274810770211/presence
|
61
|
+
body:
|
62
|
+
encoding: US-ASCII
|
63
|
+
string: ''
|
64
|
+
headers:
|
65
|
+
x-auth:
|
66
|
+
- e0662396178e32b0ea6c1f36c842a2b96b3bfb3d
|
67
|
+
accept-encoding:
|
68
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
69
|
+
accept:
|
70
|
+
- "*/*"
|
71
|
+
user-agent:
|
72
|
+
- Ruby
|
73
|
+
response:
|
74
|
+
status:
|
75
|
+
code: 200
|
76
|
+
message: OK
|
77
|
+
headers:
|
78
|
+
server:
|
79
|
+
- nginx/1.6.2
|
80
|
+
content-type:
|
81
|
+
- application/json
|
82
|
+
transfer-encoding:
|
83
|
+
- chunked
|
84
|
+
connection:
|
85
|
+
- keep-alive
|
86
|
+
x-powered-by:
|
87
|
+
- PHP/5.5.20-1+deb.sury.org~trusty+1
|
88
|
+
cache-control:
|
89
|
+
- no-cache
|
90
|
+
date:
|
91
|
+
- Tue, 20 Jan 2015 20:58:49 GMT
|
92
|
+
access-control-allow-origin:
|
93
|
+
- "*"
|
94
|
+
x-ratelimit-limit:
|
95
|
+
- '120'
|
96
|
+
x-ratelimit-remaining:
|
97
|
+
- '85'
|
98
|
+
x-ratelimit-reset:
|
99
|
+
- '71'
|
100
|
+
access-control-allow-headers:
|
101
|
+
- content-type, content-length, x-auth, accept-encoding, accept, user-agent,
|
102
|
+
host, Origin, Access-Control-Allow-Origin, Access-Control-Request-Method,
|
103
|
+
Access-Control-Request-Headers, X-Auth
|
104
|
+
body:
|
105
|
+
encoding: UTF-8
|
106
|
+
string: '{"xuid":2533274810770211,"state":"Offline"}'
|
107
|
+
http_version: '1.1'
|
108
|
+
recorded_at: Tue, 20 Jan 2015 20:58:48 GMT
|
109
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://xboxapi.com/v2/2533274810770211/presence
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
x-auth:
|
11
|
+
- e0662396178e32b0ea6c1f36c842a2b96b3bfb3d
|
12
|
+
accept-encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
accept:
|
15
|
+
- "*/*"
|
16
|
+
user-agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
server:
|
24
|
+
- nginx/1.6.2
|
25
|
+
content-type:
|
26
|
+
- application/json
|
27
|
+
transfer-encoding:
|
28
|
+
- chunked
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
x-powered-by:
|
32
|
+
- PHP/5.5.20-1+deb.sury.org~trusty+1
|
33
|
+
cache-control:
|
34
|
+
- no-cache
|
35
|
+
date:
|
36
|
+
- Tue, 20 Jan 2015 21:20:09 GMT
|
37
|
+
access-control-allow-origin:
|
38
|
+
- "*"
|
39
|
+
x-ratelimit-limit:
|
40
|
+
- '120'
|
41
|
+
x-ratelimit-remaining:
|
42
|
+
- '117'
|
43
|
+
x-ratelimit-reset:
|
44
|
+
- '2391'
|
45
|
+
access-control-allow-headers:
|
46
|
+
- content-type, content-length, x-auth, accept-encoding, accept, user-agent,
|
47
|
+
host, Origin, Access-Control-Allow-Origin, Access-Control-Request-Method,
|
48
|
+
Access-Control-Request-Headers, X-Auth
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"xuid":2533274810770211,"state":"Offline"}'
|
52
|
+
http_version: '1.1'
|
53
|
+
recorded_at: Tue, 20 Jan 2015 21:20:09 GMT
|
54
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vcr'
|
3
|
+
|
4
|
+
describe XboxApi do
|
5
|
+
|
6
|
+
let(:token) {File.read('./.env').chomp.split(" ")[1]}
|
7
|
+
let(:client) {XboxApi::Client.new(token)}
|
8
|
+
let(:gamer) { VCR.use_cassette("gamer") { client.gamer("audibleblink") } }
|
9
|
+
|
10
|
+
describe XboxApi::Client do
|
11
|
+
|
12
|
+
context "#gamer" do
|
13
|
+
|
14
|
+
it "returns a Gamer object" do
|
15
|
+
expect( gamer ).to be_a_kind_of XboxApi::Gamer
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
context "#calls_remaining" do
|
21
|
+
it "returns a hash with the correct info" do
|
22
|
+
VCR.use_cassette("calls_remaining") do
|
23
|
+
response = client.calls_remaining
|
24
|
+
expect(response).to be_a_kind_of Hash
|
25
|
+
expect(response.keys.length).to eq 3
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe XboxApi::Gamer do
|
32
|
+
|
33
|
+
context "#presence" do
|
34
|
+
|
35
|
+
it "returns 'Offline' for an offline player" do
|
36
|
+
VCR.use_cassette("presence_offline") do
|
37
|
+
response = gamer.presence
|
38
|
+
expect(response[:state]).to eq "Offline"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
xit "returns 'Online' for an online player" do
|
43
|
+
VCR.use_cassette("presence_online") do
|
44
|
+
response = gamer.presence
|
45
|
+
expect(response[:state]).to eq "Online"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
xit "returns 'Away' for an away player" do
|
50
|
+
VCR.use_cassette("presence_away") do
|
51
|
+
response = gamer.presence
|
52
|
+
expect(response[:state]).to eq "Away"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "#xuid" do
|
58
|
+
it "has an xuid" do
|
59
|
+
expect(gamer.xuid).to_not be nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
data/xbox-api.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/xbox-api/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Alex Flores"]
|
6
|
+
gem.email = ["xboxapin@alexflor.es"]
|
7
|
+
gem.description = %q{An Xbox API wrapper that allows one to fetch profiles, games, achievements and friends data}
|
8
|
+
gem.summary = %q{A Ruby wrapper for the xboxapi.com API}
|
9
|
+
gem.homepage = "https://github.com/audibleblink/xbox-api"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "xbox-api"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = XboxApi::Wrapper::VERSION
|
17
|
+
|
18
|
+
gem.add_runtime_dependency("multi_json")
|
19
|
+
gem.add_development_dependency("rspec")
|
20
|
+
gem.add_development_dependency("vcr")
|
21
|
+
gem.add_development_dependency("fakeweb")
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xbox-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alex Flores
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: multi_json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: vcr
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fakeweb
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: An Xbox API wrapper that allows one to fetch profiles, games, achievements
|
70
|
+
and friends data
|
71
|
+
email:
|
72
|
+
- xboxapin@alexflor.es
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- lib/xbox-api.rb
|
85
|
+
- lib/xbox-api/client.rb
|
86
|
+
- lib/xbox-api/gamer.rb
|
87
|
+
- lib/xbox-api/version.rb
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
- spec/vcr/calls_remaining.yml
|
90
|
+
- spec/vcr/gamer.yml
|
91
|
+
- spec/vcr/presence.yml
|
92
|
+
- spec/vcr/presence_offline.yml
|
93
|
+
- spec/xbox_api_spec.rb
|
94
|
+
- xbox-api.gemspec
|
95
|
+
homepage: https://github.com/audibleblink/xbox-api
|
96
|
+
licenses: []
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.2.2
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: A Ruby wrapper for the xboxapi.com API
|
118
|
+
test_files:
|
119
|
+
- spec/spec_helper.rb
|
120
|
+
- spec/vcr/calls_remaining.yml
|
121
|
+
- spec/vcr/gamer.yml
|
122
|
+
- spec/vcr/presence.yml
|
123
|
+
- spec/vcr/presence_offline.yml
|
124
|
+
- spec/xbox_api_spec.rb
|