infostrada 0.1.25 → 0.1.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/infostrada/match.rb +16 -18
- data/lib/infostrada/match_event.rb +35 -2
- data/lib/infostrada/table.rb +5 -3
- data/lib/infostrada/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWUyODUxNWQ3NjMyYjVmNDAwYWRmMDE4OTdjZDQ2ZjQ5ZGZjMDNlYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTlmMWIxYTFhM2Q2NTRlYmFhN2JjZTliOTM5ZjEwNDFlNGM0MmViZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWZlMzA5YWNjODBhZWZjMmJjYzgyZjVjMDMwOTgzZWJjY2UzNjI1ZTUyNzNk
|
10
|
+
OWM0MmU2Mzg4ODZiYzdiYzc3Y2VhMTZkNmM0MzVkMTkyZTQ4NDJhMjMxZTUy
|
11
|
+
OTI0NmMyMTczOGI5MThlNzM2NTE2YzliYWMzNWIxZThjNzIzOGE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGQzZTYwMmIxN2JlZGY2NmY2YmU1MTQyMzY2OGRkYmRiYWIyODZjZThmODg4
|
14
|
+
ZjAyOTBmYmI0NGM0MzBiNWI1MmU0ZDQ2ZDllZThiOWU3YjJlYjU1OGQ1Mzg3
|
15
|
+
NWEyMzVlOGI4NGY1ODcwMjBlM2U2NmZjODhhMWE4ZGE0YzEyODc=
|
data/lib/infostrada/match.rb
CHANGED
@@ -120,7 +120,7 @@ module Infostrada
|
|
120
120
|
match.status_short = json['status_short']
|
121
121
|
match.leg = json['leg']
|
122
122
|
match.started_at = Time.parse(json['started_at']) if json['started_at']
|
123
|
-
match.knockout_phase_id
|
123
|
+
match.knockout_phase_id = json['knockout_phase_id']
|
124
124
|
|
125
125
|
match.stadium_id = json['stadium_id']
|
126
126
|
match.stadium_name = json['stadium_name']
|
@@ -141,30 +141,30 @@ module Infostrada
|
|
141
141
|
|
142
142
|
match.period = json['period']
|
143
143
|
|
144
|
-
match.referee = Referee.from_json(json['referee'])
|
145
|
-
match.phase = Phase.from_json(json['phase'])
|
146
|
-
match.home_team = Team.from_json(json['home_team'], 'home')
|
147
|
-
match.away_team = Team.from_json(json['away_team'], 'away')
|
148
|
-
match.goals = Goals.from_json(json['goals'])
|
149
|
-
match.edition = Edition.from_json(json['edition'])
|
144
|
+
match.referee = Referee.from_json(json['referee']) if json['referee']
|
145
|
+
match.phase = Phase.from_json(json['phase']) if json['phase']
|
146
|
+
match.home_team = Team.from_json(json['home_team'], 'home') if json['home_team']
|
147
|
+
match.away_team = Team.from_json(json['away_team'], 'away') if json['away_team']
|
148
|
+
match.goals = Goals.from_json(json['goals']) if json['goals']
|
149
|
+
match.edition = Edition.from_json(json['edition']) if json['edition']
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
153
|
def initialize(hash = {}, &block)
|
154
154
|
@id = hash['n_MatchID']
|
155
|
-
@date = Formatter.format_date(hash['d_DateUTC'])
|
155
|
+
@date = Formatter.format_date(hash['d_DateUTC']) if hash['d_DateUTC']
|
156
156
|
@rescheduled = hash['b_RescheduledToBeResumed']
|
157
157
|
@round = hash['n_RoundNr']
|
158
158
|
@time_unknown = hash['b_TimeUnknown']
|
159
159
|
@date_unknown = hash['b_DateUnknown']
|
160
160
|
|
161
161
|
@aggregate_winner_id = hash['n_WinnerOnAggregateTeamID']
|
162
|
-
@current_period_started_at = Formatter.format_date(hash['d_CurrentPeriodStartTime'])
|
162
|
+
@current_period_started_at = Formatter.format_date(hash['d_CurrentPeriodStartTime']) if hash['d_CurrentPeriodStartTime']
|
163
163
|
@status_code = hash['n_MatchStatusCode']
|
164
164
|
@status = hash['c_MatchStatus']
|
165
165
|
@status_short = hash['c_MatchStatusShort']
|
166
166
|
@leg = hash['n_Leg']
|
167
|
-
@started_at = Formatter.format_date(hash['d_MatchStartTime'])
|
167
|
+
@started_at = Formatter.format_date(hash['d_MatchStartTime']) if hash['d_MatchStartTime']
|
168
168
|
@knockout_phase_id = hash['n_KnockoutPhaseID']
|
169
169
|
|
170
170
|
@stadium_id = hash['n_StadiumGeoID']
|
@@ -185,16 +185,14 @@ module Infostrada
|
|
185
185
|
@lineup_official = hash['b_LineupOfficial']
|
186
186
|
|
187
187
|
@period = hash['n_PeriodSort']
|
188
|
+
@referee = Referee.new(hash) if hash['n_RefereeID']
|
189
|
+
@phase = Phase.new(hash) if hash['n_PhaseID']
|
188
190
|
|
189
|
-
@
|
190
|
-
@
|
191
|
+
@home_team = Team.new(hash, 'home') if hash['n_EditionID']
|
192
|
+
@away_team = Team.new(hash, 'away') if hash['n_EditionID']
|
191
193
|
|
192
|
-
@
|
193
|
-
@
|
194
|
-
|
195
|
-
@goals = Goals.new(hash)
|
196
|
-
|
197
|
-
@edition = Edition.new(hash)
|
194
|
+
@goals = Goals.new(hash) if hash['n_HomeGoals']
|
195
|
+
@edition = Edition.new(hash) if hash['n_EditionID']
|
198
196
|
|
199
197
|
block.call(self) if block_given?
|
200
198
|
self
|
@@ -42,9 +42,41 @@ module Infostrada
|
|
42
42
|
# These action codes are documented on the Infostrada ADVANCED PROGRAMMING documentation
|
43
43
|
attr_accessor :action_code, :action_code_2, :action_code_3
|
44
44
|
|
45
|
-
def
|
46
|
-
|
45
|
+
def self.from_json(hash = {})
|
46
|
+
self.new do |event|
|
47
|
+
event.match_id = hash['match_id']
|
48
|
+
event.id = hash['id']
|
49
|
+
event.description = hash['description']
|
50
|
+
event.short_description = hash['short_description']
|
51
|
+
event.period = hash['period']
|
52
|
+
event.period_short = hash['period_short']
|
53
|
+
event.period_code = hash['period_code']
|
54
|
+
event.time = hash['time']
|
55
|
+
event.home_goals = hash['home_goals']
|
56
|
+
event.away_goals = hash['away_goals']
|
57
|
+
event.home_event = hash['home_event']
|
58
|
+
event.team_id = hash['team_id']
|
59
|
+
event.team_name = hash['team_name']
|
60
|
+
event.team_short_name = hash['team_short_name']
|
61
|
+
event.person_id = hash['person_id']
|
62
|
+
event.person_name = hash['person_name']
|
63
|
+
event.person_short_name = hash['person_short_name']
|
64
|
+
event.reason = hash['reason']
|
65
|
+
event.info = hash['info']
|
66
|
+
event.person2_id = hash['person2_id']
|
67
|
+
event.person2_name = hash['person2_name']
|
68
|
+
event.person2_short_name = hash['person2_short_name']
|
69
|
+
event.minute = hash['minute']
|
70
|
+
event.action_set = hash['action_set']
|
71
|
+
event.action_code = hash['action_code']
|
72
|
+
event.action_code_2 = hash['action_code_2']
|
73
|
+
event.action_code_3 = hash['action_code_3']
|
74
|
+
event.action_sort = hash['action_sort']
|
75
|
+
end
|
76
|
+
end
|
47
77
|
|
78
|
+
def initialize(match_id = nil, hash = {}, &block)
|
79
|
+
@match_id = match_id
|
48
80
|
@id = hash['n_ActionID']
|
49
81
|
@description = hash['c_Action']
|
50
82
|
@short_description = hash['c_ActionShort']
|
@@ -73,6 +105,7 @@ module Infostrada
|
|
73
105
|
@action_code_3 = hash['n_ActionCode3']
|
74
106
|
@action_sort = hash['n_ActionSort']
|
75
107
|
|
108
|
+
block.call(self) if block_given?
|
76
109
|
self
|
77
110
|
end
|
78
111
|
|
data/lib/infostrada/table.rb
CHANGED
@@ -17,7 +17,9 @@ module Infostrada
|
|
17
17
|
self.new do |table|
|
18
18
|
table.phase_id = json['phase_id']
|
19
19
|
table.edition_id = json['edition_id']
|
20
|
-
table.entries = json['entries'].map{ |entry|
|
20
|
+
table.entries = json['entries'].map{ |entry|
|
21
|
+
TableEntry.from_json(entry)
|
22
|
+
}
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
@@ -27,14 +29,14 @@ module Infostrada
|
|
27
29
|
@entries = []
|
28
30
|
table_list.each do |hash|
|
29
31
|
@edition_id ||= hash['n_EditionID']
|
30
|
-
@entries << TableEntry.new(hash)
|
32
|
+
@entries << TableEntry.new(hash) if hash['n_TeamID']
|
31
33
|
end
|
32
34
|
|
33
35
|
block.call(self) if block_given?
|
34
36
|
self
|
35
37
|
end
|
36
38
|
|
37
|
-
def as_json(options)
|
39
|
+
def as_json(options = {})
|
38
40
|
hash = super
|
39
41
|
hash = { 'phase_id' => phase_id, 'edition_id' => edition_id, 'entries' => hash }
|
40
42
|
end
|
data/lib/infostrada/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infostrada
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Otero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|