class Sportmonks::Api
Public Class Methods
api_get(path, query_opts = {})
click to toggle source
# File lib/sportmonks/api.rb, line 8 def self.api_get(path, query_opts = {}) query_opts = query_opts.merge({api_token: Sportmonks.configuration.api_token}) resp = self.get(path, headers: headers(), query: query_opts) if resp.success? JSON.parse(resp.body) else resp end rescue NoMethodError raise ArgumentError, """ Please configure an api token Sportmonks.configure do |config| config.api_token = 'your_api_key' end """ end
headers()
click to toggle source
# File lib/sportmonks/api.rb, line 25 def self.headers() {'Content-Type' => 'application/json'} end