opta_sd 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 847ce22203095424651f83675de69d9ffb5fa385
4
- data.tar.gz: 8f039445d073795f3c53aa6220b97b7b88935cfa
3
+ metadata.gz: b05838606d5aec71c44d53b9b36e08a6edb3b9f2
4
+ data.tar.gz: a2efaf04c4d2bc3404d4303427d98e2af91ea7d9
5
5
  SHA512:
6
- metadata.gz: 587284cea05cece9d49e277f6cad246ad1e3f89ae7e992e4cd0f3e52404dcd0cf7bf042b9b74093378c96a64d32bca686af88934408798b9fda68dcc4f6ca73b
7
- data.tar.gz: 87753fa9c9992f71b40834e9ffa6c54bdc85cad378adb10c938245768ebad68ae81f2a81467ad90b9d8fa6fba1cc6d036a153c382eee2f35e75a20e01da5f1fc
6
+ metadata.gz: 7506dbb1a6b244daf66494ffa29bccfa316bdb7195bd70bbc2d59b46a2cba39bad5b8b265c14d669b8a0a53ffcc22e32e2bffb4947b734c292e1692f11c6b3c5
7
+ data.tar.gz: ee4fb65491efdf7ecb4c89195756a905b6f9bc3d2a674d8408287ced9eee31ef1b4c96b74fcfe2cd8e0a90236edc43c394886e36049269309ecad9de618294d4
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
1
  .byebug_history
2
+ .bundle
3
+ vendor
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
@@ -0,0 +1,15 @@
1
+ # CHANGELOG
2
+
3
+ ## 1.1 - ( Master ) - 6 May 2017
4
+
5
+ ### Add
6
+ - Add Venues
7
+
8
+ ### Changed
9
+ - Refactor all parameters methods in Core class and `config/parameters.yml`
10
+ - Update Matches `time_range` format
11
+
12
+ ## 1.0 ( First Release ) - 3 Feb 2017
13
+
14
+ ### ADD
15
+ - Initial release
data/Gemfile CHANGED
@@ -10,13 +10,14 @@ gemspec
10
10
  # Git. Remember to move these dependencies to your gemspec before releasing
11
11
  # your gem to rubygems.org.
12
12
 
13
- gem 'activesupport'
13
+ # gem 'activesupport'
14
14
 
15
15
  gem 'nokogiri', '~> 1.7', '>= 1.7.0.1'
16
16
 
17
17
  group :development, :test do
18
18
  # To use a debugger
19
- gem 'byebug'
20
- gem 'pry'
19
+ gem 'rake', '~> 12.0'
20
+ gem 'byebug', '~> 9.0', '>= 9.0.6'
21
+ gem 'pry', '~> 0.10.4'
21
22
  gem 'rspec'
22
23
  end
@@ -1,63 +1,52 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opta_sd (1.0.0)
5
- bundler
4
+ opta_sd (1.1.0)
6
5
  json
7
6
  nokogiri (~> 1.7, >= 1.7.0.1)
8
- rspec (~> 3.5)
9
7
 
10
8
  GEM
11
9
  remote: https://rubygems.org/
12
10
  specs:
13
- activesupport (5.0.1)
14
- concurrent-ruby (~> 1.0, >= 1.0.2)
15
- i18n (~> 0.7)
16
- minitest (~> 5.1)
17
- tzinfo (~> 1.1)
18
11
  byebug (9.0.6)
19
12
  coderay (1.1.1)
20
- concurrent-ruby (1.0.4)
21
13
  diff-lcs (1.3)
22
- i18n (0.8.0)
23
- json (2.0.3)
14
+ json (2.1.0)
24
15
  method_source (0.8.2)
25
16
  mini_portile2 (2.1.0)
26
- minitest (5.10.1)
27
- nokogiri (1.7.0.1)
17
+ nokogiri (1.7.1)
28
18
  mini_portile2 (~> 2.1.0)
29
19
  pry (0.10.4)
30
20
  coderay (~> 1.1.0)
31
21
  method_source (~> 0.8.1)
32
22
  slop (~> 3.4)
33
- rspec (3.5.0)
34
- rspec-core (~> 3.5.0)
35
- rspec-expectations (~> 3.5.0)
36
- rspec-mocks (~> 3.5.0)
37
- rspec-core (3.5.4)
38
- rspec-support (~> 3.5.0)
39
- rspec-expectations (3.5.0)
23
+ rake (12.0.0)
24
+ rspec (3.6.0)
25
+ rspec-core (~> 3.6.0)
26
+ rspec-expectations (~> 3.6.0)
27
+ rspec-mocks (~> 3.6.0)
28
+ rspec-core (3.6.0)
29
+ rspec-support (~> 3.6.0)
30
+ rspec-expectations (3.6.0)
40
31
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.5.0)
42
- rspec-mocks (3.5.0)
32
+ rspec-support (~> 3.6.0)
33
+ rspec-mocks (3.6.0)
43
34
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.5.0)
45
- rspec-support (3.5.0)
35
+ rspec-support (~> 3.6.0)
36
+ rspec-support (3.6.0)
46
37
  slop (3.6.0)
47
- thread_safe (0.3.5)
48
- tzinfo (1.2.2)
49
- thread_safe (~> 0.1)
50
38
 
51
39
  PLATFORMS
52
40
  ruby
53
41
 
54
42
  DEPENDENCIES
55
- activesupport
56
- byebug
43
+ bundler
44
+ byebug (~> 9.0, >= 9.0.6)
57
45
  nokogiri (~> 1.7, >= 1.7.0.1)
58
46
  opta_sd!
59
- pry
47
+ pry (~> 0.10.4)
48
+ rake (~> 12.0)
60
49
  rspec
61
50
 
62
51
  BUNDLED WITH
63
- 1.13.7
52
+ 1.14.6
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
- # OPTA Sports Data Soccer API
1
+ # OPTA Sports Data Soccer API (OPTA SDAPI)
2
2
 
3
- OPTA SD is a library to Integrate and Utilize Opta Sports Data Apis.
3
+ [![Ruby Gem](https://img.shields.io/gem/v/opta_sd.svg)](https://rubygems.org/gems/opta_sd)
4
+ [![Build Status](https://travis-ci.org/ali-sheiba/opta_sd.svg?branch=master)](https://travis-ci.org/ali-sheiba/opta_sd?branch=master)
5
+
6
+
7
+ Ruby API Client for OPTA SDAPI (Sports Data Soccer API)
4
8
 
5
9
  ## Installation
6
10
 
@@ -47,6 +51,7 @@ Tournament Calendars | [TournamentCalendar](#12-tournament-calenda
47
51
  Match Preview | [MatchPreview](#13-match-preview) | `/soccerdata/matchpreview/...`
48
52
  Rankings | [Rankings](#14-rankings) | `/soccerdata/rankings/...`
49
53
  Tournament Schedule | [TournamentSchedule](#15-tournament-schedule) | `/soccerdata/tournamentschedule/...`
54
+ Venues | [Venues](#16-venues) | `/soccerdata/venues/...`
50
55
 
51
56
  ### Parameter Methods :
52
57
 
@@ -383,6 +388,22 @@ Available Parameters:
383
388
  - `resource(tournament_id)`
384
389
  - `tournament(tournament_id)`
385
390
 
391
+
392
+ ### 16\. Venues
393
+
394
+ ```ruby
395
+ # Get Venues
396
+ OptaSD::Soccer::Venues.new.venue('bdkmbkf8yi951wrjraknp9wad').get
397
+ OptaSD::Soccer::Venues.new.tournament('9xjsbe05up1jqycf7no90as4p').get
398
+ OptaSD::Soccer::Venues.new.contestant('c8h9bw1l82s06h77xxrelzhur').get
399
+ ```
400
+
401
+ Available Parameters:
402
+
403
+ - `venue(venue_id)`
404
+ - `tournament(tournament_id)`
405
+ - `contestant(contestant_id)`
406
+
386
407
  --------------------------------------------------------------------------------
387
408
 
388
409
  ## Contributing
data/Rakefile CHANGED
@@ -1 +1,5 @@
1
- require 'bundler/gem_tasks'
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new(:spec)
4
+
5
+ task :default => :spec
@@ -1,74 +1,25 @@
1
1
  core:
2
- _rt: "_rt"
3
- _format: "_fmt"
4
- _locale: "_lcl"
5
- _callback: "_clbk"
6
- _sort: "_ordSrt"
7
- _page_size: "_pgSz"
2
+ _callback: "_clbk"
3
+ _format: "_fmt"
4
+ _locale: "_lcl"
8
5
  _page_number: "_pgNm"
9
-
10
- match:
11
- fixture: "fx"
12
- tournament: "tmcl" # tournament_calendar
13
- stage: "stg"
14
- competition: "comp"
15
- contestant: "ctst"
16
- match_time: "mt.mDt"
17
- match_date: "mt.mDt"
18
- live: "live"
19
- lineups: "lineups"
20
- status: "status"
21
-
22
- tournamentcalendar:
23
- competition: "comp"
24
-
25
- squads:
26
- tournament: "tmcl"
27
- contestant: "ctst"
28
- detailed: "detailed"
29
- people: "people"
30
-
31
- possession:
32
- fixture: "fx"
33
-
34
- matchevent:
35
- fixture: "fx"
36
-
37
- matchstats:
38
- fixture: "fx"
39
- detailed: "detailed"
40
-
41
- passmatrix:
42
- fixture: "fx"
43
-
44
- commentary:
45
- fixture: "fx"
46
- type: "type"
47
-
48
- matchfacts:
49
- fixture: "fx"
50
-
51
- seasonstats:
52
- tournament: "tmcl"
53
- contestant: "ctst"
54
- competition: "comp"
55
-
56
- standings:
57
- stage: "stg"
58
- tournament: "tmcl"
59
- live: "live"
60
- type: "type"
61
-
62
- playercareer:
63
- person: "prsn"
64
- active: "active"
65
- contestant: "ctst"
66
-
67
- matchpreview:
68
- fixture: "fx"
69
-
70
- rankings:
71
- tournament: "tmcl"
72
-
73
- tournamentschedule:
74
- tournament: "tmcl"
6
+ _page_size: "_pgSz"
7
+ _rt: "_rt"
8
+ _sort: "_ordSrt"
9
+
10
+ active: "active"
11
+ competition: "comp"
12
+ contestant: "ctst"
13
+ detailed: "detailed"
14
+ fixture: "fx"
15
+ lineups: "lineups"
16
+ live: "live"
17
+ match_date: "mt.mDt"
18
+ match_time: "mt.mDt"
19
+ people: "people"
20
+ person: "prsn"
21
+ stage: "stg"
22
+ status: "status"
23
+ tournament: "tmcl"
24
+ type: "type"
25
+ venue: "venue"
@@ -1,6 +1,7 @@
1
1
  # Project Requirements
2
2
  require 'yaml'
3
3
  require 'json'
4
+ require 'time'
4
5
  require 'nokogiri'
5
6
  require 'net/http'
6
7
 
@@ -23,6 +24,7 @@ require 'opta_sd/soccer/team_standings'
23
24
  require 'opta_sd/soccer/match_statistics'
24
25
  require 'opta_sd/soccer/tournament_calendar'
25
26
  require 'opta_sd/soccer/tournament_schedule'
27
+ require 'opta_sd/soccer/venues'
26
28
 
27
29
 
28
30
  # Wrapper Classes
@@ -96,24 +96,23 @@ module OptaSD
96
96
  ## ---------------------------------------- ##
97
97
 
98
98
  # Define resource for Boolean Parameters
99
- def self.boolean_params(model , *args)
99
+ def self.boolean_params(*args)
100
100
  args.each do |param_name|
101
101
  define_method param_name do |value = true|
102
- @params[PARAMETERS[model.to_s][param_name.to_s]] = value ? 'yes' : 'no'
102
+ @params[PARAMETERS[param_name.to_s]] = value ? 'yes' : 'no'
103
103
  self
104
104
  end
105
105
  end
106
106
  end
107
107
 
108
108
  # Define Pesource Parameters
109
- def self.resource_params(model, *args)
109
+ def self.resource_params(*args)
110
110
  args.each do |param_name|
111
111
  define_method param_name do |value|
112
- @params[PARAMETERS[model.to_s][param_name.to_s] || param_name.to_s] = value
112
+ @params[PARAMETERS[param_name.to_s] || param_name.to_s] = value
113
113
  self
114
114
  end
115
115
  end
116
116
  end
117
-
118
117
  end
119
118
  end
@@ -2,7 +2,7 @@ module OptaSD
2
2
  module Soccer
3
3
  class Commentary < OptaSD::Soccer::SoccerCore
4
4
 
5
- resource_params 'commentary', :fixture, :type
5
+ resource_params :fixture, :type
6
6
 
7
7
  def initialize
8
8
  super
@@ -2,8 +2,8 @@ module OptaSD
2
2
  module Soccer
3
3
  class Match < OptaSD::Soccer::SoccerCore
4
4
 
5
- boolean_params 'match', :live, :lineups
6
- resource_params 'match', :fixture, :tournament, :stage, :competition, :contestant, :match_time, :match_date, :status
5
+ boolean_params :live, :lineups
6
+ resource_params :fixture, :tournament, :stage, :competition, :contestant, :match_time, :match_date, :status
7
7
 
8
8
  def initialize
9
9
  super
@@ -11,10 +11,9 @@ module OptaSD
11
11
  end
12
12
 
13
13
  def time_range(from, to)
14
- match_time("[#{from.strftime('%Y-%m-%dT%H:%M:%SZ')} TO #{to.strftime('%Y-%m-%dT%H:%M:%SZ')}]")
14
+ match_time("[#{from.utc.iso8601} TO #{to.utc.iso8601}]")
15
15
  return self
16
16
  end
17
-
18
17
  end
19
18
  end
20
19
  end
@@ -2,7 +2,7 @@ module OptaSD
2
2
  module Soccer
3
3
  class MatchEvent < OptaSD::Soccer::SoccerCore
4
4
 
5
- resource_params 'matchevent', :fixture
5
+ resource_params :fixture
6
6
 
7
7
  def initialize
8
8
  super
@@ -2,7 +2,7 @@ module OptaSD
2
2
  module Soccer
3
3
  class MatchFacts < OptaSD::Soccer::SoccerCore
4
4
 
5
- resource_params 'matchfacts', :fixture
5
+ resource_params :fixture
6
6
 
7
7
  def initialize
8
8
  super
@@ -2,7 +2,7 @@ module OptaSD
2
2
  module Soccer
3
3
  class MatchPreview < OptaSD::Soccer::SoccerCore
4
4
 
5
- resource_params 'matchpreview', :fixture
5
+ resource_params :fixture
6
6
 
7
7
  def initialize
8
8
  super
@@ -2,8 +2,8 @@ module OptaSD
2
2
  module Soccer
3
3
  class MatchStatistics < OptaSD::Soccer::SoccerCore
4
4
 
5
- boolean_params 'matchstats', :detailed
6
- resource_params 'matchstats', :fixture
5
+ boolean_params :detailed
6
+ resource_params :fixture
7
7
 
8
8
  def initialize
9
9
  super
@@ -2,7 +2,7 @@ module OptaSD
2
2
  module Soccer
3
3
  class PassMatrix < OptaSD::Soccer::SoccerCore
4
4
 
5
- resource_params 'passmatrix', :fixture
5
+ resource_params :fixture
6
6
 
7
7
  def initialize
8
8
  super
@@ -2,8 +2,8 @@ module OptaSD
2
2
  module Soccer
3
3
  class PlayerCareer < OptaSD::Soccer::SoccerCore
4
4
 
5
- boolean_params 'playercareer', :active
6
- resource_params 'playercareer', :person, :contestant
5
+ boolean_params :active
6
+ resource_params :person, :contestant
7
7
 
8
8
  def initialize
9
9
  super
@@ -2,7 +2,7 @@ module OptaSD
2
2
  module Soccer
3
3
  class Possession < OptaSD::Soccer::SoccerCore
4
4
 
5
- resource_params 'possession', :fixture
5
+ resource_params :fixture
6
6
 
7
7
  def initialize
8
8
  super
@@ -2,7 +2,7 @@ module OptaSD
2
2
  module Soccer
3
3
  class Rankings < OptaSD::Soccer::SoccerCore
4
4
 
5
- resource_params 'rankings', :tournament
5
+ resource_params :tournament
6
6
 
7
7
  def initialize
8
8
  super
@@ -2,7 +2,7 @@ module OptaSD
2
2
  module Soccer
3
3
  class SeasonalStats < OptaSD::Soccer::SoccerCore
4
4
 
5
- resource_params 'seasonstats', :tournament, :contestant, :competition
5
+ resource_params :tournament, :contestant, :competition
6
6
 
7
7
  def initialize
8
8
  super
@@ -2,8 +2,8 @@ module OptaSD
2
2
  module Soccer
3
3
  class Squads < OptaSD::Soccer::SoccerCore
4
4
 
5
- boolean_params 'squads', :people, :detailed
6
- resource_params 'squads', :tournament, :contestant
5
+ boolean_params :people, :detailed
6
+ resource_params :tournament, :contestant
7
7
 
8
8
  def initialize
9
9
  super
@@ -2,8 +2,8 @@ module OptaSD
2
2
  module Soccer
3
3
  class TeamStandings < OptaSD::Soccer::SoccerCore
4
4
 
5
- boolean_params 'standings', :live
6
- resource_params 'standings', :stage, :tournament, :type
5
+ boolean_params :live
6
+ resource_params :stage, :tournament, :type
7
7
 
8
8
  def initialize
9
9
  super
@@ -2,7 +2,7 @@ module OptaSD
2
2
  module Soccer
3
3
  class TournamentCalendar < OptaSD::Soccer::SoccerCore
4
4
 
5
- resource_params 'tournamentcalendar', :competition
5
+ resource_params :competition
6
6
 
7
7
  def initialize
8
8
  super
@@ -2,7 +2,7 @@ module OptaSD
2
2
  module Soccer
3
3
  class TournamentSchedule < OptaSD::Soccer::SoccerCore
4
4
 
5
- resource_params 'tournamentschedule', :tournament
5
+ resource_params :tournament
6
6
 
7
7
  def initialize
8
8
  super
@@ -0,0 +1,13 @@
1
+ module OptaSD
2
+ module Soccer
3
+ class Venues < OptaSD::Soccer::SoccerCore
4
+
5
+ resource_params :tournament, :contestant, :venue
6
+
7
+ def initialize
8
+ super
9
+ @feed_name = 'venues'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module OptaSD
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -21,6 +21,8 @@ Gem::Specification.new do |s|
21
21
  s.require_paths = ['lib']
22
22
 
23
23
  s.add_development_dependency "bundler"
24
+ s.add_development_dependency "byebug"
25
+ s.add_development_dependency "pry"
24
26
  s.add_development_dependency "rspec", '~> 3.5'
25
27
  s.add_dependency "nokogiri", '~> 1.7', '>= 1.7.0.1'
26
28
  s.add_dependency "json"
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe OptaSD::Soccer::Venues do
4
+
5
+ before do
6
+ @valid_venue_id = "bdkmbkf8yi951wrjraknp9wad"
7
+ @valid_tournament_id = "9xjsbe05up1jqycf7no90as4p"
8
+ @valid_contestant_id = "c8h9bw1l82s06h77xxrelzhur"
9
+ end
10
+
11
+ it "gets venues based on venue id" do
12
+ venues = OptaSD::Soccer::Venues.new.venue(@valid_venue_id).get
13
+ expect(venues.data).to include("venue")
14
+ end
15
+
16
+ it "gets venues based on tournament" do
17
+ venues = OptaSD::Soccer::Venues.new.tournament(@valid_tournament_id).get
18
+ expect(venues.data).to include("venue")
19
+ end
20
+
21
+ it "gets venues based on contestant" do
22
+ venues = OptaSD::Soccer::Venues.new.contestant(@valid_contestant_id).get
23
+ expect(venues.data).to include("venue")
24
+ end
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opta_sd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ali Al-Sheiba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-03 00:00:00.000000000 Z
11
+ date: 2017-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: byebug
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rspec
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -81,6 +109,8 @@ extra_rdoc_files: []
81
109
  files:
82
110
  - ".gitignore"
83
111
  - ".rspec"
112
+ - ".travis.yml"
113
+ - CHANGELOG.md
84
114
  - Gemfile
85
115
  - Gemfile.lock
86
116
  - MIT-LICENSE
@@ -108,6 +138,7 @@ files:
108
138
  - lib/opta_sd/soccer/team_standings.rb
109
139
  - lib/opta_sd/soccer/tournament_calendar.rb
110
140
  - lib/opta_sd/soccer/tournament_schedule.rb
141
+ - lib/opta_sd/soccer/venues.rb
111
142
  - lib/opta_sd/version.rb
112
143
  - opta_sd.gemspec
113
144
  - spec/commentary_spec.rb
@@ -126,6 +157,7 @@ files:
126
157
  - spec/team_standings_spec.rb
127
158
  - spec/tournament_schedule_spec.rb
128
159
  - spec/tournament_spec.rb
160
+ - spec/venues_spec.rb
129
161
  homepage: https://github.com/ali-sheiba/opta_sd
130
162
  licenses:
131
163
  - MIT
@@ -146,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
178
  version: '0'
147
179
  requirements: []
148
180
  rubyforge_project:
149
- rubygems_version: 2.6.8
181
+ rubygems_version: 2.4.8
150
182
  signing_key:
151
183
  specification_version: 4
152
184
  summary: Opta Sports Data Soccer API.
@@ -167,3 +199,4 @@ test_files:
167
199
  - spec/team_standings_spec.rb
168
200
  - spec/tournament_schedule_spec.rb
169
201
  - spec/tournament_spec.rb
202
+ - spec/venues_spec.rb