infostrada 0.1.24 → 0.1.25
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 +3 -1
- data/lib/infostrada/table.rb +31 -6
- 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
|
+
NjU1YWFhNjRmN2NkNGJhMjAyZTk5NGRmMzNjNTg0ZmE3NWJlMzI3Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDllZmQwOGVkM2M2ZDdkNDdlOWE1YjgzMjI0ZjI4NGYwODhjNDRjNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Yjg4MzkwMjFjZGRmOWRkN2ZkZjEyZjVmMWIyOGYxODFlOGVlZDkzZTkwZjMx
|
10
|
+
MDg5MTNhODE4MTM1NTMzNGM5MTdmMDE3MTQ2OTk3Mzk3ZThhZDc2ZDlhOGUw
|
11
|
+
MmZkMTljY2RlOWU4Y2E2ZDNiNTlmYmQwODBmNDA0MmMyYzU3Mzk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDZmNTc0NDJmMTlhMTUxMGZmZTg1ZDBhNDcwMjIwNGRjNzhmMzgyMGZjNmYx
|
14
|
+
YzUyNjE3YTJmMzIwMTQxZjExZmE0YzFlMDFiNzVhMmZmODJlMmUzZjM3N2Ji
|
15
|
+
M2MxYTI3NTZhOTMyNzJlM2RiZjU2ZTI1MGQyZDZiMDEwZTI4MTg=
|
data/lib/infostrada/match.rb
CHANGED
@@ -16,7 +16,7 @@ module Infostrada
|
|
16
16
|
|
17
17
|
attr_accessor :id, :date, :rescheduled, :round, :home_team, :away_team, :phase, :status_short
|
18
18
|
attr_accessor :stadium_id, :stadium_name, :goals, :match_status, :finished, :awarded
|
19
|
-
attr_accessor :postponed, :referee, :spectators, :leg, :
|
19
|
+
attr_accessor :postponed, :referee, :spectators, :leg, :knockout_phase_id, :first_leg_score
|
20
20
|
attr_accessor :aggregate_winner_id, :current_period_started_at, :status, :started_at, :started
|
21
21
|
attr_accessor :edition, :time_unknown, :date_unknown, :city
|
22
22
|
|
@@ -120,6 +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 = hash['knockout_phase_id']
|
123
124
|
|
124
125
|
match.stadium_id = json['stadium_id']
|
125
126
|
match.stadium_name = json['stadium_name']
|
@@ -164,6 +165,7 @@ module Infostrada
|
|
164
165
|
@status_short = hash['c_MatchStatusShort']
|
165
166
|
@leg = hash['n_Leg']
|
166
167
|
@started_at = Formatter.format_date(hash['d_MatchStartTime'])
|
168
|
+
@knockout_phase_id = hash['n_KnockoutPhaseID']
|
167
169
|
|
168
170
|
@stadium_id = hash['n_StadiumGeoID']
|
169
171
|
@stadium_name = hash['c_Stadium']
|
data/lib/infostrada/table.rb
CHANGED
@@ -8,13 +8,20 @@ module Infostrada
|
|
8
8
|
|
9
9
|
def self.where(options = {})
|
10
10
|
phase_id = options.delete(:phase_id)
|
11
|
-
|
12
11
|
list = get!(URL, query: { phaseid: phase_id })
|
13
12
|
|
14
|
-
|
13
|
+
new(phase_id, list)
|
15
14
|
end
|
16
15
|
|
17
|
-
def
|
16
|
+
def self.from_json(json = {})
|
17
|
+
self.new do |table|
|
18
|
+
table.phase_id = json['phase_id']
|
19
|
+
table.edition_id = json['edition_id']
|
20
|
+
table.entries = json['entries'].map{ |entry| TableEntry.from_json(entry) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(phase_id = nil, table_list = [], &block)
|
18
25
|
@phase_id = phase_id
|
19
26
|
|
20
27
|
@entries = []
|
@@ -23,12 +30,13 @@ module Infostrada
|
|
23
30
|
@entries << TableEntry.new(hash)
|
24
31
|
end
|
25
32
|
|
33
|
+
block.call(self) if block_given?
|
26
34
|
self
|
27
35
|
end
|
28
36
|
|
29
|
-
def as_json
|
37
|
+
def as_json(options)
|
30
38
|
hash = super
|
31
|
-
hash = { 'phase_id' => phase_id, 'entries' => hash }
|
39
|
+
hash = { 'phase_id' => phase_id, 'edition_id' => edition_id, 'entries' => hash }
|
32
40
|
end
|
33
41
|
|
34
42
|
def each(&block)
|
@@ -40,7 +48,21 @@ module Infostrada
|
|
40
48
|
attr_accessor :team_id, :rank, :matches, :matches_won, :matches_drawn
|
41
49
|
attr_accessor :matches_lost, :points, :goals_for, :goals_against
|
42
50
|
|
43
|
-
def
|
51
|
+
def self.from_json(json = {})
|
52
|
+
self.new do |table_entry|
|
53
|
+
table_entry.team_id = json['team_id']
|
54
|
+
table_entry.rank = json['rank']
|
55
|
+
table_entry.matches = json['matches']
|
56
|
+
table_entry.matches_won = json['matches_won']
|
57
|
+
table_entry.matches_drawn = json['matches_drawn']
|
58
|
+
table_entry.matches_lost = json['matches_lost']
|
59
|
+
table_entry.points = json['points']
|
60
|
+
table_entry.goals_for = json['goals_for']
|
61
|
+
table_entry.goals_against = json['goals_against']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def initialize(hash = {}, &block)
|
44
66
|
@team_id = hash['n_TeamID']
|
45
67
|
@rank = hash['n_RankSort']
|
46
68
|
@matches = hash['n_Matches']
|
@@ -50,6 +72,9 @@ module Infostrada
|
|
50
72
|
@points = hash['n_Points']
|
51
73
|
@goals_for = hash['n_GoalsFor']
|
52
74
|
@goals_against = hash['n_GoalsAgainst']
|
75
|
+
|
76
|
+
block.call(self) if block_given?
|
77
|
+
self
|
53
78
|
end
|
54
79
|
end
|
55
80
|
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.25
|
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-02-
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|