class SleeperRb::Client

A SleeperRb::Client instance is the interface for formulating all requests for Sleeper data.

Public Instance Methods

avatar(avatar_id) click to toggle source

Returns an avatar found by the alphanumeric ID.

@param avatar_id [String] The ID for the avatar

@return SleeperRb::Resources::Avatar

# File lib/sleeper_rb/client.rb, line 50
def avatar(avatar_id)
  Resources::Avatar.new(avatar_id: avatar_id)
end
draft(draft_id) click to toggle source

Returns a specific Draft.

@return [SleeperRb::Resources::Draft]

# File lib/sleeper_rb/client.rb, line 76
def draft(draft_id)
  Resources::Draft.new(draft_id: draft_id)
end
league(league_id) click to toggle source

Returns a League found by the alphanumeric ID.

@param league_id [String] The ID for the League

@return SleeperRb::Resources::League

# File lib/sleeper_rb/client.rb, line 60
def league(league_id)
  Resources::League.new(league_id: league_id)
end
nfl_state() click to toggle source

Returns the current NflState.

@return SleeperRb::Resources::NflState The NflState instance

# File lib/sleeper_rb/client.rb, line 28
def nfl_state
  Resources::NflState.instance
end
players() click to toggle source

Returns all NFL players.

@return [SleeperRb::Resources::PlayerArray]

# File lib/sleeper_rb/client.rb, line 68
def players
  Resources::PlayerArray.new(Resources::Player.all)
end
user(username: nil, user_id: nil) click to toggle source

Returns a user found by either username or user_id. Usernames are subject to change and are thus unstable.

@param username [String] The current username

@param user_id [String] The numerical user_id

@return SleeperRb::Resources::User

# File lib/sleeper_rb/client.rb, line 40
def user(username: nil, user_id: nil)
  Resources::User.new(username: username, user_id: user_id)
end