Class: SleeperFF::Client

Inherits:
Object
  • Object
show all
Includes:
Drafts, Leagues, Players, Users, Configurable
Defined in:
lib/sleeper_ff/client.rb,
lib/sleeper_ff/client/users.rb,
lib/sleeper_ff/client/drafts.rb,
lib/sleeper_ff/client/leagues.rb,
lib/sleeper_ff/client/players.rb

Defined Under Namespace

Modules: Drafts, Leagues, Players, Users

Constant Summary collapse

CONVENIENCE_HEADERS =

Header keys that can be passed in options hash

Set.new([:accept, :content_type])

Instance Attribute Summary

Attributes included from Configurable

#api_endpoint, #default_media_type, #user_agent

Instance Method Summary collapse

Methods included from Players

#players, #trending_players

Methods included from Drafts

#draft, #draft_picks, #draft_traded_picks, #user_drafts

Methods included from Leagues

#league, #league_drafts, #league_losers_bracket, #league_matchups, #league_rosters, #league_traded_picks, #league_transactions, #league_users, #league_winners_bracket, #user_leagues

Methods included from Users

#user

Methods included from Configurable

#configure, keys

Constructor Details

#initialize(options = {}) ⇒ Client



21
22
23
24
25
26
# File 'lib/sleeper_ff/client.rb', line 21

def initialize(options = {})
  SleeperFF::Configurable.keys.each do |key|
    value = options[key].nil? ? SleeperFF::Default.send(key) : options[key]
    instance_variable_set(:"@#{key}", value)
  end
end

Instance Method Details

#get(url, options = {}) ⇒ Sawyer::Resource

Make a HTTP GET request



33
34
35
# File 'lib/sleeper_ff/client.rb', line 33

def get(url, options = {})
  request :get, url, options
end