Class: XboxApi::Gamer

Inherits:
Object
  • Object
show all
Defined in:
lib/xbox-api/gamer.rb

Constant Summary collapse

ENDPOINTS =
[
  :presence,
  :profile,
  :gamercard,
  :activity,
  :friends,
  :followers,
  :xbox360games,
  :xboxonegames,
  :game_clips
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gamertag, client, xuid = nil) ⇒ Gamer

Returns a new instance of Gamer.



18
19
20
21
22
# File 'lib/xbox-api/gamer.rb', line 18

def initialize(gamertag, client, xuid=nil)
  @gamertag = gamertag
  @client   = client
  @xuid     = xuid || fetch_xuid
end

Instance Attribute Details

#gamertagObject (readonly)

Returns the value of attribute gamertag.



4
5
6
# File 'lib/xbox-api/gamer.rb', line 4

def gamertag
  @gamertag
end

#xuidObject (readonly)

Returns the value of attribute xuid.



4
5
6
# File 'lib/xbox-api/gamer.rb', line 4

def xuid
  @xuid
end

Instance Method Details

#recent_activityObject



31
32
33
34
# File 'lib/xbox-api/gamer.rb', line 31

def recent_activity
  endpoint = "#{xuid}/activity/recent"
  client.fetch_body_and_parse( endpoint )
end