sportradar-api 0.1.36 → 0.1.37
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/sportradar/api.rb +4 -0
- data/lib/sportradar/api/content.rb +4 -2
- data/lib/sportradar/api/content/article.rb +42 -0
- data/lib/sportradar/api/content/article_list.rb +28 -0
- data/lib/sportradar/api/content/reference.rb +16 -0
- data/lib/sportradar/api/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 759e8c44c9309c7238688addf63e80f6f97e2f4a
|
|
4
|
+
data.tar.gz: 5cee734b0e2d839fc201902a798863b659f3513c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e035b1d2a943155e9a30c64feddce9351be40a6e1f3455fa881d68145e825891b21183ae8c05529e68a5f8330f14fc753e99c41dd1b959a0699a2d0d87c78fbb
|
|
7
|
+
data.tar.gz: 76c05588c387dbc7f471b19868f6f1975146b1d7b4b11e485f4827d169cb2a11d1c5b679758ce3860fff1a2d46e32f8b4b8bf0a221a013ba2153ee45a608c46c
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Our goal is to incrementally integrate with them. **Contributions are welcome**
|
|
|
22
22
|
|
|
23
23
|
| API | Version | Docs | Implemented? | Priority |
|
|
24
24
|
| --- | --- | --- | --- | --- |
|
|
25
|
-
| NFL | 1 | [📚](http://developer.sportradar.us/page/NFL_Official) |
|
|
25
|
+
| NFL | 1 | [📚](http://developer.sportradar.us/page/NFL_Official) | ✅ | 👍 |
|
|
26
26
|
| MLB | 5 | [📚](http://developer.sportradar.us/docs/MLB_API) | - | - |
|
|
27
27
|
| NHL | 3 | [📚](http://developer.sportradar.us/docs/NHL_API) | - | - |
|
|
28
28
|
| NBA | 3 | [📚](http://developer.sportradar.us/docs/NBA_API) | - | - |
|
|
@@ -45,7 +45,7 @@ Our goal is to incrementally integrate with them. **Contributions are welcome**
|
|
|
45
45
|
| Rugby | 1 | [📚](http://developer.sportradar.us/docs/Rugby_API) | - | - |
|
|
46
46
|
| Tennis | 1 | [📚](http://developer.sportradar.us/docs/Tennis_API) | - | - |
|
|
47
47
|
| ESPORTS | 1 | [📚](http://developer.sportradar.us/docs/ESPORTS_API) | - | - |
|
|
48
|
-
| Simulation APIs | 1 | [📚](http://developer.sportradar.us/page/Live_Game_Simulation) |
|
|
48
|
+
| Simulation APIs | 1 | [📚](http://developer.sportradar.us/page/Live_Game_Simulation) | ✅ | 👍|
|
|
49
49
|
|
|
50
50
|
## Installation
|
|
51
51
|
|
|
@@ -90,7 +90,7 @@ It's possible to find the current simulation game:
|
|
|
90
90
|
|
|
91
91
|
```
|
|
92
92
|
Sportradar::Api::Nfl.new('o').active_simulation
|
|
93
|
-
=>
|
|
93
|
+
=>
|
|
94
94
|
https://api.sportradar.us/nfl-sim1/games/f45b4a31-b009-4039-8394-42efbc6d5532/boxscore.xml
|
|
95
95
|
Live Game: Green Bay Packers vs Minnesota Vikings. Q2 00:08. game_id='f45b4a31-b009-4039-8394-42efbc6d5532'
|
|
96
96
|
```
|
data/lib/sportradar/api.rb
CHANGED
|
@@ -69,7 +69,11 @@ require "sportradar/api/images/tag"
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
|
+
|
|
72
73
|
require "sportradar/api/content"
|
|
74
|
+
require "sportradar/api/content/article_list"
|
|
75
|
+
require "sportradar/api/content/article"
|
|
76
|
+
require "sportradar/api/content/reference"
|
|
73
77
|
require "sportradar/api/odds"
|
|
74
78
|
|
|
75
79
|
module Sportradar
|
|
@@ -12,12 +12,14 @@ module Sportradar
|
|
|
12
12
|
|
|
13
13
|
def news( date = Date.today, content_type = 'all' )
|
|
14
14
|
raise Sportradar::Api::Error::InvalidType unless allowed_news_types.include? content_type
|
|
15
|
-
get request_url("#{provider }/news/#{date_path(date)}/#{content_type}")
|
|
15
|
+
response = get request_url("#{provider }/news/#{date_path(date)}/#{content_type}")
|
|
16
|
+
Sportradar::Api::Content::ArticleList.new response["content"] if response.success? && response["content"]
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
def analysis( date = Date.today, content_type = 'all' )
|
|
19
20
|
raise Sportradar::Api::Error::InvalidType unless allowed_analysis_types.include? content_type
|
|
20
|
-
get request_url("#{provider }/analysis/#{date_path(date)}/#{content_type}")
|
|
21
|
+
response = get request_url("#{provider }/analysis/#{date_path(date)}/#{content_type}")
|
|
22
|
+
Sportradar::Api::Content::ArticleList.new response["content"] if response.success? && response["content"]
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
private
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Sportradar
|
|
2
|
+
module Api
|
|
3
|
+
class Content::Article < Data
|
|
4
|
+
attr_accessor :response, :type, :created, :updated, :injury, :transaction, :title, :byline, :dateline, :credit, :content, :references, :provider
|
|
5
|
+
|
|
6
|
+
def initialize(data)
|
|
7
|
+
@response = data
|
|
8
|
+
@created = Time.parse(data["created"]) if data["created"]
|
|
9
|
+
@updated = Time.parse(data["updated"]) if data["updated"]
|
|
10
|
+
@type = data["type"]
|
|
11
|
+
@injury = data["injury"]
|
|
12
|
+
@transaction = data["transaction"]
|
|
13
|
+
@title = data["title"]
|
|
14
|
+
@byline = data["byline"]
|
|
15
|
+
@dateline = data["dateline"]
|
|
16
|
+
@credit = data["credit"]
|
|
17
|
+
@content = data["content"]["long"] if data["content"] && data["content"]["long"]
|
|
18
|
+
@provider = OpenStruct.new(data["provider"]) if data["provider"]
|
|
19
|
+
set_references
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def transaction?
|
|
23
|
+
!!transaction
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def injury?
|
|
27
|
+
!!injury
|
|
28
|
+
end
|
|
29
|
+
private
|
|
30
|
+
def set_references
|
|
31
|
+
if response["refs"] && response["refs"]["ref"]
|
|
32
|
+
if response["refs"]["ref"].is_a?(Array)
|
|
33
|
+
@references = response["refs"]["ref"].map {|x| Sportradar::Api::Content::Reference.new x }
|
|
34
|
+
elsif response["refs"]["ref"].is_a?(Hash)
|
|
35
|
+
@references = [ Sportradar::Api::Content::Reference.new(response["refs"]["ref"]) ]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Sportradar
|
|
2
|
+
module Api
|
|
3
|
+
class Content::ArticleList < Data
|
|
4
|
+
attr_accessor :response, :provider, :sport, :start_time, :end_time, :articles
|
|
5
|
+
|
|
6
|
+
def initialize(data)
|
|
7
|
+
@response = data
|
|
8
|
+
@sport = data["sport"]
|
|
9
|
+
@provider = data["provider"]
|
|
10
|
+
@start_time = Time.parse(data["start_time"]) if data["start_time"]
|
|
11
|
+
@end_time = Time.parse(data["end_time"]) if data["end_time"]
|
|
12
|
+
set_articles
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
def set_articles
|
|
17
|
+
if response["item"]
|
|
18
|
+
if response["item"].is_a?(Array)
|
|
19
|
+
@articles = response["item"].map {|x| Sportradar::Api::Content::Article.new x }
|
|
20
|
+
elsif response["item"].is_a?(Hash)
|
|
21
|
+
@articles = [ Sportradar::Api::Content::Article.new(response["item"]) ]
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Sportradar
|
|
2
|
+
module Api
|
|
3
|
+
class Content::Reference < Data
|
|
4
|
+
attr_accessor :response, "sportradar_id", "sportsdata_id", "type", "name"
|
|
5
|
+
|
|
6
|
+
def initialize(data)
|
|
7
|
+
@response = data
|
|
8
|
+
@sportradar_id = data["sportradar_id"]
|
|
9
|
+
@sportsdata_id = data["sportsdata_id"]
|
|
10
|
+
@type = data["type"]
|
|
11
|
+
@name = data["name"]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
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.1.
|
|
4
|
+
version: 0.1.37
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ben Eggett
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-09-
|
|
11
|
+
date: 2016-09-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -227,6 +227,9 @@ files:
|
|
|
227
227
|
- lib/sportradar/api.rb
|
|
228
228
|
- lib/sportradar/api/config.rb
|
|
229
229
|
- lib/sportradar/api/content.rb
|
|
230
|
+
- lib/sportradar/api/content/article.rb
|
|
231
|
+
- lib/sportradar/api/content/article_list.rb
|
|
232
|
+
- lib/sportradar/api/content/reference.rb
|
|
230
233
|
- lib/sportradar/api/data.rb
|
|
231
234
|
- lib/sportradar/api/error.rb
|
|
232
235
|
- lib/sportradar/api/football.rb
|
|
@@ -327,4 +330,3 @@ signing_key:
|
|
|
327
330
|
specification_version: 4
|
|
328
331
|
summary: Sportradar API client
|
|
329
332
|
test_files: []
|
|
330
|
-
has_rdoc:
|