sports_data_api 0.11.2 → 0.11.3

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: bda0af1487f0371b2b876bc00e102cacd57c13f6
4
- data.tar.gz: f86806607d2d6b960bc6a72e6dfb1e93d187f522
3
+ metadata.gz: 163cb7875408397dd2c91cb33be6d59959b560bd
4
+ data.tar.gz: c66059aa7a900fecdbfc5656dbd1e69b3d869e55
5
5
  SHA512:
6
- metadata.gz: 74426b508a595bce7e35ccdf4e48bac91d14453d71482b61bce58480812ecad2cf9089dab42d06a492df26707f7c77bb7979a1e3debe290aec53184b008f7ca5
7
- data.tar.gz: cb7ec0a93446561c3de6487a1d62a3bb6ffb9c6abbf02700ad92f5a5a245d2925339477a172a33da575f50c45731a2fa781e19a04012cb1dba8f5df352c423d9
6
+ metadata.gz: 571d1169c9d41262898c20ef00af334a296ba8f1234464e2952c01b22b71bff931c0b3c49e6763bcf76ec7c41ecb7cd3e44b6001573b22ad3e39d94fedb249a9
7
+ data.tar.gz: 9ea125bdbd1afb39c806ba0bf3238d50c1151a62765639985fa130a1ea816d50bde38e2e27ec174f19fc79e91473b35e763a9d6c8b6dcd00ec99d572b72b3528
@@ -8,6 +8,14 @@ module SportsDataApi
8
8
  def away
9
9
  @away ||= Team.new(game[:away])
10
10
  end
11
+
12
+ def home_team_id
13
+ @home_team_id ||= home[:id]
14
+ end
15
+
16
+ def away_team_id
17
+ @away_team_id ||= away[:id]
18
+ end
11
19
  end
12
20
  end
13
21
  end
@@ -3,7 +3,7 @@ module SportsDataApi
3
3
  class Game
4
4
  attr_reader :id, :scheduled, :home, :home_team, :away,
5
5
  :away_team, :status, :venue, :broadcast, :year, :season,
6
- :date, :quarter, :clock
6
+ :date, :quarter, :clock, :home_team_id, :away_team_id
7
7
 
8
8
  def initialize(args={})
9
9
  xml = args.fetch(:xml)
@@ -17,6 +17,8 @@ module SportsDataApi
17
17
  @scheduled = Time.parse xml['scheduled']
18
18
  @home = xml['home_team']
19
19
  @away = xml['away_team']
20
+ @home_team_id = xml['home_team']
21
+ @away_team_id = xml['away_team']
20
22
  @status = xml['status']
21
23
  @clock = xml['clock']
22
24
  @quarter = xml['quarter'] ? xml['quarter'].to_i : nil
@@ -3,7 +3,7 @@ module SportsDataApi
3
3
  class Game
4
4
  attr_reader :id, :scheduled, :home, :home_team, :away,
5
5
  :away_team, :status, :quarter, :clock, :venue, :broadcast, :weather,
6
- :year, :season, :week
6
+ :year, :season, :week, :home_team_id, :away_team_id
7
7
 
8
8
  def initialize(year, season, week, game_hash)
9
9
  @year = year
@@ -14,6 +14,8 @@ module SportsDataApi
14
14
  @scheduled = Time.parse game_hash['scheduled']
15
15
  @home = game_hash['home'] || game_hash['home_team']['id']
16
16
  @away = game_hash['away'] || game_hash['away_team']['id']
17
+ @home_team_id = @home
18
+ @away_team_id = @away
17
19
  @status = game_hash['status']
18
20
  @quarter = game_hash['quarter'].to_i
19
21
  @clock = game_hash['clock']
@@ -3,7 +3,7 @@ module SportsDataApi
3
3
  class Game
4
4
  attr_reader :id, :scheduled, :home, :home_team, :away,
5
5
  :away_team, :status, :venue, :broadcast, :year, :season,
6
- :date, :half, :clock
6
+ :date, :half, :clock, :home_team_id, :away_team_id
7
7
 
8
8
  def initialize(args={})
9
9
  xml = args.fetch(:xml)
@@ -17,6 +17,8 @@ module SportsDataApi
17
17
  @scheduled = Time.parse xml['scheduled']
18
18
  @home = xml['home_team']
19
19
  @away = xml['away_team']
20
+ @home_team_id = xml['home_team']
21
+ @away_team_id = xml['away_team']
20
22
  @status = xml['status']
21
23
  @clock = xml['clock']
22
24
  @half = xml['half'] ? xml['half'].to_i : nil
@@ -3,7 +3,7 @@ module SportsDataApi
3
3
  class Game
4
4
  attr_reader :id, :scheduled, :home, :home_team, :away,
5
5
  :away_team, :status, :quarter, :clock, :venue, :broadcast, :weather,
6
- :year, :season, :week
6
+ :year, :season, :week, :home_team_id, :away_team_id
7
7
 
8
8
  def initialize(year, season, week, game_hash)
9
9
  @year = year
@@ -14,6 +14,8 @@ module SportsDataApi
14
14
  @scheduled = Time.parse game_hash['scheduled']
15
15
  @home = game_hash['home'] || game_hash['home_team']['id']
16
16
  @away = game_hash['away'] || game_hash['away_team']['id']
17
+ @home_team_id = @home
18
+ @away_team_id = @away
17
19
  @status = game_hash['status']
18
20
  @quarter = game_hash['quarter'].to_i
19
21
  @clock = game_hash['clock']
@@ -3,7 +3,7 @@ module SportsDataApi
3
3
  class Game
4
4
  attr_reader :id, :scheduled, :home, :home_team, :away,
5
5
  :away_team, :status, :venue, :broadcast, :year, :season,
6
- :date, :period, :clock
6
+ :date, :period, :clock, :home_team_id, :away_team_id
7
7
 
8
8
  def initialize(args={})
9
9
  xml = args.fetch(:xml)
@@ -17,6 +17,8 @@ module SportsDataApi
17
17
  @scheduled = Time.parse xml['scheduled']
18
18
  @home = xml['home_team']
19
19
  @away = xml['away_team']
20
+ @home_team_id = xml['home_team']
21
+ @away_team_id = xml['away_team']
20
22
  @status = xml['status']
21
23
  @clock = xml['clock']
22
24
  @period = xml['period'] ? xml['period'].to_i : nil
@@ -1,3 +1,3 @@
1
1
  module SportsDataApi
2
- VERSION = '0.11.2'
2
+ VERSION = '0.11.3'
3
3
  end
@@ -19,6 +19,8 @@ describe SportsDataApi::Mlb::Game, vcr: {
19
19
  end
20
20
  its(:home) { should be_an_instance_of(SportsDataApi::Mlb::Team) }
21
21
  its(:away) { should be_an_instance_of(SportsDataApi::Mlb::Team) }
22
+ its(:home_team_id) { should eq '27a59d3b-ff7c-48ea-b016-4798f560f5e1' }
23
+ its(:away_team_id) { should eq 'd99f919b-1534-4516-8e8a-9cd106c6d8cd' }
22
24
  end
23
25
  end
24
26
  context 'when fetching a season schedule' do
@@ -37,6 +39,8 @@ describe SportsDataApi::Mlb::Game, vcr: {
37
39
  end
38
40
  its(:home) { should be_an_instance_of(SportsDataApi::Mlb::Team) }
39
41
  its(:away) { should be_an_instance_of(SportsDataApi::Mlb::Team) }
42
+ its(:home_team_id) { should eq 'c874a065-c115-4e7d-b0f0-235584fb0e6f' }
43
+ its(:away_team_id) { should eq 'd99f919b-1534-4516-8e8a-9cd106c6d8cd' }
40
44
  end
41
45
  end
42
46
  end
@@ -27,6 +27,8 @@ describe SportsDataApi::Nba::Game, vcr: {
27
27
  its(:scheduled) { should eq Time.new(2013, 10, 29, 19, 00, 00, '-04:00') }
28
28
  its(:home) { should eq '583ec7cd-fb46-11e1-82cb-f4ce4684ea4c' }
29
29
  its(:away) { should eq '583ed157-fb46-11e1-82cb-f4ce4684ea4c' }
30
+ its(:home_team_id) { should eq '583ec7cd-fb46-11e1-82cb-f4ce4684ea4c' }
31
+ its(:away_team_id) { should eq '583ed157-fb46-11e1-82cb-f4ce4684ea4c' }
30
32
  its(:status) { should eq 'closed' }
31
33
  its(:home_team) { should be_an_instance_of(SportsDataApi::Nba::Team) }
32
34
  its(:away_team) { should be_an_instance_of(SportsDataApi::Nba::Team) }
@@ -97,6 +99,8 @@ describe SportsDataApi::Nba::Game, vcr: {
97
99
  its(:scheduled) { should eq Time.new(2013, 12, 12, 20, 00, 00, '-05:00') }
98
100
  its(:home) { should eq '583ec9d6-fb46-11e1-82cb-f4ce4684ea4c' }
99
101
  its(:away) { should eq '583ecdfb-fb46-11e1-82cb-f4ce4684ea4c' }
102
+ its(:home_team_id) { should eq '583ec9d6-fb46-11e1-82cb-f4ce4684ea4c' }
103
+ its(:away_team_id) { should eq '583ecdfb-fb46-11e1-82cb-f4ce4684ea4c' }
100
104
  its(:status) { should eq 'closed' }
101
105
  its(:quarter) { should eq nil }
102
106
  its(:clock) { should eq nil }
@@ -41,6 +41,8 @@ describe SportsDataApi::Ncaafb::Game, vcr: {
41
41
  its(:scheduled) { should eq Time.new(2014, 8, 23, 19, 30, 00, '+00:00') }
42
42
  its(:home) { should eq 'EW' }
43
43
  its(:away) { should eq 'SHS' }
44
+ its(:home_team_id) { should eq 'EW' }
45
+ its(:away_team_id) { should eq 'SHS' }
44
46
  its(:status) { should eq 'closed' }
45
47
  its(:home_team) { should be_an_instance_of(SportsDataApi::Ncaafb::Team) }
46
48
  its(:away_team) { should be_an_instance_of(SportsDataApi::Ncaafb::Team) }
@@ -72,6 +74,8 @@ describe SportsDataApi::Ncaafb::Game, vcr: {
72
74
  its(:scheduled) { should eq Time.new(2014, 11, 1, 16, 00, 00, '+00:00') }
73
75
  its(:home) { should eq 'IOW' }
74
76
  its(:away) { should eq 'NW' }
77
+ its(:home_team_id) { should eq 'IOW' }
78
+ its(:away_team_id) { should eq 'NW' }
75
79
  its(:status) { should eq 'closed' }
76
80
  its(:quarter) { should eq 4 }
77
81
  its(:clock) { should eq ':00' }
@@ -105,6 +109,8 @@ describe SportsDataApi::Ncaafb::Game, vcr: {
105
109
  its(:scheduled) { should eq Time.new(2014, 8, 23, 19, 30, 00, '+00:00') }
106
110
  its(:home) { should eq 'EW' }
107
111
  its(:away) { should eq 'SHS' }
112
+ its(:home_team_id) { should eq 'EW' }
113
+ its(:away_team_id) { should eq 'SHS' }
108
114
  its(:status) { should eq 'closed' }
109
115
  its(:quarter) { should eq 0 }
110
116
  its(:clock) { should eq nil }
@@ -137,6 +143,8 @@ describe SportsDataApi::Ncaafb::Game, vcr: {
137
143
  its(:scheduled) { should eq Time.new(2014, 11, 01, 16, 00, 00, '+00:00') }
138
144
  its(:home_team) { should be_an_instance_of(SportsDataApi::Ncaafb::Team) }
139
145
  its(:away_team) { should be_an_instance_of(SportsDataApi::Ncaafb::Team) }
146
+ its(:home_team_id) { should eq 'IOW' }
147
+ its(:away_team_id) { should eq 'NW' }
140
148
 
141
149
  it '#summary' do
142
150
  expect { subject.summary }.to raise_error(NotImplementedError)
@@ -161,6 +169,8 @@ describe SportsDataApi::Ncaafb::Game, vcr: {
161
169
  its(:scheduled) { should eq Time.new(2014, 11, 01, 16, 00, 00, '+00:00') }
162
170
  its(:home_team) { should be_an_instance_of(SportsDataApi::Ncaafb::Team) }
163
171
  its(:away_team) { should be_an_instance_of(SportsDataApi::Ncaafb::Team) }
172
+ its(:home_team_id) { should eq 'IOW' }
173
+ its(:away_team_id) { should eq 'NW' }
164
174
 
165
175
  it 'has home_team players' do
166
176
  expect(subject.home_team.players.first).to be_an_instance_of(SportsDataApi::Ncaafb::Player)
@@ -27,6 +27,8 @@ describe SportsDataApi::Ncaamb::Game, vcr: {
27
27
  its(:scheduled) { should eq Time.new(2014, 11, 14, 11, 00, 00, '-05:00') }
28
28
  its(:home) { should eq '54df21af-8f65-42fc-bc01-8bf750856d70' }
29
29
  its(:away) { should eq 'eb157f98-0697-459c-9293-ddb162ceb28b' }
30
+ its(:home_team_id) { should eq '54df21af-8f65-42fc-bc01-8bf750856d70' }
31
+ its(:away_team_id) { should eq 'eb157f98-0697-459c-9293-ddb162ceb28b' }
30
32
  its(:status) { should eq 'closed' }
31
33
  its(:home_team) { should be_an_instance_of(SportsDataApi::Ncaamb::Team) }
32
34
  its(:away_team) { should be_an_instance_of(SportsDataApi::Ncaamb::Team) }
@@ -47,6 +49,8 @@ describe SportsDataApi::Ncaamb::Game, vcr: {
47
49
  its(:scheduled) { should eq Time.new(2015, 2, 07, 17, 30, 00, '-05:00') }
48
50
  its(:home) { should eq 'c7569eae-5b93-4197-b204-6f3a62146b25' }
49
51
  its(:away) { should eq '4b7dedc0-7b48-49a4-aad6-8a94a33274d2' }
52
+ its(:home_team_id) { should eq 'c7569eae-5b93-4197-b204-6f3a62146b25' }
53
+ its(:away_team_id) { should eq '4b7dedc0-7b48-49a4-aad6-8a94a33274d2' }
50
54
  its(:status) { should eq 'closed' }
51
55
  its(:half) { should eq 2 }
52
56
  its(:clock) { should eq '00:00' }
@@ -69,6 +73,8 @@ describe SportsDataApi::Ncaamb::Game, vcr: {
69
73
  its(:scheduled) { should eq Time.new(2015, 2, 25, 19, 00, 00, '-05:00') }
70
74
  its(:home) { should eq '9b66e1e0-aace-4671-9be2-54c8acf5ecfc' }
71
75
  its(:away) { should eq 'c1c1e6df-a383-4fbd-ba7b-32d4f9ef9518' }
76
+ its(:home_team_id) { should eq '9b66e1e0-aace-4671-9be2-54c8acf5ecfc' }
77
+ its(:away_team_id) { should eq 'c1c1e6df-a383-4fbd-ba7b-32d4f9ef9518' }
72
78
  its(:status) { should eq 'scheduled' }
73
79
  its(:half) { should eq nil }
74
80
  its(:clock) { should eq nil }
@@ -84,4 +90,4 @@ describe SportsDataApi::Ncaamb::Game, vcr: {
84
90
  expect { subject.pbp }.to raise_error(NotImplementedError)
85
91
  end
86
92
  end
87
- end
93
+ end
@@ -37,6 +37,8 @@ describe SportsDataApi::Nfl::Game, vcr: {
37
37
  its(:scheduled) { should eq Time.new(2012, 9, 5, 19, 30, 00, '-05:00') }
38
38
  its(:home) { should eq 'NYG' }
39
39
  its(:away) { should eq 'DAL' }
40
+ its(:home_team_id) { should eq 'NYG' }
41
+ its(:away_team_id) { should eq 'DAL' }
40
42
  its(:status) { should eq 'closed' }
41
43
  its(:home_team) { should be_an_instance_of(SportsDataApi::Nfl::Team) }
42
44
  its(:away_team) { should be_an_instance_of(SportsDataApi::Nfl::Team) }
@@ -66,6 +68,8 @@ describe SportsDataApi::Nfl::Game, vcr: {
66
68
  its(:scheduled) { should eq Time.new(2012, 11, 4, 18, 00, 00, '+00:00') }
67
69
  its(:home) { should eq 'IND' }
68
70
  its(:away) { should eq 'MIA' }
71
+ its(:home_team_id) { should eq 'IND' }
72
+ its(:away_team_id) { should eq 'MIA' }
69
73
  its(:status) { should eq 'closed' }
70
74
  its(:quarter) { should eq 4 }
71
75
  its(:clock) { should eq ':00' }
@@ -97,6 +101,8 @@ describe SportsDataApi::Nfl::Game, vcr: {
97
101
  its(:scheduled) { should eq Time.new(2012, 11, 4, 18, 00, 00, '+00:00') }
98
102
  its(:home) { should eq 'IND' }
99
103
  its(:away) { should eq 'MIA' }
104
+ its(:home_team_id) { should eq 'IND' }
105
+ its(:away_team_id) { should eq 'MIA' }
100
106
  its(:status) { should eq 'closed' }
101
107
  its(:home_team) { should be_an_instance_of(SportsDataApi::Nfl::Team) }
102
108
  its(:away_team) { should be_an_instance_of(SportsDataApi::Nfl::Team) }
@@ -130,6 +136,8 @@ describe SportsDataApi::Nfl::Game, vcr: {
130
136
  its(:scheduled) { should eq Time.new(2012, 8, 9, 23, 00, 00, '+00:00') }
131
137
  its(:home) { should eq 'BUF' }
132
138
  its(:away) { should eq 'WAS' }
139
+ its(:home_team_id) { should eq 'BUF' }
140
+ its(:away_team_id) { should eq 'WAS' }
133
141
  its(:status) { should eq 'closed' }
134
142
  its(:quarter) { should eq 0 }
135
143
  its(:clock) { should eq nil }
@@ -158,6 +166,10 @@ describe SportsDataApi::Nfl::Game, vcr: {
158
166
  subject { game_statistics }
159
167
  its(:id) { should eq '00d5024b-0853-4e09-ad5a-4981a968f0ad' }
160
168
  its(:status) { should eq 'closed' }
169
+ its(:home) { should eq 'GB' }
170
+ its(:away) { should eq 'PIT' }
171
+ its(:home_team_id) { should eq 'GB' }
172
+ its(:away_team_id) { should eq 'PIT' }
161
173
  its(:scheduled) { should eq Time.parse("2013-12-22T21:25:00+00:00") }
162
174
  its(:home_team) { should be_an_instance_of(SportsDataApi::Nfl::Team) }
163
175
  its(:away_team) { should be_an_instance_of(SportsDataApi::Nfl::Team) }
@@ -27,6 +27,8 @@ describe SportsDataApi::Nhl::Game, vcr: {
27
27
  its(:scheduled) { should eq Time.new(2013, 10, 01, 16, 00, 00, '-07:00') }
28
28
  its(:home) { should eq '441713b7-0f24-11e2-8525-18a905767e44' }
29
29
  its(:away) { should eq '441730a9-0f24-11e2-8525-18a905767e44' }
30
+ its(:home_team_id) { should eq '441713b7-0f24-11e2-8525-18a905767e44' }
31
+ its(:away_team_id) { should eq '441730a9-0f24-11e2-8525-18a905767e44' }
30
32
  its(:status) { should eq 'closed' }
31
33
  its(:home_team) { should be_an_instance_of(SportsDataApi::Nhl::Team) }
32
34
  its(:away_team) { should be_an_instance_of(SportsDataApi::Nhl::Team) }
@@ -47,6 +49,8 @@ describe SportsDataApi::Nhl::Game, vcr: {
47
49
  its(:scheduled) { should eq Time.new(2013, 10, 01, 16, 00, 00, '-07:00') }
48
50
  its(:home) { should eq '441713b7-0f24-11e2-8525-18a905767e44' }
49
51
  its(:away) { should eq '441730a9-0f24-11e2-8525-18a905767e44' }
52
+ its(:home_team_id) { should eq '441713b7-0f24-11e2-8525-18a905767e44' }
53
+ its(:away_team_id) { should eq '441730a9-0f24-11e2-8525-18a905767e44' }
50
54
  its(:status) { should eq 'closed' }
51
55
  its(:period) { should eq 3 }
52
56
  its(:clock) { should eq "00:00" }
@@ -69,6 +73,8 @@ describe SportsDataApi::Nhl::Game, vcr: {
69
73
  its(:scheduled) { should eq Time.new(2013, 12, 12, 16, 00, 00, '-08:00') }
70
74
  its(:home) { should eq '44179d47-0f24-11e2-8525-18a905767e44' }
71
75
  its(:away) { should eq '441713b7-0f24-11e2-8525-18a905767e44' }
76
+ its(:home_team_id) { should eq '44179d47-0f24-11e2-8525-18a905767e44' }
77
+ its(:away_team_id) { should eq '441713b7-0f24-11e2-8525-18a905767e44' }
72
78
  its(:status) { should eq 'closed' }
73
79
  its(:period) { should eq nil }
74
80
  its(:clock) { should eq nil }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sports_data_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Lovelett
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-15 00:00:00.000000000 Z
12
+ date: 2017-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri