lib/sportradar/api/content.rb in sportradar-api-0.1.36 vs lib/sportradar/api/content.rb in sportradar-api-0.1.37
- old
+ new
@@ -10,15 +10,17 @@
@access_level = access_level
end
def news( date = Date.today, content_type = 'all' )
raise Sportradar::Api::Error::InvalidType unless allowed_news_types.include? content_type
- get request_url("#{provider }/news/#{date_path(date)}/#{content_type}")
+ response = get request_url("#{provider }/news/#{date_path(date)}/#{content_type}")
+ Sportradar::Api::Content::ArticleList.new response["content"] if response.success? && response["content"]
end
def analysis( date = Date.today, content_type = 'all' )
raise Sportradar::Api::Error::InvalidType unless allowed_analysis_types.include? content_type
- get request_url("#{provider }/analysis/#{date_path(date)}/#{content_type}")
+ response = get request_url("#{provider }/analysis/#{date_path(date)}/#{content_type}")
+ Sportradar::Api::Content::ArticleList.new response["content"] if response.success? && response["content"]
end
private
def request_url(path)