xml_soccer 0.0.3 → 0.0.4
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.
- data/lib/xml_soccer.rb +22 -28
- data/xml_soccer.gemspec +1 -1
- metadata +2 -2
data/lib/xml_soccer.rb
CHANGED
@@ -24,35 +24,33 @@ class XmlSoccer
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def leagues
|
27
|
-
call_api(method: "get_all_leagues",
|
27
|
+
call_api(method: "get_all_leagues", key: :league)
|
28
28
|
end
|
29
29
|
|
30
30
|
def teams
|
31
|
-
call_api(method: "get_all_teams",
|
31
|
+
call_api(method: "get_all_teams", key: :team)
|
32
32
|
end
|
33
33
|
|
34
34
|
def teams_in_league_by_season(league: nil, season: nil)
|
35
35
|
call_api(method: "get_all_teams_by_league_and_season",
|
36
|
-
message: {"
|
36
|
+
message: {"league" => league, "seasonDateString" => season},
|
37
37
|
key: :team)
|
38
38
|
end
|
39
39
|
|
40
40
|
def team(team: nil)
|
41
|
-
call_api(method: "get_team", message: {"
|
41
|
+
call_api(method: "get_team", message: {"team" => team}, key: :team)
|
42
42
|
end
|
43
43
|
|
44
44
|
def fixtures_by_date(start_date: nil, end_date: nil)
|
45
45
|
call_api(method: "get_fixtures_by_date_interval",
|
46
|
-
message: {"
|
47
|
-
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
46
|
+
message: {"startDateString" => start_date.strftime("%Y-%m-%d"),
|
48
47
|
"endDateString" => end_date.strftime("%Y-%m-%d")},
|
49
48
|
key: :match)
|
50
49
|
end
|
51
50
|
|
52
51
|
def fixtures_by_date_and_league(league: nil, start_date: nil, end_date: nil)
|
53
52
|
call_api(method: "get_fixtures_by_date_interval_and_league",
|
54
|
-
message: {"
|
55
|
-
"league" => league,
|
53
|
+
message: {"league" => league,
|
56
54
|
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
57
55
|
"endDateString" => end_date.strftime("%Y-%m-%d")},
|
58
56
|
key: :match)
|
@@ -60,8 +58,7 @@ class XmlSoccer
|
|
60
58
|
|
61
59
|
def fixtures_by_date_and_team(team: nil, start_date: nil, end_date: nil)
|
62
60
|
call_api(method: "get_fixtures_by_date_interval_and_team",
|
63
|
-
message: {"
|
64
|
-
"teamId" => team,
|
61
|
+
message: {"teamId" => team,
|
65
62
|
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
66
63
|
"endDateString" => end_date.strftime("%Y-%m-%d")},
|
67
64
|
key: :match)
|
@@ -69,26 +66,25 @@ class XmlSoccer
|
|
69
66
|
|
70
67
|
def fixtures_by_league_and_season(league: nil, season: nil)
|
71
68
|
call_api(method: "get_fixtures_by_league_and_season",
|
72
|
-
message: {"
|
69
|
+
message: {"league" => league, "seasonDateString" => season},
|
73
70
|
key: :match)
|
74
71
|
end
|
75
72
|
|
76
73
|
def historic_match_by_fixture(fixture_id: nil)
|
77
74
|
call_api(method: "get_historic_matches_by_fixture_match_id",
|
78
|
-
message: {"
|
75
|
+
message: {"Id" => fixture_id},
|
79
76
|
key: :match)
|
80
77
|
end
|
81
78
|
|
82
79
|
def historic_match(match_id: nil)
|
83
80
|
call_api(method: "get_historic_matches_by_id",
|
84
|
-
message: {"
|
81
|
+
message: {"Id" => match_id},
|
85
82
|
key: :match)
|
86
83
|
end
|
87
84
|
|
88
85
|
def historic_matches_by_league_and_date(league: nil, start_date: nil, end_date: nil)
|
89
86
|
call_api(method: "get_historic_matches_by_league_and_date_interval",
|
90
|
-
message: {"
|
91
|
-
"league" => league,
|
87
|
+
message: {"league" => league,
|
92
88
|
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
93
89
|
"endDateString" => end_date.strftime("%Y-%m-%d")},
|
94
90
|
key: :match)
|
@@ -96,14 +92,13 @@ class XmlSoccer
|
|
96
92
|
|
97
93
|
def historic_matches_by_league_and_season(league: nil, season: nil)
|
98
94
|
call_api(method: "get_historic_matches_by_league_and_season",
|
99
|
-
message: {"
|
95
|
+
message: {"league" => league, "seasonDateString" => season},
|
100
96
|
key: :match)
|
101
97
|
end
|
102
98
|
|
103
99
|
def historic_matches_by_team_and_date(team: nil, start_date: nil, end_date: nil)
|
104
100
|
call_api(method: "get_historic_matches_by_team_and_date_interval",
|
105
|
-
message: {"
|
106
|
-
"teamId" => team,
|
101
|
+
message: {"teamId" => team,
|
107
102
|
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
108
103
|
"endDateString" => end_date.strftime("%Y-%m-%d")},
|
109
104
|
key: :match)
|
@@ -111,8 +106,7 @@ class XmlSoccer
|
|
111
106
|
|
112
107
|
def historic_matches_by_teams_and_date(team_1: nil, team_2: nil, start_date: nil, end_date: nil)
|
113
108
|
call_api(method: "get_historic_matches_by_teams_and_date_interval",
|
114
|
-
message: {"
|
115
|
-
"team1Id" => team_1,
|
109
|
+
message: {"team1Id" => team_1,
|
116
110
|
"team2Id" => team_2,
|
117
111
|
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
118
112
|
"endDateString" => end_date.strftime("%Y-%m-%d")},
|
@@ -121,34 +115,33 @@ class XmlSoccer
|
|
121
115
|
|
122
116
|
def earliest_match_date_by_league(league: nil)
|
123
117
|
call_api(method: "get_earliest_match_date_per_league",
|
124
|
-
message: {"
|
125
|
-
"league" => league},
|
118
|
+
message: {"league" => league},
|
126
119
|
key: :league_information)
|
127
120
|
end
|
128
121
|
|
129
122
|
def league_standings_by_season(league: nil, season: nil)
|
130
123
|
call_api(method: "get_league_standings_by_season",
|
131
|
-
message: {"
|
124
|
+
message: {"league" => league, "seasonDateString" => season},
|
132
125
|
key: :team_league_standing)
|
133
126
|
end
|
134
127
|
|
135
128
|
def live_scores
|
136
|
-
call_api(method: "get_live_score",
|
129
|
+
call_api(method: "get_live_score", key: :match)
|
137
130
|
end
|
138
131
|
|
139
132
|
def live_scores_by_league(league: nil)
|
140
|
-
call_api(method: "get_live_score_by_league", message: {"
|
133
|
+
call_api(method: "get_live_score_by_league", message: {"league" => league}, key: :match)
|
141
134
|
end
|
142
135
|
|
143
136
|
def top_scorers_by_league_and_season(league: nil, season: nil)
|
144
137
|
call_api(method: "get_top_scorers_by_league_and_season",
|
145
|
-
message: {"
|
138
|
+
message: {"league" => league, "seasonDateString" => season},
|
146
139
|
key: :topscorer)
|
147
140
|
end
|
148
141
|
|
149
142
|
def odds_by_fixture(fixture_id: nil)
|
150
143
|
call_api(method: "get_odds_by_fixture_match_id",
|
151
|
-
message: {"
|
144
|
+
message: {"fixtureMatch_Id" => fixture_id},
|
152
145
|
key: :odds)
|
153
146
|
end
|
154
147
|
|
@@ -158,7 +151,8 @@ class XmlSoccer
|
|
158
151
|
end
|
159
152
|
|
160
153
|
private
|
161
|
-
def call_api(method: nil, message:
|
154
|
+
def call_api(method: nil, message: {}, key: nil)
|
155
|
+
message["ApiKey"] = api_key
|
162
156
|
response = client.call(method.to_sym, message: message)
|
163
157
|
hash_response = response.body["#{method}_response".to_sym]["#{method}_result".to_sym][:xmlsoccer_com]
|
164
158
|
|
data/xml_soccer.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml_soccer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|