footballdata 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4342bd0fd7a19bc6c8772cbed047ea3760ad5233
4
- data.tar.gz: b5f999cc7044e5694d1641ae9467e65bddb77696
3
+ metadata.gz: 306876da856af0139c78807cc9cb6613bb7ee6be
4
+ data.tar.gz: 3963a026833ed2ee76d3e810bb721c10e41ee8d0
5
5
  SHA512:
6
- metadata.gz: c36ccdc8234fe85a01923320dd7085049a36821288d5988412cf559b3a3ef43d60965bf6ad1e248e86b3c7d1496a1004dffd95e6a34fdc2a8539f812bf6eb1f9
7
- data.tar.gz: 574a527ac87c75dcf154c912cdc0b8dcff417b20f8226f43d684e090d2e881694e4771b23f351d94c0621bef7a968f882efb560acf2ca6adae3c1f9175cc69e0
6
+ metadata.gz: fe2393e1d7d571b505a4e65947bfcd94f05558bc5ced6f7794bdd60e94cae1f3bedc20af39d94a5d0790f9025cf06d8c51418951bd92367f78599d926446ac58
7
+ data.tar.gz: b33cb0af68e7ee3adf5ff1f1d0ed02d87e0c35eeebfb0e04ce3ed6abaa36f9bc95b8a4533f5a7436c50b2e1c8d72475589d2d36d145051c3d63ec32806cdc007
@@ -0,0 +1,8 @@
1
+
2
+ *.gem
3
+
4
+ tmp/spam_triggers.json
5
+
6
+ .byebug_history
7
+
8
+ .env
@@ -0,0 +1,64 @@
1
+ ![Codeship](https://codeship.com/projects/380af8b0-a881-0133-6083-4ae619b9c646/status?branch=master)
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
@@ -0,0 +1,11 @@
1
+ require 'rake/testtask'
2
+ require 'dotenv'
3
+
4
+ Dotenv.load
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.libs << 'test'
8
+ end
9
+
10
+ desc "Run tests"
11
+ task :default => :test
@@ -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
@@ -1,10 +1,10 @@
1
1
  require "json"
2
2
  require "open-uri"
3
3
 
4
- require './lib/models/fixture'
5
- require './lib/models/team'
6
- require './lib/models/league'
7
- require './lib/configuration'
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.1'
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