sportradar-api 0.9.53 → 0.9.54

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: 5e98704bca79d1a4a5c3604345e1dc4ed653a41e
4
- data.tar.gz: f0b896123f16429230183702660128dea060d389
3
+ metadata.gz: 5f5cded66a107c37256eb59e809a7131a3a19350
4
+ data.tar.gz: 6b2520d091e20a7a24fac753b50b085430032d93
5
5
  SHA512:
6
- metadata.gz: 1b49282fb2c106c61cd02937b1c355bcf8912f412e31728dc770612aa3a1436f1087a71d9920a7e8f6625a996cce0065aa38a740a2f159b373ea9acb4114e61f
7
- data.tar.gz: ce3941de13418b49881c1c409aa9a637610586c4649182c0e40a0ba3cc9ea7585df1c879cfa78a0b60f0cfb8d2e71815fdc9fd6394283ad0ca9ac85e166b2f76
6
+ metadata.gz: 024f2fff2aa4ecd1bdaa010937a535a73e3f69e4a67149785c74bc24338334b9a86a77e4ea391875b26847166e96c5bdeacf8f6fca20a7c550e043188282d51e
7
+ data.tar.gz: 8617a45059b1c59f14409c2f71a16db5d4ae28f67371802ae7a01d8a225a3bd9f166c7e22ce1ebb30f463449cf21969f7be7c81ccf8f753606ea6c0bfd560a23
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.9.53)
4
+ sportradar-api (0.9.54)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -4,6 +4,7 @@ require_relative 'basketball/venue'
4
4
  require_relative 'basketball/broadcast'
5
5
  require_relative 'basketball/profile'
6
6
  require_relative 'basketball/bio'
7
+ require_relative 'basketball/injury'
7
8
  require_relative 'basketball/plays'
8
9
 
9
10
  require_relative 'basketball/nba'
@@ -0,0 +1,41 @@
1
+ module Sportradar
2
+ module Api
3
+ module Basketball
4
+ class Injury < Data
5
+ attr_accessor :response, :id, :comment, :descripton, :status, :start_date, :update_date
6
+
7
+ def initialize(data, **opts)
8
+ @response = data
9
+ update(data, **opts)
10
+ end
11
+
12
+ def update(data, **opts)
13
+ @id = data.dig('injury', 'id')
14
+ @comment = data.dig('injury', 'comment')
15
+ @descripton = data.dig('injury', 'desc')
16
+ @status = data.dig('injury', 'status')
17
+ @start_date = data.dig('injury', 'start_date')
18
+ @update_date = data.dig('injury', 'update_date')
19
+ end
20
+
21
+ def out?
22
+ @status == 'Out'
23
+ end
24
+
25
+ private def sample_data
26
+ {
27
+ "injury" => {
28
+ "id" => "069a9d3f-036e-4dab-9b49-d2e75082230e",
29
+ "comment" => "Paul will have surgery to repair torn ligaments in his left thumb and is expected to be out for six-to-eight weeks to recover, according to a report from ESPN.com.",
30
+ "desc" => "Thumb",
31
+ "status" => "Out",
32
+ "start_date" => "2017-01-17",
33
+ "update_date"=> "2017-01-17"
34
+ }
35
+ }
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+ end
@@ -75,6 +75,10 @@ module Sportradar
75
75
  self
76
76
  end
77
77
 
78
+ def injured?
79
+ !!(@injury && @injury.out?)
80
+ end
81
+
78
82
  def age
79
83
  if birth_date.present?
80
84
  now = Time.now.utc.to_date
@@ -121,7 +125,7 @@ module Sportradar
121
125
  @draft = data['draft'] if data['draft'] # {"team_id"=>"583ec825-fb46-11e1-82cb-f4ce4684ea4c", "year"=>"2012", "round"=>"1", "pick"=>"30"},
122
126
  end
123
127
  def update_injuries(data)
124
- @injuries = data['injuries'] if data['injuries'] #
128
+ @injury = Injury.new(data['injuries']) if data['injuries']
125
129
  # {"injury"=>
126
130
  # {"id"=>"06423591-3fc1-4d2b-8c60-a3f30d735345",
127
131
  # "comment"=>"Ezeli suffered a setback in his recovery from a procedure on his knee and there is no timetable for his return, according to Jason Quick of csnnw.com.",
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.9.53"
3
+ VERSION = "0.9.54"
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.9.53
4
+ version: 0.9.54
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-01-18 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -243,6 +243,7 @@ files:
243
243
  - lib/sportradar/api/basketball.rb
244
244
  - lib/sportradar/api/basketball/bio.rb
245
245
  - lib/sportradar/api/basketball/broadcast.rb
246
+ - lib/sportradar/api/basketball/injury.rb
246
247
  - lib/sportradar/api/basketball/nba.rb
247
248
  - lib/sportradar/api/basketball/nba/conference.rb
248
249
  - lib/sportradar/api/basketball/nba/division.rb