module SoccersApi
Constants
- VERSION
Attributes
configuration[RW]
Public Class Methods
configure() { |configuration| ... }
click to toggle source
# File lib/soccers_api.rb, line 20 def self.configure yield(configuration) end
reset()
click to toggle source
# File lib/soccers_api.rb, line 16 def self.reset @configuration = Configuration.new end
token()
click to toggle source
# File lib/soccers_api.rb, line 28 def self.token @configuration.token end
username()
click to toggle source
# File lib/soccers_api.rb, line 24 def self.username @configuration.username end
Protected Class Methods
api_url(api_for:, type:, id_type: nil , id: nil, id_type_two: nil, id_two: nil)
click to toggle source
# File lib/soccers_api.rb, line 34 def self.api_url(api_for:, type:, id_type: nil , id: nil, id_type_two: nil, id_two: nil) if type=='list' url = "https://api.soccersapi.com/v2.2/#{api_for}/?user=#{ username }&token=#{token}&t=list" elsif id_type_two.present? && id_two.present? url = "https://api.soccersapi.com/v2.2/#{api_for}/?user=#{ username }&token=#{token}&t=#{type}&#{id_type}=#{id}&#{id_type_two}=#{id_two}" else url = "https://api.soccersapi.com/v2.2/#{api_for}/?user=#{ username }&token=#{token}&t=#{type}&#{id_type}=#{id}" end response = RestClient.get url JSON.parse(response.body) end