Class: ESPN::Client
- Inherits:
-
Object
- Object
- ESPN::Client
- Includes:
- Athletes, Audio, Headlines, Medals, Notes, Now, Scores, Sports, Standings, Teams, Video, Helpers, 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
Overview
Defined Under Namespace
Modules: Athletes, Audio, Headlines, Medals, Notes, Now, Scores, Sports, Standings, Teams, Video
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Public: Gets/Sets the Symbol adapter.
-
#api_key ⇒ Object
Public: Gets/Sets the String api key.
-
#api_version ⇒ Object
Public: Gets/Sets the Fixnum api version.
-
#open_timeout ⇒ Object
Public: Gets/Sets the Fixnum open timeout.
-
#proxy ⇒ Object
Public: Gets/Sets the String proxy.
-
#timeout ⇒ Object
Public: Gets/Sets the Fixnum timeout.
-
#user_agent ⇒ Object
Public: Gets/Sets the String user agent.
Instance Method Summary collapse
-
#api_url ⇒ Object
Public: Get the base URL for accessing the ESPN API.
-
#authed? ⇒ Boolean
Public: Determine if the ESPN::Client has been authenticated.
-
#initialize(opts = {}) ⇒ Client
constructor
Public: Initialize a new Client.
Methods included from Video
Methods included from Teams
Methods included from Standings
Methods included from Sports
Methods included from Scores
Methods included from Now
Methods included from Notes
Methods included from Medals
Methods included from Headlines
Methods included from Audio
Methods included from Athletes
Methods included from Helpers
Methods included from Request
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.
52 53 54 55 56 57 |
# File 'lib/espn/client.rb', line 52 def initialize(opts={}) = ESPN..merge(opts) Configuration::VALID_OPTIONS_KEYS.each do |key| send("#{key}=", [key]) end end |
Instance Attribute Details
#adapter ⇒ Object
Public: Gets/Sets the Symbol adapter.
27 28 29 |
# File 'lib/espn/client.rb', line 27 def adapter @adapter end |
#api_key ⇒ Object
Public: Gets/Sets the String api key.
33 34 35 |
# File 'lib/espn/client.rb', line 33 def api_key @api_key end |
#api_version ⇒ Object
Public: Gets/Sets the Fixnum api version.
30 31 32 |
# File 'lib/espn/client.rb', line 30 def api_version @api_version end |
#open_timeout ⇒ Object
Public: Gets/Sets the Fixnum open timeout.
36 37 38 |
# File 'lib/espn/client.rb', line 36 def open_timeout @open_timeout end |
#proxy ⇒ Object
Public: Gets/Sets the String proxy.
39 40 41 |
# File 'lib/espn/client.rb', line 39 def proxy @proxy end |
#timeout ⇒ Object
Public: Gets/Sets the Fixnum timeout.
42 43 44 |
# File 'lib/espn/client.rb', line 42 def timeout @timeout end |
#user_agent ⇒ Object
Public: Gets/Sets the String user agent.
45 46 47 |
# File 'lib/espn/client.rb', line 45 def user_agent @user_agent end |
Instance Method Details
#api_url ⇒ Object
Public: Get the base URL for accessing the ESPN API.
Returns a String.
62 63 64 |
# File 'lib/espn/client.rb', line 62 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.
70 71 72 |
# File 'lib/espn/client.rb', line 70 def authed? !api_key.nil? end |