infostrada 0.1.6 → 0.1.7

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: d79a8bcf5c2ab67f9fe7998508270fba23dee9c8
4
- data.tar.gz: 8ddff3986c64c29a170f9421c9e6e6f603fcb2c9
3
+ metadata.gz: 57b84b4aea8ee35eea27a04773b49ba49990cb0d
4
+ data.tar.gz: 18cf88bbe52dd649ad455f562d0271aa95c403e9
5
5
  SHA512:
6
- metadata.gz: cc2b7440ea74ea185293bad6debd6a697341926fe7956c9562da94bc07bb4a66ff162ad0080a56b0c653151a94e0ab007c4be6f6360bb7468f93f3249cc41fff
7
- data.tar.gz: 3e066c351a0a95db10ad6e91d7010514a2fe43fdf42d91900b874ad972d22d2ca74a7fa813c80048193cca27c91d7af2ca7b99517a8dfa93dbb9a460e970ee17
6
+ metadata.gz: 39bb14fa4737dd1bd36ceac3bebfd552d7e28c126882622f2b47a39f8773b854105fc50ae2c77394ae606c0ea35f10932f66be84bda9536e450cdc97385fc3c8
7
+ data.tar.gz: 3e271439c968b7e4a7a2a72ff047135cbce57ad51494cc149a903afe6064ccea6abb2c377b5b43320f30c2f0fff78904b4f0f42ad26671dced914d1b5535e191
@@ -50,7 +50,7 @@ module Infostrada
50
50
  end
51
51
 
52
52
  def self.get_latest
53
- since last_update || api_time(Time.now)
53
+ since api_time(Time.now-500000)
54
54
  end
55
55
 
56
56
  def self.since(date)
@@ -81,5 +81,11 @@ module Infostrada
81
81
 
82
82
  self
83
83
  end
84
+
85
+ # Helper method to return the match id from the query string.
86
+ def match_id
87
+ @query_string.match(/matchid=(\d+)/)
88
+ $1
89
+ end
84
90
  end
85
91
  end
@@ -99,7 +99,7 @@ module Infostrada
99
99
 
100
100
  def initialize(hash)
101
101
  @id = hash['n_MatchID']
102
- @date = Formatter.format_date(hash['d_Date'])
102
+ @date = Formatter.format_date(hash['d_DateUTC'])
103
103
  @rescheduled = hash['b_RescheduledToBeResumed']
104
104
  @round = hash['n_RoundNr']
105
105
  @time_unknown = hash['b_TimeUnknown']
@@ -1,11 +1,33 @@
1
1
  module Infostrada
2
+ # MatchEvent can have a lot of different events in a match.
3
+ #
4
+ # Here's a list of the n_ActionSet values, from Infostrada FAQ:
5
+ #
6
+ # 1 = Goals
7
+ # 2 = Penalty shootout
8
+ # 3 = Cards
9
+ # 4 = Line-up
10
+ # 5 = Substitutions
11
+ # 6 = Substitutes not used
12
+ # 7 = Players not selected / suspended
13
+ # 8 = Coaches
14
+ # 9 = Officials
15
+ # 10 = Missed penalties
16
+ # 11 = Captain
17
+ # 12 = Free kick / Foul / Corner / Offside / Shot / Save
18
+ # 13 = Possession
19
+ # 14 = Temporarily out
20
+ # 15 = Other
21
+ # 16 = Time
2
22
  class MatchEvent
3
23
  attr_accessor :id, :description, :short_description, :period, :period_short, :time, :home_goals
4
24
  attr_accessor :away_goals, :home_event, :team_id, :team_name, :team_short_name, :person_id
5
25
  attr_accessor :person_name, :person_short_name, :reason, :info, :person2_id, :person2_name
6
- attr_accessor :person2_short_name, :minute
26
+ attr_accessor :person2_short_name, :minute, :match_id, :action_set
27
+
28
+ def initialize(match_id, hash)
29
+ @match_id = match_id
7
30
 
8
- def initialize(hash)
9
31
  @id = hash['n_ActionID']
10
32
  @description = hash['c_Action']
11
33
  @short_description = hash['c_ActionShort']
@@ -14,7 +36,7 @@ module Infostrada
14
36
  @time = hash['n_ActionTime']
15
37
  @home_goals = hash['n_HomeGoals']
16
38
  @away_goals = hash['n_AwayGoals']
17
- @home_event = (hash['n_HomeOrAway'] == 1) ? true : false
39
+ @home_event = hash['n_HomeOrAway'] == 1 ? true : false
18
40
  @team_id = hash['n_TeamID']
19
41
  @team_name = hash['c_Team']
20
42
  @team_short_name = hash['c_TeamShort']
@@ -27,6 +49,7 @@ module Infostrada
27
49
  @person2_name = hash['c_SubPerson']
28
50
  @person2_short_name = hash['c_SubPersonShort']
29
51
  @minute = hash['c_ActionMinute']
52
+ @action_set = hash['n_ActionSet']
30
53
 
31
54
  self
32
55
  end
@@ -13,7 +13,7 @@ module Infostrada
13
13
 
14
14
  events = []
15
15
  list.each do |event_hash|
16
- events << MatchEvent.new(event_hash)
16
+ events << MatchEvent.new(match_id.to_i, event_hash)
17
17
  end
18
18
 
19
19
  events
@@ -1,3 +1,3 @@
1
1
  module Infostrada
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
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.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-22 00:00:00.000000000 Z
11
+ date: 2014-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler