Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/barisbalic/gamertag

A gem for retrieving Xbox Live Gamertag information from the XboxLeaders API.
https://github.com/barisbalic/gamertag

Last synced: about 1 month ago
JSON representation

A gem for retrieving Xbox Live Gamertag information from the XboxLeaders API.

Awesome Lists containing this project

README

        

# Gamertag [![Build Status](https://travis-ci.org/barisbalic/gamertag.png)](https://travis-ci.org/barisbalic/gamertag) [![Code Climate](https://codeclimate.com/github/barisbalic/gamertag.png)](https://codeclimate.com/github/barisbalic/gamertag) [![Dependency Status](https://gemnasium.com/barisbalic/gamertag.png)](https://gemnasium.com/barisbalic/gamertag)

A simple wrapper for the [Xbox Leaders](https://www.xboxleaders.com/) 2.0 API, which allows you to pull back public information about an Xbox Live user with just their Gamertag. This includes their profile, friends, games played and achievements.

## Divergence from API

The Xbox Leaders API has evolved recently and will probably continue to do so now that it has more focus from it's developer. As a result I've made some choices that may not marry up completely with the API documentation, however I feel they are sensible/idiomatic, and where reasonable I've suggested to the Xbox Leaders team that they could make changes directly to the API.

## Installation

Add this line to your application's Gemfile:

gem 'gamertag'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gamertag

## Documentation

LINK TO RDOC

### Examples

#### Override the adapter

```ruby
client = Gamertag::Client.new(:adapter => :em_http)
client.profile('Major Nelson')
```

#### Retrieve a user

```ruby
Gamertag.profile('Major Nelson')
=> # badges=# biography="" freshness="new" gamerscore=63937 gamertag="Major Nelson" location="" motto="" name="" online=false presence="Last seen 1 minute ago playing Xbox.com" recent_activity=[# artwork=# gamerscore=# id=1414793340 is_app=false last_played="1372305965" progress=52.2 title="Borderlands 2">, # artwork=# gamerscore=# id=1297287449 is_app=false last_played="1372216446" progress=56.6 title="Halo 4">, # artwork=# gamerscore=# id=1161890128 is_app=false last_played="1372131482" progress=44.4 title="Battlefield 3">, # artwork=# gamerscore=# id=1481115739 is_app=true last_played="1371965964" progress=0 title="Xbox Music and Video">, # artwork=# gamerscore=# id=1297287707 is_app=true last_played="1371335033" progress=0 title="Live Event Player">] reputation=20 tier="gold">
```

#### Retrieve games played by a user

```ruby
Gamertag.games('Major Nelson')
=> [# artwork=# gamerscore=# id=1096157139 is_app=false last_played="1132028299" progress=3.2 title="Gun">, …]
```

#### Retrieve friends of a user

```ruby
Gamertag.friends('Major Nelson')
=> [# gamerscore=21080 gamertag="allad1nsane" last_seen="1371973384" online=false status="Last seen 6/23/2013 playing Max Payne 3">, …]
```

#### Retrieve user's achievements

```ruby
Gamertag.achievements('Major Nelson', 1414793309)
=> [# description="Kill 20 enemies by knocking them off Columbia." gamerscore=25 id=36 secret=false title="Bon Voyage" unlock_date="1368255380" unlocked=true>, …]
```

## Contributors

As of 2.0, the codebase is completely re-written, however I'd like to thank [David Czarnecki](https://github.com/czarneckid) for his contributions, especially for putting up with the original crappy code.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## Copyright

Copyright (c) 2011-2014 Baris Balic, David Czarnecki.
See [LICENSE][] for details.

[license]: LICENSE.md