Class: ESPN::Client

Inherits:
Object
  • Object
show all
Includes:
Athletes, Audio, Headlines, Medals, Notes, Now, Scores, Sports, Standings, Teams, Video, Connection, Request
Defined in:
lib/espn/client.rb,
lib/espn/client/now.rb,
lib/espn/client/audio.rb,
lib/espn/client/notes.rb,
lib/espn/client/teams.rb,
lib/espn/client/video.rb,
lib/espn/client/medals.rb,
lib/espn/client/scores.rb,
lib/espn/client/sports.rb,
lib/espn/client/athletes.rb,
lib/espn/client/headlines.rb,
lib/espn/client/standings.rb

Defined Under Namespace

Modules: Athletes, Audio, Headlines, Medals, Notes, Now, Scores, Sports, Standings, Teams, Video

Instance Method Summary collapse

Methods included from Video

#video

Methods included from Teams

#teams

Methods included from Standings

#standings

Methods included from Sports

#sports

Methods included from Scores

#scores

Methods included from Now

#now

Methods included from Notes

#notes

Methods included from Medals

#medals

Methods included from Headlines

#headlines

Methods included from Audio

#audio

Methods included from Athletes

#athletes

Methods included from Request

#get

Constructor Details

#initialize(opts = {}) ⇒ Client

Public: Initialize a new Client. To see all options that can be configured, look at the Configuration module, specifically VALID_OPTIONS_KEYS.

opts - A Hash of configuration options.



28
29
30
31
32
33
# File 'lib/espn/client.rb', line 28

def initialize(opts={})
  options = ESPN.options.merge(opts)
  Configuration::VALID_OPTIONS_KEYS.each do |key|
    send("#{key}=", options[key])
  end
end

Instance Method Details

#api_urlObject

Public: Get the base URL for accessing the ESPN API.

Returns a String.



38
39
40
# File 'lib/espn/client.rb', line 38

def api_url
  "http://api.espn.com/v1/"
end

#authed?Boolean

Public: Determine if the ESPN::Client has been authenticated. At this point, we are just checking to see if an :api_key has been set.

Returns a Boolean.

Returns:

  • (Boolean)


46
47
48
# File 'lib/espn/client.rb', line 46

def authed?
  !api_key.nil?
end