Module: Eper
- Defined in:
- lib/eper.rb,
lib/eper/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.0.44"- API_ENDPOINT =
"https://api.football-data.org/"- API_VERSION =
"v2"
Class Method Summary collapse
- .api_key ⇒ Object
- .base_url ⇒ Object
- .connection(p) ⇒ Object
- .header ⇒ Object
- .requested_url(p) ⇒ Object
- .version ⇒ Object
Class Method Details
.api_key ⇒ Object
11 12 13 |
# File 'lib/eper.rb', line 11 def self.api_key ENV["football_data_api_key"] end |
.base_url ⇒ Object
15 16 17 |
# File 'lib/eper.rb', line 15 def self.base_url base_url = Eper::API_ENDPOINT + Eper::API_VERSION end |
.connection(p) ⇒ Object
27 28 29 30 |
# File 'lib/eper.rb', line 27 def self.connection(p) connection = Faraday.new(url: requested_url(p) , headers: header ).get response = JSON.parse(connection.body) end |
.header ⇒ Object
23 24 25 |
# File 'lib/eper.rb', line 23 def self.header load_header = {"X-Auth-Token" => api_key, "X-Response-Control" => "full"} end |
.requested_url(p) ⇒ Object
19 20 21 |
# File 'lib/eper.rb', line 19 def self.requested_url(p) requested_url = base_url + "/#{p}" end |