class XboxLiveApi

Attributes

session_info[R]

@return [XboxLiveApi::SessionInfo]

Public Class Methods

login(email, password) click to toggle source

Creates a new XboxLiveApi instance by logging in a user @param email [String] Windows Live account email to use to login @param password [String] associated password to use to login @return [XboxLiveApi] @example

api = XboxLiveApi.login('example@example.com', 'password123')

@note Emails and passwords are not stored, logged, or otherwise used in any

manner other than to securely login to Xbox Live
# File lib/xbox_live_api.rb, line 17
def self.login(email, password)
  session_info = Requests::Login.new(email, password).execute
  XboxLiveApi.new(session_info)
end
new(session_info) click to toggle source
# File lib/xbox_live_api.rb, line 60
def initialize(session_info)
  @session_info = session_info
end
with_session_info(session_info) click to toggle source

Creates a new XboxLiveApi instance with session info from a prior instance @param session_info [XboxLiveApi::SessionInfo] session info from a prior XboxLiveApi instance @return [XboxLiveApi] @example

api = XboxLiveApi.login('example@example.com', 'password123')
api2 = XboxLiveApi.with_session_info(api.session_info)
# File lib/xbox_live_api.rb, line 28
def self.with_session_info(session_info)
  XboxLiveApi.new(session_info)
end

Public Instance Methods

get_achievements_for(game) click to toggle source

@param game [XboxLiveApi::Game] game to get achievements for @return [Array<XboxLiveApi::Achievement>] list of Xbox achievements for the current user and the given game

# File lib/xbox_live_api.rb, line 54
def get_achievements_for(game)
  Requests::AchievementRequest.new(@session_info.token).for(@session_info.user_id, game)
end
get_friend_ids() click to toggle source

@return [Array<XboxLiveApi::Profile>] all friends' profiles for the current user

# File lib/xbox_live_api.rb, line 38
def get_friend_ids
  Requests::FriendRequest.new(@session_info.token).for(@session_info.user_id)
end
get_profile() click to toggle source

@return [XboxLiveApi::Profile] profile information for the current user

# File lib/xbox_live_api.rb, line 33
def get_profile
  Requests::ProfileRequest.new(@session_info.token).for(@session_info.user_id)
end
get_xbox_360_games() click to toggle source

@return [Array<XboxLiveApi::Game>] list of Xbox 360 games played by the current user

# File lib/xbox_live_api.rb, line 48
def get_xbox_360_games
  Requests::Xbox360GamesRequest.new(@session_info.token).for(@session_info.user_id)
end
get_xbox_one_games() click to toggle source

@return [Array<XboxLiveApi::Game>] list of Xbox one games played by the current user

# File lib/xbox_live_api.rb, line 43
def get_xbox_one_games
  Requests::XboxOneGamesRequest.new(@session_info.token).for(@session_info.user_id)
end