class ESPN::Client

Public: The class that handles the bulk of the work between the API and the wrapper.

Examples

client = ESPN::Client.new(api_key: 'abc123')
# => ESPN::Client

Attributes

adapter[RW]

Public: Gets/Sets the Symbol adapter.

api_key[RW]

Public: Gets/Sets the String api key.

api_version[RW]

Public: Gets/Sets the Fixnum api version.

open_timeout[RW]

Public: Gets/Sets the Fixnum open timeout.

proxy[RW]

Public: Gets/Sets the String proxy.

timeout[RW]

Public: Gets/Sets the Fixnum timeout.

user_agent[RW]

Public: Gets/Sets the String user agent.

Public Class Methods

new(opts={}) click to toggle source

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.

# File lib/espn/client.rb, line 52
def initialize(opts={})
  options = ESPN.options.merge(opts)
  Configuration::VALID_OPTIONS_KEYS.each do |key|
    send("#{key}=", options[key])
  end
end

Public Instance Methods

api_url() click to toggle source

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

Returns a String.

# File lib/espn/client.rb, line 62
def api_url
  "http://api.espn.com/v1/"
end
authed?() click to toggle source

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.

# File lib/espn/client.rb, line 70
def authed?
  !api_key.nil?
end