sportradar-api 0.15.0 → 0.16.1

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
  SHA256:
3
- metadata.gz: 6ef657d7ab8e7604e6592005b6569282592286827a7186b9ddf145dbc4b92399
4
- data.tar.gz: 89ee62d0632e03f9d5b3338838582a364372b0982d7bf789d2067b7088bbaf6a
3
+ metadata.gz: 03f6248dd4fefe7ad9dd9d6d51cde0e074458af60f6cccc5605c5e1ed122cf3c
4
+ data.tar.gz: 91b960f18557bf9f174d4558ff9a0b13b4b71d91405e4ffc48b60eea0e04ff37
5
5
  SHA512:
6
- metadata.gz: 2b51387ae1f24697221d6dbca0f74ecbd5b8afb084e83358182d751eff188ded53c1cafb177ea740d97f5e1ccf7ed298866aeba183ca37aea337a4d77e2d3c23
7
- data.tar.gz: 44c2b085932802458c33369a3f78f53ffad07843abb6171bac618a4227a1c3ed36e98d9101947191019e11e0d50e83c2131d78021b2a72df2dc6afacd28f7c91
6
+ metadata.gz: dbafa97a79e3514e7c5d26fed96ccc2a614cc8e4e924ebfef36563cc8486376e80bda2520a756417619a60631b28579d80dc391c8949dff12cbbb3f70b69b881
7
+ data.tar.gz: 45585e585a00f67e95620b9d38aee76889912cf26774f6b8dfec0c38af0f10fcf5e5b2a9a31548f1d308ec1e0dbc2ba6b8a589241941afcfd989b60db1dab5b4
data/Gemfile.lock CHANGED
@@ -1,24 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.14.0)
4
+ sportradar-api (0.16.1)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (5.2.1)
11
+ activesupport (6.1.5)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
- i18n (>= 0.7, < 2)
14
- minitest (~> 5.1)
15
- tzinfo (~> 1.1)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
16
+ zeitwerk (~> 2.3)
16
17
  addressable (2.5.1)
17
18
  public_suffix (~> 2.0, >= 2.0.2)
18
19
  codeclimate-test-reporter (1.0.8)
19
20
  simplecov (<= 0.13)
20
21
  coderay (1.1.1)
21
- concurrent-ruby (1.0.5)
22
+ concurrent-ruby (1.1.9)
22
23
  coveralls (0.8.19)
23
24
  json (>= 1.8, < 3)
24
25
  simplecov (~> 0.12.0)
@@ -30,12 +31,16 @@ GEM
30
31
  docile (1.1.5)
31
32
  dotenv (2.7.6)
32
33
  hashdiff (0.3.4)
33
- httparty (0.16.2)
34
+ httparty (0.20.0)
35
+ mime-types (~> 3.0)
34
36
  multi_xml (>= 0.5.2)
35
- i18n (1.1.0)
37
+ i18n (1.10.0)
36
38
  concurrent-ruby (~> 1.0)
37
39
  json (2.1.0)
38
40
  method_source (0.8.2)
41
+ mime-types (3.4.1)
42
+ mime-types-data (~> 3.2015)
43
+ mime-types-data (3.2022.0105)
39
44
  minitest (5.10.2)
40
45
  minitest-focus (1.1.2)
41
46
  minitest (>= 4, < 6)
@@ -56,15 +61,15 @@ GEM
56
61
  term-ansicolor (1.6.0)
57
62
  tins (~> 1.0)
58
63
  thor (0.19.4)
59
- thread_safe (0.3.6)
60
64
  tins (1.14.0)
61
- tzinfo (1.2.5)
62
- thread_safe (~> 0.1)
65
+ tzinfo (2.0.4)
66
+ concurrent-ruby (~> 1.0)
63
67
  vcr (3.0.3)
64
68
  webmock (3.0.1)
65
69
  addressable (>= 2.3.6)
66
70
  crack (>= 0.3.2)
67
71
  hashdiff
72
+ zeitwerk (2.5.4)
68
73
 
69
74
  PLATFORMS
70
75
  ruby
@@ -43,6 +43,10 @@ module Sportradar
43
43
  {}
44
44
  end
45
45
 
46
+ def period
47
+ @innings
48
+ end
49
+
46
50
  def tied?
47
51
  @score[away_id].to_i == @score[home_id].to_i
48
52
  end
@@ -350,6 +354,10 @@ module Sportradar
350
354
  }.freeze[self.count['inning_half']]
351
355
  end
352
356
 
357
+ def clock
358
+ half_short
359
+ end
360
+
353
361
  def postponed?
354
362
  'postponed' == status
355
363
  end
@@ -27,9 +27,9 @@ module Sportradar
27
27
  end
28
28
  def default_access_level
29
29
  if (ENV['SPORTRADAR_ENV_MLB'] || ENV['SPORTRADAR_ENV'] || ENV['RACK_ENV'] || ENV['RAILS_ENV']) == 'production'
30
- 'p'
30
+ 'production'
31
31
  else
32
- 't'
32
+ 'trial'
33
33
  end
34
34
  end
35
35
 
@@ -40,11 +40,11 @@ module Sportradar
40
40
  private
41
41
 
42
42
  def request_url(path)
43
- "/mlb-#{access_level}#{version}/#{path}"
43
+ "/mlb/#{access_level}/v#{version}/en/#{path}"
44
44
  end
45
45
 
46
46
  def api_key
47
- if !['t', 'sim'].include?(access_level)
47
+ if !['trial', 'sim'].include?(access_level)
48
48
  Sportradar::Api.api_key_params('mlb', 'production')
49
49
  elsif 'sim' == access_level
50
50
  Sportradar::Api.api_key_params('mlb', 'simulation')
@@ -58,7 +58,7 @@ module Sportradar
58
58
  end
59
59
 
60
60
  def allowed_access_levels
61
- %w[p t sim]
61
+ %w[production trial sim]
62
62
  end
63
63
 
64
64
  def allowed_seasons
@@ -128,7 +128,7 @@ module Sportradar
128
128
  "teams/#{ id }"
129
129
  end
130
130
  def path_base_stats(season_year = api.default_year, default_season = api.default_season)
131
- "seasontd/#{season_year}/#{default_season}/teams/#{id}"
131
+ "seasons/#{season_year}/#{default_season}/teams/#{id}"
132
132
  end
133
133
  def path_roster
134
134
  "#{ path_base }/profile"
@@ -2,7 +2,7 @@ module Sportradar
2
2
  module Api
3
3
  module Basketball
4
4
  class Game < Data
5
- attr_accessor :response, :id, :title, :home_id, :away_id, :score, :status, :coverage, :scheduled, :venue, :broadcast, :clock, :duration, :attendance, :team_stats, :player_stats, :changes, :media_timeouts
5
+ attr_accessor :response, :id, :title, :home_id, :away_id, :score, :status, :coverage, :time_zone, :scheduled, :venue, :broadcast, :clock, :duration, :attendance, :team_stats, :player_stats, :changes, :media_timeouts
6
6
 
7
7
  attr_accessor :period
8
8
  @all_hash = {}
@@ -94,6 +94,7 @@ module Sportradar
94
94
  @away = team_class.new(data['away'], api: api, game: self) if data['away']
95
95
  @title = data['title'] || @title || (home && away && "#{home.full_name} vs #{away.full_name}")
96
96
 
97
+ @time_zone = data.dig("time_zones", "venue") if data.dig("time_zones", "venue")
97
98
  @duration = data['duration'] if data['duration']
98
99
  @clock = data['clock'] if data['clock']
99
100
  @attendance = data['attendance'] if data['attendance']
@@ -3,7 +3,7 @@ module Sportradar
3
3
  module Basketball
4
4
  class Nba
5
5
  class Player < Data
6
- attr_accessor :response, :id, :number, :full_name, :first_name, :last_name, :position, :birth_place, :college, :height, :weight, :averages, :totals, :draft, :stats, :team
6
+ attr_accessor :response, :id, :number, :full_name, :first_name, :last_name, :position, :birth_place, :college, :height, :weight, :averages, :totals, :draft, :stats, :team, :not_playing_reason, :not_playing_description
7
7
  # @all_hash = {}
8
8
  # def self.new(data, **opts)
9
9
  # existing = @all_hash[data['id']]
@@ -57,6 +57,8 @@ module Sportradar
57
57
  @experience = data['experience'] if data['experience'] # "3",
58
58
  @birth_place = data['birth_place'].gsub(',,', ', ') if data['birth_place'] # "Benin City,, NGA",
59
59
  @updated = data['updated'] if data['updated'] # "2016-07-08T12:11:59+00:00",
60
+ @not_playing_reason = data['not_playing_reason'] if data['not_playing_reason'] # "Inactive - Injury/Illness"
61
+ @not_playing_description = data['not_playing_description'] if data['not_playing_description'] # "Left Ankle; Sprain"
60
62
 
61
63
  # NBA specific below
62
64
 
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.15.0"
3
+ VERSION = "0.16.1"
4
4
  end
5
5
  end
@@ -51,7 +51,7 @@ module Sportradar
51
51
 
52
52
  API_GALLERY = [
53
53
  {api: :nfl, version: 1},
54
- {api: :mlb, version: 6},
54
+ {api: :mlb, version: 7},
55
55
  {api: :nhl, version: 3},
56
56
  {api: :nba, version: 7},
57
57
  {api: :ncaamb, version: 3},
@@ -83,7 +83,11 @@ module Sportradar
83
83
  end
84
84
 
85
85
  def self.api_key(api, access_level = 'trial')
86
- ENV.fetch("SPORTRADAR_#{api.to_s.upcase.gsub('-', '_')}#{"_#{access_level.upcase}" if access_level != 'trial'}", "api_key missing for #{api}")
86
+ ENV.fetch("SPORTRADAR_#{api.to_s.upcase.gsub('-', '_')}#{"_#{access_level.upcase}" if access_level != 'trial'}",
87
+ ENV.fetch("SPORTRADAR_#{api.to_s.upcase}_API_KEY",
88
+ "api_key missing for #{api}"
89
+ )
90
+ )
87
91
  end
88
92
 
89
93
  def self.version(api)
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.15.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-19 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler