footballdata 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/README.md +64 -0
- data/Rakefile +11 -0
- data/footballdata.gemspec +18 -0
- data/lib/footballdata.rb +4 -4
- data/test/test_football_data.rb +19 -0
- metadata +6 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 306876da856af0139c78807cc9cb6613bb7ee6be
|
|
4
|
+
data.tar.gz: 3963a026833ed2ee76d3e810bb721c10e41ee8d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fe2393e1d7d571b505a4e65947bfcd94f05558bc5ced6f7794bdd60e94cae1f3bedc20af39d94a5d0790f9025cf06d8c51418951bd92367f78599d926446ac58
|
|
7
|
+
data.tar.gz: b33cb0af68e7ee3adf5ff1f1d0ed02d87e0c35eeebfb0e04ce3ed6abaa36f9bc95b8a4533f5a7436c50b2e1c8d72475589d2d36d145051c3d63ec32806cdc007
|
data/.gitignore
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# FootballData
|
|
5
|
+
|
|
6
|
+
Wrapper for the football-data.org API.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
Add this to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
gem "footballdata", "~> 0.1"
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
## Example usage
|
|
18
|
+
|
|
19
|
+
Currently, this wrapper supports fetching leagues, teams and their fixtures.
|
|
20
|
+
|
|
21
|
+
``` ruby
|
|
22
|
+
$ Footballdata.leagues
|
|
23
|
+
# This will return an Array with the available leagues.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
``` ruby
|
|
27
|
+
$ Footballdata.leagues.first.fixtures
|
|
28
|
+
# This will return an Array with the fixtures for this league's current season.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
``` ruby
|
|
32
|
+
$ Footballdata.leagues.first.teams
|
|
33
|
+
# This will return an Array with the first league's teams.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
``` ruby
|
|
37
|
+
$ Footballdata.leagues.first.teams.first.fixtures
|
|
38
|
+
# This will return an Array with the first team's fixtures.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Configuration
|
|
42
|
+
|
|
43
|
+
If you've got an API key from football-data.org, you can set this via either an initializer:
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
# config/initializers/football_data.rb
|
|
47
|
+
Footballdata.configure do |config|
|
|
48
|
+
config.api_key = "YOURAPIKEY"
|
|
49
|
+
end
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or via an environment variable:
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
ENV["API_KEY"] = "YOURAPIKEY"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Contributing
|
|
59
|
+
|
|
60
|
+
1. Fork it
|
|
61
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
62
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
63
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
64
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |gem|
|
|
4
|
+
gem.name = 'footballdata'
|
|
5
|
+
gem.version = '0.2'
|
|
6
|
+
gem.date = '2016-01-27'
|
|
7
|
+
gem.authors = ["Joshua Jansen"]
|
|
8
|
+
gem.email = ["joshuajansen88@gmail.com"]
|
|
9
|
+
gem.description = %q{Wrapper for the football-data.org API}
|
|
10
|
+
gem.summary = %q{This gem leverages the football-data.org API to get football data like teams and results.}
|
|
11
|
+
gem.homepage = "https://github.com/joshuajansen/footballdata"
|
|
12
|
+
|
|
13
|
+
gem.files = `git ls-files`.split($\)
|
|
14
|
+
gem.license = 'MIT'
|
|
15
|
+
|
|
16
|
+
gem.add_runtime_dependency "sanitize", "~> 4.0"
|
|
17
|
+
gem.add_development_dependency "dotenv", "~> 2.1"
|
|
18
|
+
end
|
data/lib/footballdata.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
require "open-uri"
|
|
3
3
|
|
|
4
|
-
require '
|
|
5
|
-
require '
|
|
6
|
-
require '
|
|
7
|
-
require '
|
|
4
|
+
require 'models/fixture'
|
|
5
|
+
require 'models/team'
|
|
6
|
+
require 'models/league'
|
|
7
|
+
require 'configuration'
|
|
8
8
|
|
|
9
9
|
BASE_URL = "http://api.football-data.org/v1"
|
|
10
10
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require 'footballdata'
|
|
3
|
+
|
|
4
|
+
class TestFootballdata < Minitest::Test
|
|
5
|
+
def test_leagues_fetches_major_leagues
|
|
6
|
+
leagues = Footballdata.leagues
|
|
7
|
+
|
|
8
|
+
assert leagues.first.is_a? Footballdata::League
|
|
9
|
+
assert leagues.first.teams.first.is_a? Footballdata::Team
|
|
10
|
+
assert leagues.first.fixtures.first.is_a? Footballdata::Fixture
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_find_team_returns_team
|
|
14
|
+
team = Footballdata.team(1)
|
|
15
|
+
|
|
16
|
+
assert team.is_a? Footballdata::Team
|
|
17
|
+
assert team.fixtures.first.is_a? Footballdata::Fixture
|
|
18
|
+
end
|
|
19
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: footballdata
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.2'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joshua Jansen
|
|
@@ -45,11 +45,16 @@ executables: []
|
|
|
45
45
|
extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
|
47
47
|
files:
|
|
48
|
+
- ".gitignore"
|
|
49
|
+
- README.md
|
|
50
|
+
- Rakefile
|
|
51
|
+
- footballdata.gemspec
|
|
48
52
|
- lib/configuration.rb
|
|
49
53
|
- lib/footballdata.rb
|
|
50
54
|
- lib/models/fixture.rb
|
|
51
55
|
- lib/models/league.rb
|
|
52
56
|
- lib/models/team.rb
|
|
57
|
+
- test/test_football_data.rb
|
|
53
58
|
homepage: https://github.com/joshuajansen/footballdata
|
|
54
59
|
licenses:
|
|
55
60
|
- MIT
|