sportradar-api 0.10.6 → 0.10.7

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: 2cf005860545754651596ebd372f029eeb3400a7
4
- data.tar.gz: 6ed94fceff1ab8bc25108193c0f059eb7e91cecd
3
+ metadata.gz: b22a0a7a406d1e9334db57e47c9f22cc1d722441
4
+ data.tar.gz: b46dfcead44339f9d5c37b6eb947f7d661ef4015
5
5
  SHA512:
6
- metadata.gz: 96fc61712d0d8b46f7fc1626960e401741ced2deee32e459eeac3497208d6ab6d77206fc36ffeeba2cbad5c56863063d204a37c709d106975f9b5d00aabf77a8
7
- data.tar.gz: 0b8ab520f651d197da1997a1ce5f95787059afd57738ffd3700a7db4b469d311b6d76ef0c3c1b992f4ae6dd3dce9f2e92be82b6f090e234cc4f7e08c270b4fe2
6
+ metadata.gz: 0121db5a08f0f80fe5df0bb73abc15cea485150f69e492d17621ca5624c42e917a0bcf1523c1307bc48c8dfc3ad80c6da07cfc140445b7cd25e3416ffe1f6155
7
+ data.tar.gz: ca20ff2d455c33c9e108208dbf39ac417d411844c2fb7028cb00bfaf0d15ae2fbd408ce27878b55008bd1c83af824836a71aa7dd8b6552c4e22517ef0bce0183
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.10.6)
4
+ sportradar-api (0.10.7)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -17,7 +17,7 @@ GEM
17
17
  codeclimate-test-reporter (0.6.0)
18
18
  simplecov (>= 0.7.1, < 1.0.0)
19
19
  coderay (1.1.1)
20
- concurrent-ruby (1.0.4)
20
+ concurrent-ruby (1.0.5)
21
21
  coveralls (0.8.15)
22
22
  json (>= 1.8, < 3)
23
23
  simplecov (~> 0.12.0)
@@ -13,6 +13,7 @@ require_relative 'basketball/nba/hierarchy'
13
13
  require_relative 'basketball/nba/conference'
14
14
  require_relative 'basketball/nba/division'
15
15
  require_relative 'basketball/nba/season'
16
+ require_relative 'basketball/nba/series'
16
17
  require_relative 'basketball/nba/schedule'
17
18
  require_relative 'basketball/nba/game'
18
19
  require_relative 'basketball/nba/team'
@@ -29,6 +29,15 @@ module Sportradar
29
29
  end
30
30
  end
31
31
 
32
+ def series_schedule(season_year = default_year)
33
+ response = get request_url("series/#{season_year}/pst/schedule")
34
+ if response.success?
35
+ Sportradar::Api::Basketball::Nba::Season.new(response.to_h, api: self)
36
+ else
37
+ @error = response
38
+ end
39
+ end
40
+
32
41
  def league_hierarchy
33
42
  response = get request_url("league/hierarchy")
34
43
  if response.success?
@@ -16,9 +16,11 @@ module Sportradar
16
16
  @year = data.dig('season', 'year')
17
17
  @type = data.dig('season', 'type')
18
18
 
19
- @games_hash = {}
19
+ @games_hash = {}
20
+ @series_hash = {}
20
21
 
21
- update_games(data['games'])
22
+ update_games(data['games']) if data['games']
23
+ update_series(data['series']) if data['series']
22
24
  end
23
25
 
24
26
  def games
@@ -29,6 +31,14 @@ module Sportradar
29
31
  create_data(@games_hash, data, klass: Game, api: @api, season: self)
30
32
  end
31
33
 
34
+ def series
35
+ @series_hash.values
36
+ end
37
+
38
+ def update_series(data)
39
+ create_data(@series_hash, data, klass: Series, api: @api, season: self)
40
+ end
41
+
32
42
  end
33
43
  end
34
44
  end
@@ -0,0 +1,59 @@
1
+ module Sportradar
2
+ module Api
3
+ module Basketball
4
+ class Nba
5
+ class Series < Basketball::Season
6
+ attr_accessor :response, :id, :status, :title, :round, :start_date
7
+ alias :name :title
8
+
9
+ def initialize(data, **opts)
10
+ @response = data
11
+ @api = opts[:api]
12
+
13
+ @id = data['id']
14
+ @games_hash = {}
15
+ @participants_hash = {}
16
+
17
+ update(data, **opts)
18
+ end
19
+
20
+ def update(data, **opts)
21
+ @title = data['title'] if data['title']
22
+ @round = data['round'] if data['round']
23
+ @status = data['status'] if data['status']
24
+ @start_date = data['start_date'] if data['start_date']
25
+
26
+
27
+ update_games(data['games']) if data['games']
28
+ update_participantss(data['participantss']) if data['participantss']
29
+ end
30
+
31
+ def games
32
+ @games_hash.values
33
+ end
34
+
35
+ def update_games(data)
36
+ create_data(@games_hash, data, klass: Game, api: @api, series: self)
37
+ end
38
+
39
+ def participants
40
+ @participants_hash.values
41
+ end
42
+
43
+ def update_participants(data)
44
+ create_data(@participants_hash, data, klass: Team, api: @api, series: self)
45
+ end
46
+
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ __END__
54
+
55
+ sd = sr.daily_schedule;
56
+ sr = Sportradar::Api::Basketball::Nba.new
57
+ ss = sr.standings;
58
+ ss = sr.schedule;
59
+ ss = sr.schedule(2015, 'pst)');
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.10.6"
3
+ VERSION = "0.10.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportradar-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.6
4
+ version: 0.10.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-03 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -254,6 +254,7 @@ files:
254
254
  - lib/sportradar/api/basketball/nba/schedule.rb
255
255
  - lib/sportradar/api/basketball/nba/scoring.rb
256
256
  - lib/sportradar/api/basketball/nba/season.rb
257
+ - lib/sportradar/api/basketball/nba/series.rb
257
258
  - lib/sportradar/api/basketball/nba/team.rb
258
259
  - lib/sportradar/api/basketball/ncaamb.rb
259
260
  - lib/sportradar/api/basketball/ncaamb/bracket.rb