xmlsoccer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +53 -0
- data/Rakefile +6 -0
- data/lib/xmlsoccer/version.rb +3 -0
- data/lib/xmlsoccer.rb +205 -0
- data/spec/fixtures/request_manager/get_all_leagues.xml +32 -0
- data/spec/fixtures/request_manager/get_all_teams.xml +27 -0
- data/spec/fixtures/request_manager/get_all_teams_by_league_and_season.xml +27 -0
- data/spec/fixtures/request_manager/hashed_responses.rb +9 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/xmlsoccer_spec.rb +131 -0
- data/xmlsoccer.gemspec +23 -0
- metadata +147 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Kavinder Dhaliwal
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
# Xmlsoccer [![Build Status](https://secure.travis-ci.org/eifion/url_formatter.png)](https://secure.travis-ci.org/eifion/url_formatter.png)
|
3
|
+
|
4
|
+
This is a Ruby wrapper for the excellent soccer data Api that can be found at www.xmlsoccer.com
|
5
|
+
|
6
|
+
The API has data for all of the major leagues for both current and historic matches.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'xmlsoccer'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install xmlsoccer
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
The XmlSoccer API is a SOAP service so this gem uses the 'Savon' gem to interface.
|
25
|
+
|
26
|
+
I would recommend everyone interested in using this gem to first read the documentation of the API @ http://xmlsoccer.wikia.com/wiki/Main_Page
|
27
|
+
|
28
|
+
Additionally, the author of the API has put a rate limit on all requests. The gem does check against last request times, but it is still worth knowing: http://xmlsoccer.wikia.com/wiki/Time_interval_limits
|
29
|
+
|
30
|
+
Currently there is not support for Live Match Data.
|
31
|
+
|
32
|
+
Example Use:
|
33
|
+
|
34
|
+
XmlSoccer Api GetAllLeagues
|
35
|
+
|
36
|
+
*You must have an API Key and know which version to use. Currently there are two versions Xmlsoccer::DEMO and Xmlsoccer::FULL*
|
37
|
+
xmlsoccer_client = Xmlsoccer::RequestManager.new(api_key: 'Api_key', api_version:'Api_Version')
|
38
|
+
|
39
|
+
leagues = xmlsoccer_client.get_all_leagues
|
40
|
+
|
41
|
+
leagues.each do |league|
|
42
|
+
put league[:name]
|
43
|
+
end
|
44
|
+
|
45
|
+
As time permits I will add extensive Ruby specific documentation to the Wiki for this repo.
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/xmlsoccer.rb
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
require "xmlsoccer/version"
|
2
|
+
require 'savon'
|
3
|
+
|
4
|
+
module Xmlsoccer
|
5
|
+
|
6
|
+
DEMO = "Demo"
|
7
|
+
FULL = "Full"
|
8
|
+
class RequestManager
|
9
|
+
@api_type = "Demo"
|
10
|
+
@base_url
|
11
|
+
|
12
|
+
|
13
|
+
attr_accessor :base_url, :api_type, :api_key
|
14
|
+
|
15
|
+
WAIT = 'Wait 5 minutes between calls'
|
16
|
+
|
17
|
+
|
18
|
+
def initialize(options={})
|
19
|
+
@api_key = options[:api_key]
|
20
|
+
@api_type = options[:api_type]
|
21
|
+
if @api_type == DEMO
|
22
|
+
@base_url = "http://www.xmlsoccer.com/FootballDataDemo.asmx?WSDL"
|
23
|
+
elsif @api_type == FULL
|
24
|
+
@base_url = "http://www.xmlsoccer.com/FootballData.asmx?WSDL"
|
25
|
+
end
|
26
|
+
@client = Savon.client(wsdl: @base_url)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_all_leagues
|
30
|
+
if @last_call && @last_call > 60.minutes.ago
|
31
|
+
return WAIT
|
32
|
+
else
|
33
|
+
response = @client.call(:get_all_leagues, message:{"ApiKey" => @api_key})
|
34
|
+
@last_call =Time.now
|
35
|
+
return response.hash[:envelope][:body][:get_all_leagues_response][:get_all_leagues_result][:xmlsoccer_com][:league]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_all_teams
|
40
|
+
if @last_call && @last_call > 60.minutes.ago
|
41
|
+
return WAIT
|
42
|
+
else
|
43
|
+
response = @client.call(:get_all_teams, message:{"ApiKey" => @api_key})
|
44
|
+
@last_call =Time.now
|
45
|
+
return response.hash[:envelope][:body][:get_all_teams_response][:get_all_teams_result][:xmlsoccer_com][:team]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def get_teams_in_league(league, season_year)
|
50
|
+
if @last_call && @last_call > 5.minutes.ago
|
51
|
+
return WAIT
|
52
|
+
else
|
53
|
+
|
54
|
+
response = @client.call(:get_all_teams_by_league_and_season, message: {"ApiKey" => @api_key, "league" => league, "seasonDateString" => season_year})
|
55
|
+
@last_call = Time.now
|
56
|
+
return response.hash[:envelope][:body][:get_all_teams_by_league_and_season_response][:get_all_teams_by_league_and_season_result][:xmlsoccer_com][:team]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def get_fixtures_by_date_interval(start_date, end_date)
|
61
|
+
|
62
|
+
if @last_call && @last_call > 5.minutes.ago
|
63
|
+
return WAIT
|
64
|
+
else
|
65
|
+
api_key = @api_key
|
66
|
+
response = @client.call(:get_fixtures_by_date_interval) do
|
67
|
+
message("ApiKey" => api_key,
|
68
|
+
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
69
|
+
"endDateString" => end_date.strftime("%Y-%m-%d"))
|
70
|
+
end
|
71
|
+
return response.hash[:envelope][:body][:get_fixtures_by_date_interval_response][:get_fixtures_by_date_interval_result][:xmlsoccer_com][:match]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def get_fixtures_by_date_interval_and_league(league, start_date, end_date)
|
76
|
+
if @last_call && @last_call > 5.minutes.ago
|
77
|
+
return WAIT
|
78
|
+
else
|
79
|
+
api_key = @api_key
|
80
|
+
response = @client.call(:get_fixtures_by_date_interval_and_league) do
|
81
|
+
message("ApiKey" => api_key,
|
82
|
+
"league" => league,
|
83
|
+
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
84
|
+
"endDateString" => end_date.strftime("%Y-%m-%d"))
|
85
|
+
end
|
86
|
+
response = response.hash
|
87
|
+
return response[:envelope][:body][:get_fixtures_by_date_interval_and_league_response][:get_fixtures_by_date_interval_and_league_result][:xmlsoccer_com][:match]
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def get_fixtures_by_date_interval_and_team(team, start_date, end_date)
|
92
|
+
if @last_call && @last_call > 5.minutes.ago
|
93
|
+
return WAIT
|
94
|
+
else
|
95
|
+
api_key = @api_key
|
96
|
+
response = @client.call(:get_fixtures_by_date_interval_and_team) do
|
97
|
+
message("ApiKey" => api_key,
|
98
|
+
"team" => league,
|
99
|
+
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
100
|
+
"endDateString" => end_date.strftime("%Y-%m-%d"))
|
101
|
+
end
|
102
|
+
response = response.hash
|
103
|
+
return response[:envelope][:body][:get_fixtures_by_date_interval_and_team_response][:get_fixtures_by_date_interval_and_team_result][:xmlsoccer_com][:match]
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def get_historic_matches_by_fixture_match_id(fixture_id)
|
108
|
+
if @last_call && @last_call > 5.minutes.ago
|
109
|
+
return WAIT
|
110
|
+
else
|
111
|
+
api_key = @api_key
|
112
|
+
response = @client.call(:get_historic_matches_by_fixture_match_id) do
|
113
|
+
message("ApiKey" => api_key,
|
114
|
+
"id" => id)
|
115
|
+
end
|
116
|
+
response = response.hash
|
117
|
+
matches = response[:envelope][:body][:get_historic_matches_by_fixture_match_id_response][:get_historic_matches_by_fixture_match_id_result][:xmlsoccer_com][:match]
|
118
|
+
return matches
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def get_historic_matches_by_id(match_id)
|
123
|
+
if @last_call && @last_call > 5.minutes.ago
|
124
|
+
return WAIT
|
125
|
+
else
|
126
|
+
api_key = @api_key
|
127
|
+
response = @client.call(:get_historic_matches_by_id) do
|
128
|
+
message("ApiKey" => api_key,
|
129
|
+
"id" => id)
|
130
|
+
end
|
131
|
+
response = response.hash
|
132
|
+
matches = response[:envelope][:body][:get_historic_matches_by_id_response][:get_historic_matches_by_id_result][:xmlsoccer_com][:match]
|
133
|
+
return matches
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def get_historic_matches_by_league_and_date_interval(league, start_date, end_date)
|
138
|
+
if @last_call && @last_call > 5.minutes.ago
|
139
|
+
return WAIT
|
140
|
+
else
|
141
|
+
api_key = @api_key
|
142
|
+
response = @client.call(:get_historic_matches_by_league_and_date_interval) do
|
143
|
+
message("ApiKey" => api_key,
|
144
|
+
"league" => league,
|
145
|
+
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
146
|
+
"endDateString" => end_date.strftime("%Y-%m-%d"))
|
147
|
+
end
|
148
|
+
response = response.hash
|
149
|
+
matches = response[:envelope][:body][:get_historic_matches_by_league_and_date_interval_response][:get_historic_matches_by_league_and_date_interval_result][:xmlsoccer_com][:match]
|
150
|
+
return matches
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def get_historic_matches_by_league_and_season(league, interval)
|
155
|
+
if @last_call && @last_call > 5.minutes.ago
|
156
|
+
return WAIT
|
157
|
+
else
|
158
|
+
api_key = @api_key
|
159
|
+
response = @client.call(:get_historic_matches_by_league_and_season) do
|
160
|
+
message("ApiKey" => api_key,
|
161
|
+
"league" => league, "seasonDateString" => interval)
|
162
|
+
end
|
163
|
+
response = response.hash
|
164
|
+
matches = response[:envelope][:body][:get_historic_matches_by_league_and_season_response][:get_historic_matches_by_league_and_season_result][:xmlsoccer_com][:match]
|
165
|
+
return matches
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def get_historic_matches_by_team_and_date_interval(team, start_date, end_date)
|
170
|
+
if @last_call && @last_call > 5.minutes.ago
|
171
|
+
return WAIT
|
172
|
+
else
|
173
|
+
api_key = @api_key
|
174
|
+
response = @client.call(:get_historic_matches_by_team_and_date_interval) do
|
175
|
+
message("ApiKey" => api_key,
|
176
|
+
"teamId" => team,
|
177
|
+
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
178
|
+
"endDateString" => end_date.strftime("%Y-%m-%d"))
|
179
|
+
end
|
180
|
+
response = response.hash
|
181
|
+
matches = response[:envelope][:body][:get_historic_matches_by_team_and_date_interval_response][:get_historic_matches_by_team_and_date_interval_result][:xmlsoccer_com][:match]
|
182
|
+
return matches
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
def get_historic_matches_by_teams_and_date_interval(team_1, team_2, start_date, end_date)
|
187
|
+
if @last_call && @last_call > 5.minutes.ago
|
188
|
+
return WAIT
|
189
|
+
else
|
190
|
+
api_key = @api_key
|
191
|
+
response = @client.call(:get_historic_matches_by_teams_and_date_interval) do
|
192
|
+
message("ApiKey" => api_key,
|
193
|
+
"team1Id" => team_1,
|
194
|
+
"team2Id" => team_2,
|
195
|
+
"startDateString" => start_date.strftime("%Y-%m-%d"),
|
196
|
+
"endDateString" => end_date.strftime("%Y-%m-%d"))
|
197
|
+
end
|
198
|
+
response = response.hash
|
199
|
+
matches = response[:envelope][:body][:get_historic_matches_by_teams_and_date_interval_response][:get_historic_matches_by_teams_and_date_interval_result][:xmlsoccer_com][:match]
|
200
|
+
return matches
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Envelope>
|
3
|
+
<Body>
|
4
|
+
<GetAllLeaguesResponse>
|
5
|
+
<GetAllLeaguesResult>
|
6
|
+
<XMLSOCCER.COM>
|
7
|
+
<League>
|
8
|
+
<Id>1</Id>
|
9
|
+
<Name>English Premier League</Name>
|
10
|
+
<Country>England</Country>
|
11
|
+
<Historical_Data>Yes</Historical_Data>
|
12
|
+
<Fixtures>Yes</Fixtures>
|
13
|
+
<Livescore>Yes</Livescore>
|
14
|
+
<NumberOfMatches>2557</NumberOfMatches>
|
15
|
+
<LatestMatch>2013-03-02T16:00:00+01:00</LatestMatch>
|
16
|
+
</League>
|
17
|
+
<League>
|
18
|
+
<Id>2</Id>
|
19
|
+
<Name>English League Championship</Name>
|
20
|
+
<Country>England</Country>
|
21
|
+
<Historical_Data>Yes</Historical_Data>
|
22
|
+
<Fixtures>Yes</Fixtures>
|
23
|
+
<Livescore>Yes</Livescore>
|
24
|
+
<NumberOfMatches>3267</NumberOfMatches>
|
25
|
+
<LatestMatch>2013-03-02T16:00:00+01:00</LatestMatch>
|
26
|
+
</League>
|
27
|
+
<AccountInformation>Data requested at 02-03-2013 21:02:09 from XX.XX.XX.XX, Username: Espectro. Your current supscription runs out on XX-XX-XXXX 11:01:25.</AccountInformation>
|
28
|
+
</XMLSOCCER.COM>
|
29
|
+
</GetAllLeaguesResult>
|
30
|
+
</GetAllLeaguesResponse>
|
31
|
+
</Body>
|
32
|
+
</Envelope>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Envelope>
|
3
|
+
<Body>
|
4
|
+
<GetAllTeamsResponse>
|
5
|
+
<GetAllTeamsResult>
|
6
|
+
<XMLSOCCER.COM>
|
7
|
+
<Team>
|
8
|
+
<Team_Id>4</Team_Id>
|
9
|
+
<Name>Fulham</Name>
|
10
|
+
<Country>England</Country>
|
11
|
+
<Stadium>Craven Cottage</Stadium>
|
12
|
+
<HomePageURL>http://www.fulhamfc.com/</HomePageURL>
|
13
|
+
<WIKILink>http://en.wikipedia.org/wiki/Fulham_F.C.</WIKILink>
|
14
|
+
</Team>
|
15
|
+
<Team>
|
16
|
+
<Team_Id>5</Team_Id>
|
17
|
+
<Name>Aston Villa</Name>
|
18
|
+
<Country>England</Country>
|
19
|
+
<Stadium>Villa Park</Stadium>
|
20
|
+
<HomePageURL>http://www.avfc.co.uk/9laI7Jw</HomePageURL>
|
21
|
+
<WIKILink>http://en.wikipedia.org/wiki/Aston_Villa_F.C.</WIKILink>
|
22
|
+
</Team>
|
23
|
+
</XMLSOCCER.COM>
|
24
|
+
</GetAllTeamsResult>
|
25
|
+
</GetAllTeamsResponse>
|
26
|
+
</Body>
|
27
|
+
</Envelope>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Envelope>
|
3
|
+
<Body>
|
4
|
+
<GetAllTeamsByLeagueAndSeasonResponse>
|
5
|
+
<GetAllTeamsByLeagueAndSeasonResult>
|
6
|
+
<XMLSOCCER.COM>
|
7
|
+
<Team>
|
8
|
+
<Team_Id>4</Team_Id>
|
9
|
+
<Name>Fulham</Name>
|
10
|
+
<Country>England</Country>
|
11
|
+
<Stadium>Craven Cottage</Stadium>
|
12
|
+
<HomePageURL>http://www.fulhamfc.com/</HomePageURL>
|
13
|
+
<WIKILink>http://en.wikipedia.org/wiki/Fulham_F.C.</WIKILink>
|
14
|
+
</Team>
|
15
|
+
<Team>
|
16
|
+
<Team_Id>5</Team_Id>
|
17
|
+
<Name>Aston Villa</Name>
|
18
|
+
<Country>England</Country>
|
19
|
+
<Stadium>Villa Park</Stadium>
|
20
|
+
<HomePageURL>http://www.avfc.co.uk/9laI7Jw</HomePageURL>
|
21
|
+
<WIKILink>http://en.wikipedia.org/wiki/Aston_Villa_F.C.</WIKILink>
|
22
|
+
</Team>
|
23
|
+
</XMLSOCCER.COM>
|
24
|
+
</GetAllTeamsByLeagueAndSeasonResult>
|
25
|
+
</GetAllTeamsByLeagueAndSeasonResponse>
|
26
|
+
</Body>
|
27
|
+
</Envelope>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module HashedResponses
|
2
|
+
|
3
|
+
GetAllLeagues = {id: "1", name: "English Premier League",
|
4
|
+
country: "England", historical_data: "Yes", fixtures: "Yes", livescore: "Yes", number_of_matches: "2557",
|
5
|
+
latest_match: DateTime.parse("2013-03-02T16:00:00+01:00")}
|
6
|
+
GetAllTeams = { team_id: "4", name: "Fulham", country: "England", stadium: "Craven Cottage",home_page_url: "http://www.fulhamfc.com/", wiki_link: "http://en.wikipedia.org/wiki/Fulham_F.C."}
|
7
|
+
|
8
|
+
|
9
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require "savon/mock/spec_helper"
|
4
|
+
require "fixtures/request_manager/hashed_responses"
|
5
|
+
|
6
|
+
describe Xmlsoccer do
|
7
|
+
|
8
|
+
include Savon::SpecHelper
|
9
|
+
include HashedResponses
|
10
|
+
|
11
|
+
before(:all) { savon.mock! }
|
12
|
+
after(:all) { savon.unmock! }
|
13
|
+
|
14
|
+
it 'returns correct string for DEMO' do
|
15
|
+
expect(Xmlsoccer::DEMO).to eq('Demo')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'returns correct string for FULL' do
|
19
|
+
expect(Xmlsoccer::FULL).to eq('Full')
|
20
|
+
end
|
21
|
+
|
22
|
+
describe Xmlsoccer::RequestManager do
|
23
|
+
|
24
|
+
|
25
|
+
it 'initializes with an api key and version' do
|
26
|
+
(Xmlsoccer::RequestManager.new(api_key: 'testkey', api_type: Xmlsoccer::DEMO)).should be_an_instance_of(Xmlsoccer::RequestManager)
|
27
|
+
end
|
28
|
+
|
29
|
+
before do
|
30
|
+
@client = Xmlsoccer::RequestManager.new(api_key: 'testkey', api_type: Xmlsoccer::FULL)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'returns valid api key' do
|
34
|
+
expect(@client.api_key).to eq('testkey')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'returns valid api type' do
|
38
|
+
expect(@client.api_type).to eq(Xmlsoccer::FULL)
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
it 'returns valid base url' do
|
43
|
+
expect(@client.base_url).to eq("http://www.xmlsoccer.com/FootballData.asmx?WSDL")
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'calls api methods:' do
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'GetAllLeagues' do
|
50
|
+
before do
|
51
|
+
message = {"ApiKey" => "testkey"}
|
52
|
+
fixture = File.read("spec/fixtures/request_manager/get_all_leagues.xml")
|
53
|
+
|
54
|
+
response = {code: 200, headers: {}, body: fixture}
|
55
|
+
savon.expects(:get_all_leagues).with(message: message).returns(response)
|
56
|
+
@array = @client.get_all_leagues
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'returns an array' do
|
60
|
+
expect(@array).to be_an_instance_of(Array)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'responds to league attributes' do
|
64
|
+
expect(@array).to include(HashedResponses::GetAllLeagues)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'GetAllTeams' do
|
69
|
+
before do
|
70
|
+
message = {"ApiKey" => "testkey"}
|
71
|
+
fixture = File.read("spec/fixtures/request_manager/get_all_teams.xml")
|
72
|
+
|
73
|
+
response = {code: 200, headers: {}, body: fixture}
|
74
|
+
savon.expects(:get_all_teams).with(message: message).returns(response)
|
75
|
+
@array = @client.get_all_teams
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'returns an array' do
|
79
|
+
expect(@array).to be_an_instance_of(Array)
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'responds to team attributes' do
|
83
|
+
expect(@array).to include(HashedResponses::GetAllTeams)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe 'GetAllTeamsInLeague' do
|
88
|
+
before do
|
89
|
+
message = {"ApiKey" => "testkey",
|
90
|
+
"league" => "English Premier League", "seasonDateString" => "1011"}
|
91
|
+
fixture = File.read("spec/fixtures/request_manager/get_all_teams_by_league_and_season.xml")
|
92
|
+
response = {code: 200, headers: {}, body: fixture}
|
93
|
+
savon.expects(:get_all_teams_by_league_and_season).with(message: message).returns(response)
|
94
|
+
@array = @client.get_teams_in_league("English Premier League", "1011")
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'returns an array' do
|
98
|
+
expect(@array).to be_an_instance_of(Array)
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'responds to team attributes' do
|
102
|
+
expect(@array).to include(HashedResponses::GetAllTeams)
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
it 'gets all teams in a league'
|
109
|
+
|
110
|
+
it 'gets fixtures by a date interval'
|
111
|
+
|
112
|
+
it 'gets fixtures by date interval and league'
|
113
|
+
|
114
|
+
it 'gets fixtures by date interval and team'
|
115
|
+
|
116
|
+
it 'gets historic matches by fixture id'
|
117
|
+
|
118
|
+
it 'gets historic match by id'
|
119
|
+
|
120
|
+
it 'gets historic matches by league and date interval'
|
121
|
+
|
122
|
+
it 'gets historic matches by league and season'
|
123
|
+
|
124
|
+
it 'gets historic matches by team and date interval'
|
125
|
+
|
126
|
+
it 'gets historic matches between teams date interval'
|
127
|
+
|
128
|
+
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
data/xmlsoccer.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/xmlsoccer/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Kavinder Dhaliwal"]
|
6
|
+
gem.email = ["kavinderd@gmail.com"]
|
7
|
+
gem.platform = Gem::Platform::RUBY
|
8
|
+
gem.description = %q{Gem to interface with the xmlsoccer.com API}
|
9
|
+
gem.summary = %q{Gem to interface witht the xmlsoccer.com API}
|
10
|
+
gem.add_development_dependency 'rspec'
|
11
|
+
gem.add_development_dependency 'webmock'
|
12
|
+
gem.add_development_dependency "rake"
|
13
|
+
gem.add_runtime_dependency "supermodel"
|
14
|
+
gem.homepage = ""
|
15
|
+
|
16
|
+
gem.add_dependency "savon"
|
17
|
+
gem.files = `git ls-files`.split($\)
|
18
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
19
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
|
+
gem.name = "xmlsoccer"
|
21
|
+
gem.require_paths = ["lib"]
|
22
|
+
gem.version = Xmlsoccer::VERSION
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xmlsoccer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kavinder Dhaliwal
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: webmock
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: supermodel
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: savon
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: Gem to interface with the xmlsoccer.com API
|
95
|
+
email:
|
96
|
+
- kavinderd@gmail.com
|
97
|
+
executables: []
|
98
|
+
extensions: []
|
99
|
+
extra_rdoc_files: []
|
100
|
+
files:
|
101
|
+
- .gitignore
|
102
|
+
- .rspec
|
103
|
+
- .travis.yml
|
104
|
+
- Gemfile
|
105
|
+
- LICENSE
|
106
|
+
- README.md
|
107
|
+
- Rakefile
|
108
|
+
- lib/xmlsoccer.rb
|
109
|
+
- lib/xmlsoccer/version.rb
|
110
|
+
- spec/fixtures/request_manager/get_all_leagues.xml
|
111
|
+
- spec/fixtures/request_manager/get_all_teams.xml
|
112
|
+
- spec/fixtures/request_manager/get_all_teams_by_league_and_season.xml
|
113
|
+
- spec/fixtures/request_manager/hashed_responses.rb
|
114
|
+
- spec/spec_helper.rb
|
115
|
+
- spec/xmlsoccer_spec.rb
|
116
|
+
- xmlsoccer.gemspec
|
117
|
+
homepage: ''
|
118
|
+
licenses: []
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 1.8.21
|
138
|
+
signing_key:
|
139
|
+
specification_version: 3
|
140
|
+
summary: Gem to interface witht the xmlsoccer.com API
|
141
|
+
test_files:
|
142
|
+
- spec/fixtures/request_manager/get_all_leagues.xml
|
143
|
+
- spec/fixtures/request_manager/get_all_teams.xml
|
144
|
+
- spec/fixtures/request_manager/get_all_teams_by_league_and_season.xml
|
145
|
+
- spec/fixtures/request_manager/hashed_responses.rb
|
146
|
+
- spec/spec_helper.rb
|
147
|
+
- spec/xmlsoccer_spec.rb
|