lib/sportradar/api/request.rb in sportradar-api-0.1.1 vs lib/sportradar/api/request.rb in sportradar-api-0.1.2

- old
+ new

@@ -5,12 +5,13 @@ include HTTParty attr_reader :url, :headers, :timeout, :api_key def base_setup(path, options={}) - @url = set_base(path) + format - @headers = set_headers + @url = set_base(path) + @url += format unless options[:format] == 'none' + @headers = set_headers unless options[:format] == 'none' @api_key = options[:api_key] @timeout = options.delete(:api_timeout) || Sportradar::Api.config.api_timeout end def get(path, options={}) @@ -29,20 +30,20 @@ protocol = !!Sportradar::Api.config.use_ssl ? "https://" : "http://" url = "#{protocol}api.sportradar.us" url += path end - def date_path(date = Date.today) + def date_path(date) "#{date.year}/#{date.month}/#{date.day}" end def week_path(year, season, week) "#{ year }/#{ season }/#{ week }" end def format - ".#{Sportradar::Api.config.format}" + ".#{Sportradar::Api.config.format}" if Sportradar::Api.config.format end def set_headers {'Content-Type' => "application/#{Sportradar::Api.config.format}", 'Accept' => "application/#{Sportradar::Api.config.format}"} end