xml_soccer 0.0.1.pre1

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.
@@ -0,0 +1,238 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'savon/mock/spec_helper'
4
+ require 'fixtures/hashed_responses'
5
+ require 'active_support/time'
6
+
7
+ describe XmlSoccer do
8
+
9
+ include Savon::SpecHelper
10
+ include HashedResponses
11
+
12
+ before(:all) { savon.mock! }
13
+ after(:all) { savon.unmock! }
14
+
15
+ it 'returns correct string for DEMO' do
16
+ expect(XmlSoccer::DEMO).to eq('Demo')
17
+ end
18
+
19
+ it 'returns correct string for FULL' do
20
+ expect(XmlSoccer::FULL).to eq('Full')
21
+ end
22
+
23
+ it 'initializes with an API key and version' do
24
+ expect(XmlSoccer.new(api_key: 'testkey', api_type: XmlSoccer::DEMO)).to be_a XmlSoccer
25
+ end
26
+
27
+ before do
28
+ @client = XmlSoccer.new(api_key: 'testkey', api_type: XmlSoccer::FULL)
29
+ end
30
+
31
+ describe '#leagues' do
32
+ before do
33
+ message = {"ApiKey" => "testkey"}
34
+ fixture = File.read("spec/fixtures/get_all_leagues.xml")
35
+
36
+ response = {code: 200, headers: {}, body: fixture}
37
+ savon.expects(:get_all_leagues).with(message: message).returns(response)
38
+ @array = @client.leagues
39
+ end
40
+
41
+ it 'returns an array' do
42
+ expect(@array).to be_an_instance_of(Array)
43
+ end
44
+
45
+ it 'returns expected leagues' do
46
+ expect(@array).to include(HashedResponses::GetAllLeagues)
47
+ end
48
+ end
49
+
50
+ describe '#teams' do
51
+ before do
52
+ message = {"ApiKey" => "testkey"}
53
+ fixture = File.read("spec/fixtures/get_all_teams.xml")
54
+
55
+ response = {code: 200, headers: {}, body: fixture}
56
+ savon.expects(:get_all_teams).with(message: message).returns(response)
57
+ @array = @client.teams
58
+ end
59
+
60
+ it 'returns an array' do
61
+ expect(@array).to be_an_instance_of(Array)
62
+ end
63
+
64
+ it 'returns expected team attributes' do
65
+ expect(@array).to include(HashedResponses::GetAllTeams)
66
+ end
67
+ end
68
+
69
+ describe '#teams_in_league_by_season' do
70
+ before do
71
+ message = {"ApiKey" => "testkey",
72
+ "league" => "English Premier League", "seasonDateString" => "1011"}
73
+ fixture = File.read("spec/fixtures/get_all_teams_by_league_and_season.xml")
74
+ response = {code: 200, headers: {}, body: fixture}
75
+ savon.expects(:get_all_teams_by_league_and_season).with(message: message).returns(response)
76
+ @array = @client.teams_in_league_by_season(league: "English Premier League", season: "1011")
77
+ end
78
+
79
+ it 'returns an array' do
80
+ expect(@array).to be_an_instance_of(Array)
81
+ end
82
+
83
+ it 'returns expected team attributes' do
84
+ expect(@array).to include(HashedResponses::GetAllTeams)
85
+ end
86
+
87
+ end
88
+
89
+ describe '#fixtures_by_date' do
90
+ before do
91
+ message = {"ApiKey" => "testkey",
92
+ "startDateString" => "2014-01-03",
93
+ "endDateString" => "2014-01-06"}
94
+ fixture = File.read("spec/fixtures/get_fixtures_by_date_interval.xml")
95
+ response = {code: 200, headers: {}, body: fixture}
96
+ savon.expects(:get_fixtures_by_date_interval).with(message: message).returns(response)
97
+ @array = @client.fixtures_by_date(start_date: Date.new(2014,1,3), end_date: Date.new(2014,1,6))
98
+ end
99
+
100
+ it 'returns expected fixtures' do
101
+ expect(@array).to include(HashedResponses::GetFixturesByDateInterval)
102
+ end
103
+ end
104
+
105
+ describe '#fixtures_by_date_and_league' do
106
+ before do
107
+ message = {"ApiKey" => "testkey",
108
+ "league" => "Scottish Premier League",
109
+ "startDateString" => "2014-01-03",
110
+ "endDateString" => "2014-01-06"}
111
+ fixture = File.read("spec/fixtures/get_fixtures_by_date_interval_and_league.xml")
112
+ response = {code: 200, headers: {}, body: fixture}
113
+ savon.expects(:get_fixtures_by_date_interval_and_league).with(message: message).returns(response)
114
+ @array = @client.fixtures_by_date_and_league(league: "Scottish Premier League", start_date: Date.new(2014,1,3), end_date: Date.new(2014,1,6))
115
+ end
116
+
117
+ it 'returns expected fixtures' do
118
+ expect(@array).to include(HashedResponses::GetFixturesByDateIntervalAndLeague)
119
+ end
120
+ end
121
+
122
+ describe '#fixtures_by_date_and_team' do
123
+ before do
124
+ message = {"ApiKey" => "testkey",
125
+ "teamId" => "Ross County",
126
+ "startDateString" => "2014-01-03",
127
+ "endDateString" => "2014-01-06"}
128
+ fixture = File.read("spec/fixtures/get_fixtures_by_date_interval_and_team.xml")
129
+ response = {code: 200, headers: {}, body: fixture}
130
+ savon.expects(:get_fixtures_by_date_interval_and_team).with(message: message).returns(response)
131
+ @array = @client.fixtures_by_date_and_team(team: "Ross County", start_date: Date.new(2014,1,3), end_date: Date.new(2014,1,6))
132
+ end
133
+
134
+ it 'returns expected fixtures' do
135
+ expect(@array).to include(HashedResponses::GetFixturesByDateIntervalAndTeam)
136
+ end
137
+ end
138
+
139
+ describe '#historic_match_by_fixture' do
140
+ before do
141
+ message = {"ApiKey" => "testkey",
142
+ "Id" => "324725" }
143
+ fixture = File.read("spec/fixtures/get_historic_matches_by_fixture_match_id.xml")
144
+ response = {code: 200, headers: {}, body: fixture}
145
+ savon.expects(:get_historic_matches_by_fixture_match_id).with(message: message).returns(response)
146
+ @array = @client.historic_match_by_fixture(fixture_id: "324725")
147
+ end
148
+
149
+ it 'returns expected match' do
150
+ expect(@array).to include(HashedResponses::GetHistoricMatchesByFixtureMatchId)
151
+ end
152
+ end
153
+
154
+ describe '#historic_match' do
155
+ before do
156
+ message = {"ApiKey" => "testkey",
157
+ "Id" => "65805" }
158
+ fixture = File.read("spec/fixtures/get_historic_matches_by_id.xml")
159
+ response = {code: 200, headers: {}, body: fixture}
160
+ savon.expects(:get_historic_matches_by_id).with(message: message).returns(response)
161
+ @array = @client.historic_match(match_id: "65805")
162
+ end
163
+
164
+ it 'returns expected match' do
165
+ expect(@array).to include(HashedResponses::GetHistoricMatchesById)
166
+ end
167
+ end
168
+
169
+ describe '#historic_matches_by_league_and_date' do
170
+ before do
171
+ message = {"ApiKey" => "testkey",
172
+ "league" => "Scottish Premier League",
173
+ "startDateString" => "2014-01-03",
174
+ "endDateString" => "2014-01-06" }
175
+ fixture = File.read("spec/fixtures/get_historic_matches_by_league_and_date_interval.xml")
176
+ response = {code: 200, headers: {}, body: fixture}
177
+ savon.expects(:get_historic_matches_by_league_and_date_interval).with(message: message).returns(response)
178
+ @array = @client.historic_matches_by_league_and_date(league: "Scottish Premier League", start_date: Date.new(2014, 1, 3), end_date: Date.new(2014, 1, 6))
179
+ end
180
+
181
+ it 'returns expected match' do
182
+ expect(@array).to include(HashedResponses::GetHistoricMatchesByLeagueAndDateInterval)
183
+ end
184
+ end
185
+
186
+ describe '#historic_matches_by_league_and_season' do
187
+ before do
188
+ message = {"ApiKey" => "testkey",
189
+ "league" => "Scottish Premier League",
190
+ "seasonDateString" => "" }
191
+ fixture = File.read("spec/fixtures/get_historic_matches_by_league_and_season.xml")
192
+ response = {code: 200, headers: {}, body: fixture}
193
+ savon.expects(:get_historic_matches_by_league_and_season).with(message: message).returns(response)
194
+ @array = @client.historic_matches_by_league_and_season(league: "Scottish Premier League", season: "")
195
+ end
196
+
197
+ it 'returns expected match' do
198
+ expect(@array).to include(HashedResponses::GetHistoricMatchesByLeagueAndSeason)
199
+ end
200
+ end
201
+
202
+ describe '#historic_matches_by_team_and_date' do
203
+ before do
204
+ message = {"ApiKey" => "testkey",
205
+ "teamId" => "360",
206
+ "startDateString" => "2014-01-03",
207
+ "endDateString" => "2014-01-06" }
208
+ fixture = File.read("spec/fixtures/get_historic_matches_by_team_and_date_interval.xml")
209
+ response = {code: 200, headers: {}, body: fixture}
210
+ savon.expects(:get_historic_matches_by_team_and_date_interval).with(message: message).returns(response)
211
+ @array = @client.historic_matches_by_team_and_date(team: "360", start_date: Date.new(2014,1,3), end_date: Date.new(2014,1,6))
212
+ end
213
+
214
+ it 'returns expected match' do
215
+ expect(@array).to include(HashedResponses::GetHistoricMatchesByTeamAndDateInterval)
216
+ end
217
+ end
218
+
219
+ describe '#historic_matches_by_teams_and_date' do
220
+ before do
221
+ message = {"ApiKey" => "testkey",
222
+ "team1Id" => "Ross County",
223
+ "team2Id" => "St Johnstone",
224
+ "startDateString" => "2014-01-03",
225
+ "endDateString" => "2014-01-06" }
226
+ fixture = File.read("spec/fixtures/get_historic_matches_by_teams_and_date_interval.xml")
227
+ response = {code: 200, headers: {}, body: fixture}
228
+ savon.expects(:get_historic_matches_by_teams_and_date_interval).with(message: message).returns(response)
229
+ @array = @client.historic_matches_by_teams_and_date(team_1: "Ross County", team_2: "St Johnstone", start_date: Date.new(2014,1,3), end_date: Date.new(2014,1,6))
230
+ end
231
+
232
+ it 'returns expected match' do
233
+ expect(@array).to include(HashedResponses::GetHistoricMatchesByTeamsAndDateInterval)
234
+ end
235
+ end
236
+
237
+ end
238
+
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #require File.expand_path('../lib/xml_soccer/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Matt Augustine"]
6
+ gem.email = ["nosenseworrying@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.homepage = "https://github.com/nosenseworrying/xmlsoccer"
11
+ gem.license = "MIT"
12
+
13
+ gem.required_ruby_version = ">= 2.0"
14
+ gem.add_dependency "savon", "~> 2.3"
15
+ gem.add_dependency "activesupport", "~> 3.0"
16
+ gem.add_development_dependency "rspec", "~> 2.14"
17
+ gem.add_development_dependency 'webmock', "~> 1.17"
18
+ gem.add_development_dependency "rake", "~> 10.1"
19
+ gem.add_runtime_dependency "supermodel", "~> 0.1"
20
+
21
+ gem.files = `git ls-files`.split($\)
22
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
23
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
24
+ gem.name = "xml_soccer"
25
+ gem.require_paths = ["lib"]
26
+ gem.version = "0.0.1.pre1"
27
+ end
metadata ADDED
@@ -0,0 +1,181 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xml_soccer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.pre1
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Matt Augustine
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-02-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: savon
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.3'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: activesupport
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '3.0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2.14'
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: '2.14'
62
+ - !ruby/object:Gem::Dependency
63
+ name: webmock
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.17'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.17'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '10.1'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '10.1'
94
+ - !ruby/object:Gem::Dependency
95
+ name: supermodel
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '0.1'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '0.1'
110
+ description: Gem to interface with the xmlsoccer.com API
111
+ email:
112
+ - nosenseworrying@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - .gitignore
118
+ - .rspec
119
+ - Gemfile
120
+ - LICENSE
121
+ - README.md
122
+ - Rakefile
123
+ - lib/xml_soccer.rb
124
+ - lib/xml_soccer/version.rb
125
+ - spec/fixtures/get_all_leagues.xml
126
+ - spec/fixtures/get_all_teams.xml
127
+ - spec/fixtures/get_all_teams_by_league_and_season.xml
128
+ - spec/fixtures/get_fixtures_by_date_interval.xml
129
+ - spec/fixtures/get_fixtures_by_date_interval_and_league.xml
130
+ - spec/fixtures/get_fixtures_by_date_interval_and_team.xml
131
+ - spec/fixtures/get_historic_matches_by_fixture_match_id.xml
132
+ - spec/fixtures/get_historic_matches_by_id.xml
133
+ - spec/fixtures/get_historic_matches_by_league_and_date_interval.xml
134
+ - spec/fixtures/get_historic_matches_by_league_and_season.xml
135
+ - spec/fixtures/get_historic_matches_by_team_and_date_interval.xml
136
+ - spec/fixtures/get_historic_matches_by_teams_and_date_interval.xml
137
+ - spec/fixtures/hashed_responses.rb
138
+ - spec/spec_helper.rb
139
+ - spec/xml_soccer_spec.rb
140
+ - xml_soccer.gemspec
141
+ homepage: https://github.com/nosenseworrying/xmlsoccer
142
+ licenses:
143
+ - MIT
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ! '>='
152
+ - !ruby/object:Gem::Version
153
+ version: '2.0'
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ none: false
156
+ requirements:
157
+ - - ! '>'
158
+ - !ruby/object:Gem::Version
159
+ version: 1.3.1
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 1.8.28
163
+ signing_key:
164
+ specification_version: 3
165
+ summary: Gem to interface witht the xmlsoccer.com API
166
+ test_files:
167
+ - spec/fixtures/get_all_leagues.xml
168
+ - spec/fixtures/get_all_teams.xml
169
+ - spec/fixtures/get_all_teams_by_league_and_season.xml
170
+ - spec/fixtures/get_fixtures_by_date_interval.xml
171
+ - spec/fixtures/get_fixtures_by_date_interval_and_league.xml
172
+ - spec/fixtures/get_fixtures_by_date_interval_and_team.xml
173
+ - spec/fixtures/get_historic_matches_by_fixture_match_id.xml
174
+ - spec/fixtures/get_historic_matches_by_id.xml
175
+ - spec/fixtures/get_historic_matches_by_league_and_date_interval.xml
176
+ - spec/fixtures/get_historic_matches_by_league_and_season.xml
177
+ - spec/fixtures/get_historic_matches_by_team_and_date_interval.xml
178
+ - spec/fixtures/get_historic_matches_by_teams_and_date_interval.xml
179
+ - spec/fixtures/hashed_responses.rb
180
+ - spec/spec_helper.rb
181
+ - spec/xml_soccer_spec.rb