api_football 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +125 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +8 -0
- data/api_football.gemspec +43 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/fixtures/vcr_cassettes/competitions/all.yml +47 -0
- data/fixtures/vcr_cassettes/competitions/filter_by_country.yml +46 -0
- data/fixtures/vcr_cassettes/countries/all.yml +46 -0
- data/fixtures/vcr_cassettes/errors/api_key.yml +46 -0
- data/fixtures/vcr_cassettes/events/all.yml +2303 -0
- data/fixtures/vcr_cassettes/events/filter_by_league.yml +1080 -0
- data/fixtures/vcr_cassettes/h2h/all.yml +46 -0
- data/fixtures/vcr_cassettes/odds/all.yml +1149 -0
- data/fixtures/vcr_cassettes/odds/filter_by_league.yml +59 -0
- data/fixtures/vcr_cassettes/standings/all.yml +46 -0
- data/fixtures/vcr_cassettes/standings/filter_by_league.yml +66 -0
- data/lib/api_football/client.rb +39 -0
- data/lib/api_football/competition.rb +18 -0
- data/lib/api_football/country.rb +14 -0
- data/lib/api_football/error.rb +8 -0
- data/lib/api_football/event.rb +36 -0
- data/lib/api_football/h2h.rb +18 -0
- data/lib/api_football/http.rb +31 -0
- data/lib/api_football/odd.rb +35 -0
- data/lib/api_football/response.rb +14 -0
- data/lib/api_football/standing.rb +18 -0
- data/lib/api_football/version.rb +5 -0
- data/lib/api_football.rb +18 -0
- metadata +193 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apifootball.com/api/?APIkey=655309a09751b590f3ae9bcc01757eace8dcd4c29605170e6675a6044c1b3a3a&action=get_odds&from=2018-08/01&match_id=304968&to=2018-08/20
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.14.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Sun, 09 Sep 2018 01:15:19 GMT
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.15 (CentOS)
|
25
|
+
X-Powered-By:
|
26
|
+
- PHP/5.3.3
|
27
|
+
Access-Control-Allow-Origin:
|
28
|
+
- "*"
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=2592000
|
31
|
+
Expires:
|
32
|
+
- Tue, 09 Oct 2018 01:15:19 GMT
|
33
|
+
Vary:
|
34
|
+
- Accept-Encoding,User-Agent
|
35
|
+
Content-Length:
|
36
|
+
- '1388'
|
37
|
+
Connection:
|
38
|
+
- close
|
39
|
+
Content-Type:
|
40
|
+
- application/json
|
41
|
+
body:
|
42
|
+
encoding: ASCII-8BIT
|
43
|
+
string: '[{"match_id":"304968","odd_bookmakers":"bet-at-home","odd_date":"2018-08-01
|
44
|
+
04:03:30","odd_1":"3.06","odd_x":"3.06","odd_2":"2.34","odd_1x":"1.52","odd_12":"1.34","odd_x2":"1.34","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"","ah-1.5_2":"","ah-1_1":"","ah-1_2":"","ah0_1":"","ah0_2":"","ah+0.5_1":"","ah+1_1":"","ah+1_2":"","ah+1.5_1":"","ah+1.5_2":"","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"1.07","u+0.5":"6.84","o+1":"","u+1":"","o+1.5":"1.37","u+1.5":"2.85","o+2":"","u+2":"","o+2.5":"2.16","u+2.5":"1.62","o+3":"","u+3":"","o+3.5":"3.81","u+3.5":"1.22","o+4":"","u+4":"","o+4.5":"7.12","u+4.5":"1.06","o+5":"","u+5":"","o+5.5":"10.79","u+5.5":"1.01","bts_yes":"1.88","bts_no":"1.82"},{"match_id":"304968","odd_bookmakers":"WilliamHill.it","odd_date":"2018-08-01
|
45
|
+
04:03:30","odd_1":"3.10","odd_x":"3.10","odd_2":"2.38","odd_1x":"","odd_12":"","odd_x2":"","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"","ah-1.5_2":"","ah-1_1":"","ah-1_2":"","ah0_1":"","ah0_2":"","ah+0.5_1":"","ah+1_1":"","ah+1_2":"","ah+1.5_1":"","ah+1.5_2":"","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"","u+0.5":"","o+1":"","u+1":"","o+1.5":"","u+1.5":"","o+2":"","u+2":"","o+2.5":"","u+2.5":"","o+3":"","u+3":"","o+3.5":"","u+3.5":"","o+4":"","u+4":"","o+4.5":"","u+4.5":"","o+5":"","u+5":"","o+5.5":"","u+5.5":"","bts_yes":"","bts_no":""},{"match_id":"304968","odd_bookmakers":"Unibet","odd_date":"2018-08-01
|
46
|
+
04:03:30","odd_1":"3.25","odd_x":"3.15","odd_2":"2.35","odd_1x":"1.56","odd_12":"1.33","odd_x2":"1.32","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"","ah-1.5_2":"","ah-1_1":"","ah-1_2":"","ah0_1":"2.23","ah0_2":"1.61","ah+0.5_1":"1.58","ah+1_1":"1.23","ah+1_2":"4.00","ah+1.5_1":"","ah+1.5_2":"","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"1.07","u+0.5":"8.50","o+1":"","u+1":"","o+1.5":"1.37","u+1.5":"2.95","o+2":"","u+2":"","o+2.5":"2.23","u+2.5":"1.61","o+3":"","u+3":"","o+3.5":"4.30","u+3.5":"1.20","o+4":"","u+4":"","o+4.5":"9.00","u+4.5":"1.06","o+5":"","u+5":"","o+5.5":"","u+5.5":"","bts_yes":"1.88","bts_no":"1.84"},{"match_id":"304968","odd_bookmakers":"William
|
47
|
+
Hill","odd_date":"2018-08-01 04:03:30","odd_1":"3.10","odd_x":"3.10","odd_2":"2.38","odd_1x":"1.50","odd_12":"1.40","odd_x2":"1.36","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"","ah-1.5_2":"","ah-1_1":"","ah-1_2":"","ah0_1":"","ah0_2":"","ah+0.5_1":"","ah+1_1":"","ah+1_2":"","ah+1.5_1":"","ah+1.5_2":"","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"","u+0.5":"","o+1":"","u+1":"","o+1.5":"","u+1.5":"","o+2":"","u+2":"","o+2.5":"","u+2.5":"","o+3":"","u+3":"","o+3.5":"","u+3.5":"","o+4":"","u+4":"","o+4.5":"","u+4.5":"","o+5":"","u+5":"","o+5.5":"","u+5.5":"","bts_yes":"1.85","bts_no":"1.85"},{"match_id":"304968","odd_bookmakers":"Pinnacle","odd_date":"2018-08-01
|
48
|
+
04:03:30","odd_1":"3.24","odd_x":"3.22","odd_2":"2.46","odd_1x":"","odd_12":"","odd_x2":"","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"","ah-1.5_2":"","ah-1_1":"","ah-1_2":"","ah0_1":"2.26","ah0_2":"1.71","ah+0.5_1":"1.61","ah+1_1":"","ah+1_2":"","ah+1.5_1":"","ah+1.5_2":"","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"","u+0.5":"","o+1":"","u+1":"","o+1.5":"","u+1.5":"","o+2":"1.66","u+2":"2.32","o+2.5":"2.26","u+2.5":"1.69","o+3":"","u+3":"","o+3.5":"","u+3.5":"","o+4":"","u+4":"","o+4.5":"","u+4.5":"","o+5":"","u+5":"","o+5.5":"","u+5.5":"","bts_yes":"","bts_no":""},{"match_id":"304968","odd_bookmakers":"Bethard","odd_date":"2018-08-01
|
49
|
+
04:03:30","odd_1":"3.20","odd_x":"3.20","odd_2":"2.40","odd_1x":"1.59","odd_12":"1.29","odd_x2":"1.35","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"","ah-1.5_2":"","ah-1_1":"","ah-1_2":"","ah0_1":"2.21","ah0_2":"1.69","ah+0.5_1":"1.59","ah+1_1":"","ah+1_2":"","ah+1.5_1":"","ah+1.5_2":"","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"1.06","u+0.5":"8.00","o+1":"","u+1":"","o+1.5":"1.38","u+1.5":"2.85","o+2":"1.65","u+2":"2.22","o+2.5":"2.20","u+2.5":"1.63","o+3":"","u+3":"","o+3.5":"4.05","u+3.5":"1.22","o+4":"","u+4":"","o+4.5":"8.00","u+4.5":"1.06","o+5":"","u+5":"","o+5.5":"15.00","u+5.5":"","bts_yes":"1.91","bts_no":"1.77"},{"match_id":"304968","odd_bookmakers":"Vulkanbet","odd_date":"2018-08-01
|
50
|
+
04:03:30","odd_1":"3.09","odd_x":"3.09","odd_2":"2.29","odd_1x":"1.51","odd_12":"1.31","odd_x2":"1.31","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"","ah-1.5_2":"","ah-1_1":"","ah-1_2":"","ah0_1":"1.77","ah0_2":"1.93","ah+0.5_1":"","ah+1_1":"","ah+1_2":"","ah+1.5_1":"","ah+1.5_2":"","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"1.08","u+0.5":"7.15","o+1":"","u+1":"","o+1.5":"1.38","u+1.5":"2.89","o+2":"1.64","u+2":"2.18","o+2.5":"2.19","u+2.5":"1.63","o+3":"","u+3":"","o+3.5":"3.89","u+3.5":"1.23","o+4":"","u+4":"","o+4.5":"7.47","u+4.5":"1.07","o+5":"","u+5":"","o+5.5":"11.86","u+5.5":"1.01","bts_yes":"","bts_no":""},{"match_id":"304968","odd_bookmakers":"18bet","odd_date":"2018-08-01
|
51
|
+
04:03:30","odd_1":"3.20","odd_x":"3.15","odd_2":"2.40","odd_1x":"1.57","odd_12":"1.30","odd_x2":"1.30","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"6.80","ah-1.5_2":"1.11","ah-1_1":"5.75","ah-1_2":"1.14","ah0_1":"2.24","ah0_2":"1.70","ah+0.5_1":"1.60","ah+1_1":"1.26","ah+1_2":"3.70","ah+1.5_1":"1.18","ah+1.5_2":"4.65","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"1.08","u+0.5":"8.50","o+1":"1.11","u+1":"6.60","o+1.5":"1.38","u+1.5":"3.00","o+2":"1.67","u+2":"2.29","o+2.5":"2.26","u+2.5":"1.69","o+3":"3.30","u+3":"1.33","o+3.5":"3.90","u+3.5":"1.24","o+4":"","u+4":"","o+4.5":"9.00","u+4.5":"1.07","o+5":"","u+5":"","o+5.5":"","u+5.5":"","bts_yes":"1.80","bts_no":"1.80"},{"match_id":"304968","odd_bookmakers":"Asianodds","odd_date":"2018-08-01
|
52
|
+
04:03:30","odd_1":"3.24","odd_x":"3.22","odd_2":"2.46","odd_1x":"","odd_12":"","odd_x2":"","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"","ah-1.5_2":"","ah-1_1":"","ah-1_2":"","ah0_1":"2.26","ah0_2":"1.72","ah+0.5_1":"1.61","ah+1_1":"","ah+1_2":"","ah+1.5_1":"","ah+1.5_2":"","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"","u+0.5":"","o+1":"","u+1":"","o+1.5":"","u+1.5":"","o+2":"1.68","u+2":"2.32","o+2.5":"2.26","u+2.5":"1.69","o+3":"","u+3":"","o+3.5":"","u+3.5":"","o+4":"","u+4":"","o+4.5":"","u+4.5":"","o+5":"","u+5":"","o+5.5":"","u+5.5":"","bts_yes":"","bts_no":""},{"match_id":"304968","odd_bookmakers":"bwin","odd_date":"2018-08-01
|
53
|
+
04:03:30","odd_1":"3.10","odd_x":"3.00","odd_2":"2.40","odd_1x":"1.53","odd_12":"1.30","odd_x2":"1.35","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"","ah-1.5_2":"","ah-1_1":"","ah-1_2":"","ah0_1":"","ah0_2":"","ah+0.5_1":"","ah+1_1":"","ah+1_2":"","ah+1.5_1":"","ah+1.5_2":"","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"1.07","u+0.5":"6.75","o+1":"","u+1":"","o+1.5":"1.36","u+1.5":"2.90","o+2":"","u+2":"","o+2.5":"2.15","u+2.5":"1.65","o+3":"","u+3":"","o+3.5":"3.75","u+3.5":"1.22","o+4":"","u+4":"","o+4.5":"7.00","u+4.5":"1.07","o+5":"","u+5":"","o+5.5":"12.50","u+5.5":"1.01","bts_yes":"1.87","bts_no":"1.83"},{"match_id":"304968","odd_bookmakers":"bet365","odd_date":"2018-08-01
|
54
|
+
04:03:30","odd_1":"3.25","odd_x":"3.20","odd_2":"2.25","odd_1x":"1.66","odd_12":"1.36","odd_x2":"1.35","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"","ah-2.5_2":"","ah-2_1":"","ah-2_2":"","ah-1.5_1":"6.80","ah-1.5_2":"1.10","ah-1_1":"5.75","ah-1_2":"1.13","ah0_1":"2.20","ah0_2":"1.64","ah+0.5_1":"1.60","ah+1_1":"1.26","ah+1_2":"3.70","ah+1.5_1":"1.17","ah+1.5_2":"4.65","ah+2_1":"","ah+2_2":"","ah+2.5_1":"","ah+2.5_2":"","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"1.08","u+0.5":"8.50","o+1":"","u+1":"","o+1.5":"1.36","u+1.5":"3.00","o+2":"","u+2":"","o+2.5":"2.14","u+2.5":"1.66","o+3":"","u+3":"","o+3.5":"4.00","u+3.5":"1.22","o+4":"","u+4":"","o+4.5":"9.00","u+4.5":"1.07","o+5":"","u+5":"","o+5.5":"19.00","u+5.5":"1.02","bts_yes":"1.83","bts_no":"1.83"},{"match_id":"304968","odd_bookmakers":"BetOlimp","odd_date":"2018-08-01
|
55
|
+
04:03:30","odd_1":"3.19","odd_x":"3.19","odd_2":"2.42","odd_1x":"1.58","odd_12":"1.36","odd_x2":"1.36","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"11.50","ah-2.5_2":"1.01","ah-2_1":"11.25","ah-2_2":"1.02","ah-1.5_1":"6.45","ah-1.5_2":"1.10","ah-1_1":"5.70","ah-1_2":"1.14","ah0_1":"","ah0_2":"","ah+0.5_1":"","ah+1_1":"1.26","ah+1_2":"3.84","ah+1.5_1":"1.18","ah+1.5_2":"4.71","ah+2_1":"1.05","ah+2_2":"8.50","ah+2.5_1":"1.04","ah+2.5_2":"8.75","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"","u+0.5":"","o+1":"","u+1":"","o+1.5":"","u+1.5":"","o+2":"","u+2":"","o+2.5":"","u+2.5":"","o+3":"","u+3":"","o+3.5":"","u+3.5":"","o+4":"","u+4":"","o+4.5":"","u+4.5":"","o+5":"","u+5":"","o+5.5":"","u+5.5":"","bts_yes":"","bts_no":""},{"match_id":"304968","odd_bookmakers":"1xBet","odd_date":"2018-08-01
|
56
|
+
04:03:30","odd_1":"3.22","odd_x":"3.26","odd_2":"2.50","odd_1x":"1.57","odd_12":"1.36","odd_x2":"1.37","ah-4.5_1":"","ah-4.5_2":"","ah-4_1":"","ah-4_2":"","ah-3.5_1":"","ah-3.5_2":"","ah-3_1":"","ah-3_2":"","ah-2.5_1":"15.00","ah-2.5_2":"1.01","ah-2_1":"11.00","ah-2_2":"1.02","ah-1.5_1":"6.85","ah-1.5_2":"1.09","ah-1_1":"5.85","ah-1_2":"1.14","ah0_1":"2.27","ah0_2":"1.74","ah+0.5_1":"","ah+1_1":"1.24","ah+1_2":"4.04","ah+1.5_1":"1.16","ah+1.5_2":"4.94","ah+2_1":"1.03","ah+2_2":"9.30","ah+2.5_1":"1.01","ah+2.5_2":"10.00","ah+3_1":"","ah+3_2":"","ah+3.5_1":"","ah+3.5_2":"","ah+4_1":"","ah+4_2":"","ah+4.5_1":"","ah+4.5_2":"","o+0.5":"1.02","u+0.5":"9.90","o+1":"1.06","u+1":"7.70","o+1.5":"1.37","u+1.5":"3.08","o+2":"1.63","u+2":"2.31","o+2.5":"2.30","u+2.5":"1.71","o+3":"3.38","u+3":"1.33","o+3.5":"4.14","u+3.5":"1.22","o+4":"7.30","u+4":"1.07","o+4.5":"8.10","u+4.5":"1.05","o+5":"15.00","u+5":"1.01","o+5.5":"15.00","u+5.5":"1.02","bts_yes":"1.94","bts_no":"1.94"}]'
|
57
|
+
http_version:
|
58
|
+
recorded_at: Sun, 09 Sep 2018 03:15:21 GMT
|
59
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apifootball.com/api/?APIkey=655309a09751b590f3ae9bcc01757eace8dcd4c29605170e6675a6044c1b3a3a&action=get_standings
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.14.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Sat, 08 Sep 2018 20:09:04 GMT
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.15 (CentOS)
|
25
|
+
X-Powered-By:
|
26
|
+
- PHP/5.3.3
|
27
|
+
Access-Control-Allow-Origin:
|
28
|
+
- "*"
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=2592000
|
31
|
+
Expires:
|
32
|
+
- Mon, 08 Oct 2018 20:09:04 GMT
|
33
|
+
Vary:
|
34
|
+
- Accept-Encoding,User-Agent
|
35
|
+
Content-Length:
|
36
|
+
- '73'
|
37
|
+
Connection:
|
38
|
+
- close
|
39
|
+
Content-Type:
|
40
|
+
- application/json
|
41
|
+
body:
|
42
|
+
encoding: ASCII-8BIT
|
43
|
+
string: '{"error":201,"message":"Required parameters missing"}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Sat, 08 Sep 2018 22:09:06 GMT
|
46
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,66 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://apifootball.com/api/?APIkey=655309a09751b590f3ae9bcc01757eace8dcd4c29605170e6675a6044c1b3a3a&action=get_standings&league_id=63
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.14.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Sat, 08 Sep 2018 20:12:05 GMT
|
23
|
+
Server:
|
24
|
+
- Apache/2.2.15 (CentOS)
|
25
|
+
X-Powered-By:
|
26
|
+
- PHP/5.3.3
|
27
|
+
Access-Control-Allow-Origin:
|
28
|
+
- "*"
|
29
|
+
Cache-Control:
|
30
|
+
- max-age=2592000
|
31
|
+
Expires:
|
32
|
+
- Mon, 08 Oct 2018 20:12:05 GMT
|
33
|
+
Vary:
|
34
|
+
- Accept-Encoding,User-Agent
|
35
|
+
Content-Length:
|
36
|
+
- '1427'
|
37
|
+
Connection:
|
38
|
+
- close
|
39
|
+
Content-Type:
|
40
|
+
- application/json
|
41
|
+
body:
|
42
|
+
encoding: ASCII-8BIT
|
43
|
+
string: '[{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Leeds
|
44
|
+
United","overall_league_position":"1","overall_league_payed":"6","overall_league_W":"4","overall_league_D":"2","overall_league_L":"0","overall_league_GF":"14","overall_league_GA":"4","overall_league_PTS":"14","home_league_position":"1","home_league_payed":"3","home_league_W":"2","home_league_D":"1","home_league_L":"0","home_league_GF":"5","home_league_GA":"1","home_league_PTS":"7","away_league_position":"1","away_league_payed":"3","away_league_W":"2","away_league_D":"1","away_league_L":"0","away_league_GF":"9","away_league_GA":"3","away_league_PTS":"7"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Middlesbrough","overall_league_position":"2","overall_league_payed":"6","overall_league_W":"4","overall_league_D":"2","overall_league_L":"0","overall_league_GF":"9","overall_league_GA":"2","overall_league_PTS":"14","home_league_position":"2","home_league_payed":"3","home_league_W":"3","home_league_D":"0","home_league_L":"0","home_league_GF":"5","home_league_GA":"0","home_league_PTS":"9","away_league_position":"2","away_league_payed":"3","away_league_W":"1","away_league_D":"2","away_league_L":"0","away_league_GF":"4","away_league_GA":"2","away_league_PTS":"5"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Sheffield
|
45
|
+
United","overall_league_position":"3","overall_league_payed":"6","overall_league_W":"4","overall_league_D":"0","overall_league_L":"2","overall_league_GF":"12","overall_league_GA":"8","overall_league_PTS":"12","home_league_position":"3","home_league_payed":"3","home_league_W":"2","home_league_D":"0","home_league_L":"1","home_league_GF":"7","home_league_GA":"4","home_league_PTS":"6","away_league_position":"3","away_league_payed":"3","away_league_W":"2","away_league_D":"0","away_league_L":"1","away_league_GF":"5","away_league_GA":"4","away_league_PTS":"6"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Derby
|
46
|
+
County","overall_league_position":"4","overall_league_payed":"6","overall_league_W":"4","overall_league_D":"0","overall_league_L":"2","overall_league_GF":"10","overall_league_GA":"8","overall_league_PTS":"12","home_league_position":"4","home_league_payed":"3","home_league_W":"2","home_league_D":"0","home_league_L":"1","home_league_GF":"5","home_league_GA":"4","home_league_PTS":"6","away_league_position":"4","away_league_payed":"3","away_league_W":"2","away_league_D":"0","away_league_L":"1","away_league_GF":"5","away_league_GA":"4","away_league_PTS":"6"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Brentford","overall_league_position":"5","overall_league_payed":"6","overall_league_W":"3","overall_league_D":"2","overall_league_L":"1","overall_league_GF":"12","overall_league_GA":"6","overall_league_PTS":"11","home_league_position":"5","home_league_payed":"3","home_league_W":"3","home_league_D":"0","home_league_L":"0","home_league_GF":"9","home_league_GA":"2","home_league_PTS":"9","away_league_position":"5","away_league_payed":"3","away_league_W":"0","away_league_D":"2","away_league_L":"1","away_league_GF":"3","away_league_GA":"4","away_league_PTS":"2"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Bristol
|
47
|
+
City","overall_league_position":"6","overall_league_payed":"6","overall_league_W":"3","overall_league_D":"2","overall_league_L":"1","overall_league_GF":"11","overall_league_GA":"6","overall_league_PTS":"11","home_league_position":"6","home_league_payed":"3","home_league_W":"1","home_league_D":"1","home_league_L":"1","home_league_GF":"5","home_league_GA":"4","home_league_PTS":"4","away_league_position":"6","away_league_payed":"3","away_league_W":"2","away_league_D":"1","away_league_L":"0","away_league_GF":"6","away_league_GA":"2","away_league_PTS":"7"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Swansea
|
48
|
+
City","overall_league_position":"7","overall_league_payed":"6","overall_league_W":"3","overall_league_D":"2","overall_league_L":"1","overall_league_GF":"7","overall_league_GA":"5","overall_league_PTS":"11","home_league_position":"7","home_league_payed":"3","home_league_W":"1","home_league_D":"1","home_league_L":"1","home_league_GF":"3","home_league_GA":"3","home_league_PTS":"4","away_league_position":"7","away_league_payed":"3","away_league_W":"2","away_league_D":"1","away_league_L":"0","away_league_GF":"4","away_league_GA":"2","away_league_PTS":"7"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Bolton
|
49
|
+
Wanderers","overall_league_position":"8","overall_league_payed":"6","overall_league_W":"3","overall_league_D":"2","overall_league_L":"1","overall_league_GF":"8","overall_league_GA":"8","overall_league_PTS":"11","home_league_position":"8","home_league_payed":"3","home_league_W":"1","home_league_D":"1","home_league_L":"1","home_league_GF":"3","home_league_GA":"5","home_league_PTS":"4","away_league_position":"8","away_league_payed":"3","away_league_W":"2","away_league_D":"1","away_league_L":"0","away_league_GF":"5","away_league_GA":"3","away_league_PTS":"7"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"West
|
50
|
+
Bromwich Albion","overall_league_position":"9","overall_league_payed":"6","overall_league_W":"3","overall_league_D":"1","overall_league_L":"2","overall_league_GF":"15","overall_league_GA":"9","overall_league_PTS":"10","home_league_position":"9","home_league_payed":"3","home_league_W":"2","home_league_D":"0","home_league_L":"1","home_league_GF":"10","home_league_GA":"4","home_league_PTS":"6","away_league_position":"9","away_league_payed":"3","away_league_W":"1","away_league_D":"1","away_league_L":"1","away_league_GF":"5","away_league_GA":"5","away_league_PTS":"4"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Wigan
|
51
|
+
Athletic","overall_league_position":"10","overall_league_payed":"6","overall_league_W":"3","overall_league_D":"1","overall_league_L":"2","overall_league_GF":"11","overall_league_GA":"8","overall_league_PTS":"10","home_league_position":"10","home_league_payed":"3","home_league_W":"2","home_league_D":"1","home_league_L":"0","home_league_GF":"6","home_league_GA":"4","home_league_PTS":"7","away_league_position":"10","away_league_payed":"3","away_league_W":"1","away_league_D":"0","away_league_L":"2","away_league_GF":"5","away_league_GA":"4","away_league_PTS":"3"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Sheffield
|
52
|
+
Wednesday","overall_league_position":"11","overall_league_payed":"6","overall_league_W":"3","overall_league_D":"1","overall_league_L":"2","overall_league_GF":"9","overall_league_GA":"9","overall_league_PTS":"10","home_league_position":"11","home_league_payed":"3","home_league_W":"2","home_league_D":"1","home_league_L":"0","home_league_GF":"5","home_league_GA":"3","home_league_PTS":"7","away_league_position":"11","away_league_payed":"3","away_league_W":"1","away_league_D":"0","away_league_L":"2","away_league_GF":"4","away_league_GA":"6","away_league_PTS":"3"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Aston
|
53
|
+
Villa","overall_league_position":"12","overall_league_payed":"6","overall_league_W":"2","overall_league_D":"3","overall_league_L":"1","overall_league_GF":"11","overall_league_GA":"11","overall_league_PTS":"9","home_league_position":"12","home_league_payed":"3","home_league_W":"1","home_league_D":"2","home_league_L":"0","home_league_GF":"6","home_league_GA":"5","home_league_PTS":"5","away_league_position":"12","away_league_payed":"3","away_league_W":"1","away_league_D":"1","away_league_L":"1","away_league_GF":"5","away_league_GA":"6","away_league_PTS":"4"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Blackburn
|
54
|
+
Rovers","overall_league_position":"13","overall_league_payed":"6","overall_league_W":"2","overall_league_D":"3","overall_league_L":"1","overall_league_GF":"7","overall_league_GA":"8","overall_league_PTS":"9","home_league_position":"13","home_league_payed":"3","home_league_W":"1","home_league_D":"2","home_league_L":"0","home_league_GF":"3","home_league_GA":"2","home_league_PTS":"5","away_league_position":"13","away_league_payed":"3","away_league_W":"1","away_league_D":"1","away_league_L":"1","away_league_GF":"4","away_league_GA":"6","away_league_PTS":"4"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Nottingham
|
55
|
+
Forest","overall_league_position":"14","overall_league_payed":"6","overall_league_W":"1","overall_league_D":"4","overall_league_L":"1","overall_league_GF":"8","overall_league_GA":"8","overall_league_PTS":"7","home_league_position":"14","home_league_payed":"3","home_league_W":"1","home_league_D":"2","home_league_L":"0","home_league_GF":"4","home_league_GA":"3","home_league_PTS":"5","away_league_position":"14","away_league_payed":"3","away_league_W":"0","away_league_D":"2","away_league_L":"1","away_league_GF":"4","away_league_GA":"5","away_league_PTS":"2"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Rotherham
|
56
|
+
United","overall_league_position":"15","overall_league_payed":"6","overall_league_W":"2","overall_league_D":"0","overall_league_L":"4","overall_league_GF":"5","overall_league_GA":"11","overall_league_PTS":"6","home_league_position":"15","home_league_payed":"3","home_league_W":"2","home_league_D":"0","home_league_L":"1","home_league_GF":"4","home_league_GA":"3","home_league_PTS":"6","away_league_position":"15","away_league_payed":"3","away_league_W":"0","away_league_D":"0","away_league_L":"3","away_league_GF":"1","away_league_GA":"8","away_league_PTS":"0"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Millwall","overall_league_position":"16","overall_league_payed":"6","overall_league_W":"1","overall_league_D":"2","overall_league_L":"3","overall_league_GF":"6","overall_league_GA":"8","overall_league_PTS":"5","home_league_position":"16","home_league_payed":"3","home_league_W":"1","home_league_D":"1","home_league_L":"1","home_league_GF":"5","home_league_GA":"5","home_league_PTS":"4","away_league_position":"16","away_league_payed":"3","away_league_W":"0","away_league_D":"1","away_league_L":"2","away_league_GF":"1","away_league_GA":"3","away_league_PTS":"1"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Norwich
|
57
|
+
City","overall_league_position":"17","overall_league_payed":"6","overall_league_W":"1","overall_league_D":"2","overall_league_L":"3","overall_league_GF":"9","overall_league_GA":"12","overall_league_PTS":"5","home_league_position":"17","home_league_payed":"3","home_league_W":"1","home_league_D":"0","home_league_L":"2","home_league_GF":"5","home_league_GA":"7","home_league_PTS":"3","away_league_position":"17","away_league_payed":"3","away_league_W":"0","away_league_D":"2","away_league_L":"1","away_league_GF":"4","away_league_GA":"5","away_league_PTS":"2"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Stoke
|
58
|
+
City","overall_league_position":"18","overall_league_payed":"6","overall_league_W":"1","overall_league_D":"2","overall_league_L":"3","overall_league_GF":"7","overall_league_GA":"11","overall_league_PTS":"5","home_league_position":"18","home_league_payed":"3","home_league_W":"1","home_league_D":"1","home_league_L":"1","home_league_GF":"3","home_league_GA":"4","home_league_PTS":"4","away_league_position":"18","away_league_payed":"3","away_league_W":"0","away_league_D":"1","away_league_L":"2","away_league_GF":"4","away_league_GA":"7","away_league_PTS":"1"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Preston
|
59
|
+
North End","overall_league_position":"19","overall_league_payed":"6","overall_league_W":"1","overall_league_D":"2","overall_league_L":"3","overall_league_GF":"5","overall_league_GA":"9","overall_league_PTS":"5","home_league_position":"19","home_league_payed":"3","home_league_W":"1","home_league_D":"2","home_league_L":"0","home_league_GF":"5","home_league_GA":"4","home_league_PTS":"5","away_league_position":"19","away_league_payed":"3","away_league_W":"0","away_league_D":"0","away_league_L":"3","away_league_GF":"0","away_league_GA":"5","away_league_PTS":"0"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Birmingham
|
60
|
+
City","overall_league_position":"20","overall_league_payed":"6","overall_league_W":"0","overall_league_D":"4","overall_league_L":"2","overall_league_GF":"4","overall_league_GA":"6","overall_league_PTS":"4","home_league_position":"20","home_league_payed":"3","home_league_W":"0","home_league_D":"3","home_league_L":"0","home_league_GF":"2","home_league_GA":"2","home_league_PTS":"3","away_league_position":"20","away_league_payed":"3","away_league_W":"0","away_league_D":"1","away_league_L":"2","away_league_GF":"2","away_league_GA":"4","away_league_PTS":"1"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Hull
|
61
|
+
City","overall_league_position":"21","overall_league_payed":"6","overall_league_W":"1","overall_league_D":"1","overall_league_L":"4","overall_league_GF":"6","overall_league_GA":"11","overall_league_PTS":"4","home_league_position":"21","home_league_payed":"3","home_league_W":"0","home_league_D":"0","home_league_L":"3","home_league_GF":"2","home_league_GA":"6","home_league_PTS":"0","away_league_position":"21","away_league_payed":"3","away_league_W":"1","away_league_D":"1","away_league_L":"1","away_league_GF":"4","away_league_GA":"5","away_league_PTS":"4"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Queens
|
62
|
+
Park Rangers","overall_league_position":"22","overall_league_payed":"6","overall_league_W":"1","overall_league_D":"1","overall_league_L":"4","overall_league_GF":"3","overall_league_GA":"13","overall_league_PTS":"4","home_league_position":"22","home_league_payed":"3","home_league_W":"1","home_league_D":"0","home_league_L":"2","home_league_GF":"2","home_league_GA":"5","home_league_PTS":"3","away_league_position":"22","away_league_payed":"3","away_league_W":"0","away_league_D":"1","away_league_L":"2","away_league_GF":"1","away_league_GA":"8","away_league_PTS":"1"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Ipswich
|
63
|
+
Town","overall_league_position":"23","overall_league_payed":"6","overall_league_W":"0","overall_league_D":"3","overall_league_L":"3","overall_league_GF":"5","overall_league_GA":"9","overall_league_PTS":"3","home_league_position":"23","home_league_payed":"3","home_league_W":"0","home_league_D":"3","home_league_L":"0","home_league_GF":"4","home_league_GA":"4","home_league_PTS":"3","away_league_position":"23","away_league_payed":"3","away_league_W":"0","away_league_D":"0","away_league_L":"3","away_league_GF":"1","away_league_GA":"5","away_league_PTS":"0"},{"country_name":"England","league_id":"63","league_name":"Championship","team_name":"Reading","overall_league_position":"24","overall_league_payed":"6","overall_league_W":"0","overall_league_D":"2","overall_league_L":"4","overall_league_GF":"5","overall_league_GA":"9","overall_league_PTS":"2","home_league_position":"24","home_league_payed":"3","home_league_W":"0","home_league_D":"0","home_league_L":"3","home_league_GF":"2","home_league_GA":"5","home_league_PTS":"0","away_league_position":"24","away_league_payed":"3","away_league_W":"0","away_league_D":"2","away_league_L":"1","away_league_GF":"3","away_league_GA":"4","away_league_PTS":"2"}]'
|
64
|
+
http_version:
|
65
|
+
recorded_at: Sat, 08 Sep 2018 22:12:06 GMT
|
66
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ApiFootball
|
4
|
+
class Client
|
5
|
+
attr_reader :api_key
|
6
|
+
|
7
|
+
def initialize(api_key:)
|
8
|
+
@api_key = api_key
|
9
|
+
end
|
10
|
+
|
11
|
+
def http
|
12
|
+
@http ||= ApiFootball::Http.new(api_key: api_key)
|
13
|
+
end
|
14
|
+
|
15
|
+
def countries
|
16
|
+
@countries ||= Country.new(http: http)
|
17
|
+
end
|
18
|
+
|
19
|
+
def competitions
|
20
|
+
@competitions ||= Competition.new(http: http)
|
21
|
+
end
|
22
|
+
|
23
|
+
def events
|
24
|
+
@events ||= Event.new(http: http)
|
25
|
+
end
|
26
|
+
|
27
|
+
def standings
|
28
|
+
@standings ||= Standing.new(http: http)
|
29
|
+
end
|
30
|
+
|
31
|
+
def odds
|
32
|
+
@odds ||= Odd.new(http: http)
|
33
|
+
end
|
34
|
+
|
35
|
+
def h2h
|
36
|
+
@h2h ||= H2h.new(http: http)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ApiFootball
|
4
|
+
class Competition
|
5
|
+
attr_reader :http
|
6
|
+
def initialize(http:)
|
7
|
+
@http = http
|
8
|
+
end
|
9
|
+
|
10
|
+
def all
|
11
|
+
http.request(action: :get_leagues)
|
12
|
+
end
|
13
|
+
|
14
|
+
def filter_by(params)
|
15
|
+
http.request({ action: :get_leagues }.merge(params))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ApiFootball
|
4
|
+
class Event
|
5
|
+
attr_reader :http
|
6
|
+
def initialize(http:)
|
7
|
+
@http = http
|
8
|
+
end
|
9
|
+
|
10
|
+
def all(to:, from:)
|
11
|
+
http.request(action: :get_events, to: to, from: from)
|
12
|
+
end
|
13
|
+
|
14
|
+
def filter_by(params)
|
15
|
+
valid_params!(params)
|
16
|
+
http.request({ action: :get_events }.merge(params))
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def valid_params!(params)
|
22
|
+
return true if params_valid?(params)
|
23
|
+
raise ApiFootball::Error::ArgumentError.new(
|
24
|
+
"params required: #{required_params.join(", ")}"
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def params_valid?(params)
|
29
|
+
(required_params - params.keys.map(&:to_s)).empty?
|
30
|
+
end
|
31
|
+
|
32
|
+
def required_params
|
33
|
+
["to", "from"]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ApiFootball
|
4
|
+
class H2h
|
5
|
+
attr_reader :http
|
6
|
+
def initialize(http:)
|
7
|
+
@http = http
|
8
|
+
end
|
9
|
+
|
10
|
+
def all(first_team:, second_team:)
|
11
|
+
http.request(
|
12
|
+
action: :get_odds,
|
13
|
+
firstTeam: first_team,
|
14
|
+
secondTeam: second_team
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ApiFootball
|
4
|
+
class Http
|
5
|
+
attr_reader :api_key, :adapter
|
6
|
+
ENDPOINT = "https://apifootball.com/api/"
|
7
|
+
|
8
|
+
def initialize(api_key:, adapter: nil)
|
9
|
+
@api_key = api_key
|
10
|
+
@adapter = adapter
|
11
|
+
end
|
12
|
+
|
13
|
+
def request(params)
|
14
|
+
ApiFootball::Response.new(
|
15
|
+
body: client.get(nil, default_params.merge(params)).body
|
16
|
+
).result
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_params
|
20
|
+
{ APIkey: api_key }
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def client
|
26
|
+
Faraday.new(url: ENDPOINT) do |faraday|
|
27
|
+
faraday.adapter adapter || Faraday.default_adapter
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ApiFootball
|
4
|
+
class Odd
|
5
|
+
attr_reader :http
|
6
|
+
def initialize(http:)
|
7
|
+
@http = http
|
8
|
+
end
|
9
|
+
|
10
|
+
def all(to:, from:)
|
11
|
+
http.request(action: :get_odds, to: to, from: from)
|
12
|
+
end
|
13
|
+
|
14
|
+
def filter_by(params)
|
15
|
+
valid_params!(params)
|
16
|
+
http.request({ action: :get_odds }.merge(params))
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def valid_params!(params)
|
21
|
+
return true if params_valid?(params)
|
22
|
+
raise ApiFootball::Error::ArgumentError.new(
|
23
|
+
"params required: #{required_params.join(", ")}"
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def params_valid?(params)
|
28
|
+
(required_params - params.keys.map(&:to_s)).empty?
|
29
|
+
end
|
30
|
+
|
31
|
+
def required_params
|
32
|
+
["to", "from"]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ApiFootball
|
4
|
+
class Response
|
5
|
+
attr_reader :body, :result
|
6
|
+
|
7
|
+
def initialize(body:)
|
8
|
+
@result = JSON.parse(body)
|
9
|
+
if @result.kind_of?(Hash) && @result.key?("error")
|
10
|
+
raise ApiFootball::Error::ApiError, @result["message"]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ApiFootball
|
4
|
+
class Standing
|
5
|
+
attr_reader :http
|
6
|
+
def initialize(http:)
|
7
|
+
@http = http
|
8
|
+
end
|
9
|
+
|
10
|
+
def all
|
11
|
+
http.request(action: :get_standings)
|
12
|
+
end
|
13
|
+
|
14
|
+
def filter_by(params)
|
15
|
+
http.request({ action: :get_standings }.merge(params))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/api_football.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
require "json"
|
5
|
+
require "api_football/version"
|
6
|
+
require "api_football/error"
|
7
|
+
require "api_football/http"
|
8
|
+
require "api_football/response"
|
9
|
+
require "api_football/client"
|
10
|
+
require "api_football/country"
|
11
|
+
require "api_football/competition"
|
12
|
+
require "api_football/standing"
|
13
|
+
require "api_football/event"
|
14
|
+
require "api_football/odd"
|
15
|
+
require "api_football/h2h"
|
16
|
+
|
17
|
+
module ApiFootball
|
18
|
+
end
|