xmlsoccer 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,7 +5,12 @@ This is a Ruby wrapper for the excellent soccer data Api that can be found at ww
5
5
 
6
6
  The API has data for all of the major leagues for both current and historic matches.
7
7
 
8
- ## Installation
8
+ #Version 0.1.0
9
+ The new version is drastically different from the previous version and will break implementations of the previous version. I appologize for this inconvenience. I considered supporting older implementations but the new version is far more elegant and support for deprecated method calls would be a big hindrance in taking this gem any further. However, the new version has all available methods from xmlsoccer with a fraction of the total lines, so I do hope that is consolation.
10
+
11
+ I will keep the documentation for Version 0.0.1 for the forseeable future, which you can find below.
12
+
13
+ ##Installation
9
14
 
10
15
  Add this line to your application's Gemfile:
11
16
 
@@ -18,6 +23,72 @@ And then execute:
18
23
  Or install it yourself as:
19
24
 
20
25
  $ gem install xmlsoccer
26
+
27
+ ##Usage
28
+
29
+ The XmlSoccer API is a SOAP service so this gem uses the 'Savon' gem to interface.
30
+
31
+ I would recommend everyone interested in using this gem to first read the documentation of the [API](http://xmlsoccer.wikia.com/wiki/Main_Page)
32
+
33
+ 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
34
+
35
+ The available API calls are defined when you instantiate an Xmlsoccer::Client object. Unlike the previous version of this gem, no specific call is hardcoded, rather the methods defined in the [xmlsoccer](http://www.xmlsoccer.com/FootballData.asmx?WSDL) documentation are dynamically defined. This change makes the gem much more lightweight but relies on the user to be conscious of the arguments passed to any method.
36
+
37
+ All methods and parameters that are listed on [xmlsoccer](http://www.xmlsoccer.com/FootballData.asmx?WSDL) need to be translated to snake case when using this gem. For example, `GetFixturesByDateInterval` should be `get_fixtures_by_date_interval` and `'StartDateString'` should be `start_date_string`. Note that there are some limitations with this, "fixtureMatch_Id" is not translated properly from `fixture_match_id`, therefore in this case you can simply pass in as a parameter ("fixtureMatch_Id" => 123).
38
+
39
+
40
+ ###Example Use
41
+
42
+ (You must have an API Key and know which type to use. Currently there are two types Xmlsoccer::DEMO and Xmlsoccer::FULL)
43
+
44
+ XmlSoccer API GetFixturesByDateInterval
45
+
46
+ xmlsoccer_client = Xmlsoccer::Client.new(api_key: 'Api_key', api_type:'Api_Type')
47
+
48
+ response = xmlsoccer_client.get_fixtures_by_date_interval(start_date_string: '2014-01-01', end_date_string: '2014-02-01')
49
+
50
+ response.each do |match|
51
+ put match[:date]
52
+ end
53
+
54
+
55
+ XmlSoccer Api GetAllLeagues
56
+
57
+
58
+ xmlsoccer_client = Xmlsoccer::Client.new(api_key: 'Api_key', api_type:'Api_Type')
59
+
60
+ response = xmlsoccer_client.get_all_leagues
61
+
62
+ response.each do |league|
63
+ put league[:name]
64
+ end
65
+
66
+ ###Exceptions
67
+
68
+ Xmlsoccer has a rate limit on nearly all of the Api methods ranging anywhere from 5 minutes to an hour. Rather than this gem manage when calls are made or simply return the String response returned by the api, the gem raises an Exception. So be sure to form your methods to catch exceptions,
69
+
70
+ begin
71
+ client.get_all_leagues
72
+ rescue Exception => e
73
+ #handle rate limit
74
+ end
75
+
76
+
77
+ #Version 0.0.1
78
+
79
+ ## Installation
80
+
81
+ Add this line to your application's Gemfile:
82
+
83
+ gem 'xmlsoccer', "~> 0.0.1"
84
+
85
+ And then execute:
86
+
87
+ $ bundle
88
+
89
+ Or install it yourself as:
90
+
91
+ $ gem install xmlsoccer -v 0.0.1
21
92
 
22
93
  ## Usage
23
94
 
@@ -32,9 +103,9 @@ Currently there is not support for Live Match Data.
32
103
  Example Use:
33
104
 
34
105
  XmlSoccer Api GetAllLeagues
106
+ (You must have an API Key and know which type to use. Currently there are two types Xmlsoccer::DEMO and Xmlsoccer::FULL)
35
107
 
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')
108
+ xmlsoccer_client = Xmlsoccer::RequestManager.new(api_key: 'Api_key', api_type:'Api_Type')
38
109
 
39
110
  leagues = xmlsoccer_client.get_all_leagues
40
111
 
data/lib/xmlsoccer.rb CHANGED
@@ -1,205 +1,9 @@
1
1
  require "xmlsoccer/version"
2
+ require "xmlsoccer/manifest"
3
+ require "xmlsoccer/config"
4
+ require "xmlsoccer/client"
2
5
  require 'savon'
3
6
 
4
7
  module Xmlsoccer
5
8
 
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
9
  end
@@ -0,0 +1,25 @@
1
+ module Xmlsoccer
2
+
3
+ class Client
4
+ @api_type = Xmlsoccer::Config::DEMO
5
+ @base_url
6
+ @client
7
+
8
+ include Manifest
9
+
10
+ attr_accessor :base_url, :api_type, :api_key, :client
11
+
12
+ def initialize(options={})
13
+ raise "API Type not valid" unless Xmlsoccer::Config.valid_type?(options[:api_type])
14
+ @api_key = options[:api_key]
15
+ @api_type = options[:api_type]
16
+ @base_url = Xmlsoccer::Config.const_get(@api_type.upcase + "_URL")
17
+ @client = Savon.client(wsdl: @base_url)
18
+ get_available_methods
19
+ end
20
+
21
+
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,16 @@
1
+ module Xmlsoccer
2
+
3
+ class Config
4
+
5
+ DEMO = "Demo"
6
+ FULL = "Full"
7
+ DEMO_URL = "http://www.xmlsoccer.com/FootballDataDemo.asmx?WSDL"
8
+ FULL_URL = "http://www.xmlsoccer.com/FootballData.asmx?WSDL"
9
+
10
+ def self.valid_type?(type)
11
+ [DEMO, FULL].include?(type)
12
+ end
13
+
14
+ end
15
+
16
+ end
@@ -0,0 +1,18 @@
1
+ module Xmlsoccer
2
+
3
+ module Manifest
4
+
5
+
6
+ def get_available_methods
7
+ self.client.operations.each do |method|
8
+ self.class.send(:define_method, method) do |options={}|
9
+ response = self.client.call(method, message: options.merge("ApiKey" => self.api_key))
10
+ response = response.hash[:envelope][:body]["#{method}_response".to_sym]["#{method}_result".to_sym][:xmlsoccer_com]
11
+ raise response.to_s unless response.respond_to?(:each)
12
+ response[response.keys.first]
13
+ end
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Xmlsoccer
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,29 @@
1
+
2
+ describe 'Leagues' do
3
+ before(:all) { savon.mock! }
4
+ after(:all) { savon.unmock! }
5
+
6
+ before(:all) do
7
+ @client = Xmlsoccer::Client.new(api_key: "12345", api_type: 'Full')
8
+ end
9
+
10
+ describe "GetAllLeagues" do
11
+
12
+ before(:each) do
13
+ message = {"ApiKey" => @client.api_key}
14
+ fixture = File.read("spec/fixtures/request_manager/get_all_leagues.xml")
15
+ response = {code: 200, headers: {}, body: fixture}
16
+ savon.expects(:get_all_leagues).with(message: message).returns(response)
17
+ @response = @client.get_all_leagues
18
+ end
19
+
20
+ it 'returns an array' do
21
+ expect(@response).to be_an_instance_of(Array)
22
+ end
23
+
24
+ it 'responds to league attributes' do
25
+ expect(@response).to include(HashedResponses::GetAllLeagues)
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,51 @@
1
+
2
+ describe 'Teams' do
3
+ before(:all) { savon.mock! }
4
+ after(:all) { savon.unmock! }
5
+
6
+ before(:all) do
7
+ @client = Xmlsoccer::Client.new(api_key: "12345", api_type: 'Full')
8
+ end
9
+
10
+ describe "GetAllTeams" do
11
+
12
+ before(:each) do
13
+ message = {"ApiKey" => @client.api_key}
14
+ fixture = File.read("spec/fixtures/request_manager/get_all_teams.xml")
15
+ response = {code: 200, headers: {}, body: fixture}
16
+ savon.expects(:get_all_teams).with(message: message).returns(response)
17
+ @response = @client.get_all_teams
18
+ end
19
+
20
+ it 'returns an array' do
21
+ expect(@response).to be_an_instance_of(Array)
22
+ end
23
+
24
+ it 'responds to team attributes' do
25
+ expect(@response).to include(HashedResponses::GetAllTeams)
26
+ end
27
+
28
+ end
29
+
30
+ describe "GetAllTeamsByLeagueAndSeason" do
31
+
32
+ before(:each) do
33
+ message = {"ApiKey" => @client.api_key, league: "English Premier League", season_date_string: "1011"}
34
+ fixture = File.read("spec/fixtures/request_manager/get_all_teams_by_league_and_season.xml")
35
+ response = {code: 200, headers: {}, body: fixture}
36
+ savon.expects(:get_all_teams_by_league_and_season).with(message: message).returns(response)
37
+ @response = @client.get_all_teams_by_league_and_season(league: "English Premier League", season_date_string: "1011")
38
+ end
39
+
40
+ it 'returns an array' do
41
+ expect(@response).to be_an_instance_of(Array)
42
+ end
43
+
44
+ it 'responds to team attributes' do
45
+ expect(@response).to include(HashedResponses::GetAllTeamsByLeagueAndSeason)
46
+ end
47
+
48
+ end
49
+
50
+
51
+ end
@@ -4,6 +4,8 @@ module HashedResponses
4
4
  country: "England", historical_data: "Yes", fixtures: "Yes", livescore: "Yes", number_of_matches: "2557",
5
5
  latest_match: DateTime.parse("2013-03-02T16:00:00+01:00")}
6
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
+ GetAllTeamsByLeagueAndSeason = { 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
9
 
8
10
 
9
11
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  require 'xmlsoccer'
2
-
2
+ require "savon/mock/spec_helper"
3
+ require "fixtures/request_manager/hashed_responses"
3
4
 
4
5
  RSpec.configure do |config|
5
-
6
+ include Savon::SpecHelper
7
+ include HashedResponses
8
+
9
+
10
+
6
11
  end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ module Xmlsoccer
5
+ describe Client do
6
+
7
+ it "should initialize a client with valid attributes" do
8
+ c = Xmlsoccer::Client.new(api_key: "12345", api_type: 'Full')
9
+ expect(c).to be_instance_of(Xmlsoccer::Client)
10
+ end
11
+
12
+ it "should return an error with an invalid type" do
13
+ expect{Xmlsoccer::Client.new(api_key: "12345", api_type: 'Invalid')}.to raise_exception
14
+ end
15
+
16
+
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ module Xmlsoccer
4
+ describe Config do
5
+
6
+ it 'returns correct string for DEMO' do
7
+ expect(Xmlsoccer::Config::DEMO).to eq('Demo')
8
+ end
9
+
10
+ it 'returns correct string for FULL' do
11
+ expect(Xmlsoccer::Config::FULL).to eq('Full')
12
+ end
13
+
14
+ it "returns correct wsdl url for FULL_URL" do
15
+ expect(Xmlsoccer::Config::FULL_URL).to eq('http://www.xmlsoccer.com/FootballData.asmx?WSDL')
16
+ end
17
+
18
+ it "returns correct wsdl url for DEMO_URL" do
19
+ expect(Xmlsoccer::Config::DEMO_URL).to eq('http://www.xmlsoccer.com/FootballDataDemo.asmx?WSDL')
20
+ end
21
+
22
+ end
23
+ end
@@ -1,131 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require 'spec_helper'
3
- require "savon/mock/spec_helper"
4
- require "fixtures/request_manager/hashed_responses"
5
3
 
6
4
  describe Xmlsoccer do
7
-
8
- include Savon::SpecHelper
9
- include HashedResponses
10
5
 
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
6
  end
131
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmlsoccer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
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: 2013-05-01 00:00:00.000000000 Z
12
+ date: 2014-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -106,12 +106,19 @@ files:
106
106
  - README.md
107
107
  - Rakefile
108
108
  - lib/xmlsoccer.rb
109
+ - lib/xmlsoccer/client.rb
110
+ - lib/xmlsoccer/config.rb
111
+ - lib/xmlsoccer/manifest.rb
109
112
  - lib/xmlsoccer/version.rb
113
+ - spec/features/leagues_spec.rb
114
+ - spec/features/teams_spec.rb
110
115
  - spec/fixtures/request_manager/get_all_leagues.xml
111
116
  - spec/fixtures/request_manager/get_all_teams.xml
112
117
  - spec/fixtures/request_manager/get_all_teams_by_league_and_season.xml
113
118
  - spec/fixtures/request_manager/hashed_responses.rb
114
119
  - spec/spec_helper.rb
120
+ - spec/xmlsoccer/client_spec.rb
121
+ - spec/xmlsoccer/config_spec.rb
115
122
  - spec/xmlsoccer_spec.rb
116
123
  - xmlsoccer.gemspec
117
124
  homepage: ''
@@ -126,22 +133,32 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
133
  - - ! '>='
127
134
  - !ruby/object:Gem::Version
128
135
  version: '0'
136
+ segments:
137
+ - 0
138
+ hash: 9569881441988933
129
139
  required_rubygems_version: !ruby/object:Gem::Requirement
130
140
  none: false
131
141
  requirements:
132
142
  - - ! '>='
133
143
  - !ruby/object:Gem::Version
134
144
  version: '0'
145
+ segments:
146
+ - 0
147
+ hash: 9569881441988933
135
148
  requirements: []
136
149
  rubyforge_project:
137
- rubygems_version: 1.8.21
150
+ rubygems_version: 1.8.25
138
151
  signing_key:
139
152
  specification_version: 3
140
153
  summary: Gem to interface witht the xmlsoccer.com API
141
154
  test_files:
155
+ - spec/features/leagues_spec.rb
156
+ - spec/features/teams_spec.rb
142
157
  - spec/fixtures/request_manager/get_all_leagues.xml
143
158
  - spec/fixtures/request_manager/get_all_teams.xml
144
159
  - spec/fixtures/request_manager/get_all_teams_by_league_and_season.xml
145
160
  - spec/fixtures/request_manager/hashed_responses.rb
146
161
  - spec/spec_helper.rb
162
+ - spec/xmlsoccer/client_spec.rb
163
+ - spec/xmlsoccer/config_spec.rb
147
164
  - spec/xmlsoccer_spec.rb