soda_xml_team 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/Gemfile +2 -1
- data/LICENSE.txt +22 -0
- data/README.md +25 -3
- data/Rakefile +1 -7
- data/lib/ca-bundle.crt +30 -0
- data/lib/soda_xml_team.rb +7 -7
- data/lib/soda_xml_team/version.rb +1 -1
- data/soda_xml_team.gemspec +21 -22
- data/{test/fixtures/test_get_document.xml → spec/fixtures/get_document.xml} +0 -0
- data/{test/fixtures/test_get_listing.xml → spec/fixtures/get_listing.xml} +0 -0
- data/spec/soda_xml_team_spec.rb +72 -0
- data/spec/spec_helper.rb +18 -0
- data/tasks/rspec.rake +3 -0
- metadata +38 -35
- data/test/fixtures/test_parse_schedule.xml +0 -2234
- data/test/test_helper.rb +0 -6
- data/test/test_soda_xml_team.rb +0 -55
data/test/test_helper.rb
DELETED
data/test/test_soda_xml_team.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class SodaXmlTeamTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
if ENV['SODA_USERNAME'].nil? || ENV['SODA_PASSWORD'].nil?
|
7
|
-
raise "Must provide a SOAP_USERNAME and SOAP_PASSWORD environment variable to run tests."
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_get_listing
|
12
|
-
stub_request(:get, "https://#{ENV['SODA_USERNAME']}:#{ENV['SODA_PASSWORD']}@soda.xmlteam.com/api-trial/getListings?earliest-date-time=20100101T000000-0500&fixture-keys=schedule-single-team&latest-date-time=20110101T000000-0500&league-keys=l.nhl.com&max-result-count=10&revision-control=latest-only&stylesheet=sportsml2rss-1.0-s&team-keys=l.nhl.com-t.19").
|
13
|
-
to_return(:status => 200, :body => File.new("test/fixtures/test_get_listing.xml").read, :headers => {})
|
14
|
-
|
15
|
-
soda = SodaXmlTeam::Client.new(ENV['SODA_USERNAME'], ENV['SODA_PASSWORD'])
|
16
|
-
listing = soda.get_listing({
|
17
|
-
sandbox: true,
|
18
|
-
league_id: 'l.nhl.com',
|
19
|
-
team_id: 'l.nhl.com-t.19',
|
20
|
-
type: 'schedule-single-team',
|
21
|
-
start_datetime: DateTime.parse('2010-01-01 00:00:00 CDT'),
|
22
|
-
end_datetime: DateTime.parse('2011-01-01 00:00:00 CDT')
|
23
|
-
})
|
24
|
-
assert_equal 7, listing.css('item').length
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_get_document
|
28
|
-
|
29
|
-
stub_request(:get, "https://#{ENV['SODA_USERNAME']}:#{ENV['SODA_PASSWORD']}@soda.xmlteam.com/api-trial/getDocuments?doc-ids=xt.10875359-nas-sked").
|
30
|
-
to_return(:status => 200, :body => File.new("test/fixtures/test_get_document.xml").read, :headers => {})
|
31
|
-
|
32
|
-
soda = SodaXmlTeam::Client.new(ENV['SODA_USERNAME'], ENV['SODA_PASSWORD'])
|
33
|
-
document = soda.get_document({
|
34
|
-
sandbox: true,
|
35
|
-
document_id: 'xt.10875359-nas-sked'
|
36
|
-
})
|
37
|
-
assert_equal 1, document.css('schedule').length, "1 instance of schedule"
|
38
|
-
assert_equal 82, document.css('schedule sports-event').length, "82 games in a season"
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_parse_schedule
|
42
|
-
|
43
|
-
stub_request(:get, "https://#{ENV['SODA_USERNAME']}:#{ENV['SODA_PASSWORD']}@soda.xmlteam.com/api-trial/getDocuments?doc-ids=xt.10875359-nas-sked").
|
44
|
-
to_return(:status => 200, :body => File.new("test/fixtures/test_parse_schedule.xml").read, :headers => {})
|
45
|
-
|
46
|
-
soda = SodaXmlTeam::Client.new(ENV['SODA_USERNAME'], ENV['SODA_PASSWORD'])
|
47
|
-
document = soda.get_document({
|
48
|
-
sandbox: true,
|
49
|
-
document_id: 'xt.10875359-nas-sked'
|
50
|
-
})
|
51
|
-
schedule = SodaXmlTeam::Schedule.parse_schedule(document)
|
52
|
-
assert_equal 82, schedule.length, "82 games in a season"
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|