class MySportsFeeds
Main class for all interaction with the MySportsFeeds
API
Public Class Methods
new(version='1.0', verbose=False, store_type='file', store_location='results/')
click to toggle source
Constructor
# File lib/mysportsfeeds.rb, line 7 def initialize(version='1.0', verbose=False, store_type='file', store_location='results/') __verify_version(version) __verify_store(store_type, store_location) @version = version @verbose = verbose @store_type = store_type @store_location = store_location # Instantiate an instance of the appropriate API depending on version if @version == '1.0' @api_instance = Mysportsfeeds::Api::API_v1_0.new(@verbose, @store_type, @store_location) end end
Public Instance Methods
__verify_store(store_type, store_location)
click to toggle source
Verify the type and location of the stored data
# File lib/mysportsfeeds.rb, line 30 def __verify_store(store_type, store_location) if !store_type.nil? and store_type != 'file' raiseException.new("Unrecognized storage type specified. Supported values are: nil,'file'") end if store_type == 'file' if store_location.nil? raise Exception.new("Must specify a location for stored data.") end end end
__verify_version(version)
click to toggle source
Make sure the version is supported
# File lib/mysportsfeeds.rb, line 23 def __verify_version(version) if version != '1.0' raise Exception.new("Unrecognized version specified. Supported versions are: '1.0'") end end
authenticate(username, password)
click to toggle source
Authenticate against the API (for v1.0)
# File lib/mysportsfeeds.rb, line 43 def authenticate(username, password) if !@api_instance.supports_basic_auth() raise Exception.new("BASIC authentication not supported for version " + @version) end @api_instance.set_auth_credentials(username, password) end
msf_get_data(league, season, feed, output_format, *kwargs)
click to toggle source
Request data (and store it if applicable)
# File lib/mysportsfeeds.rb, line 52 def msf_get_data(league, season, feed, output_format, *kwargs) return @api_instance.get_data(league, season, feed, output_format, kwargs) end