soda_xml_team 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.travis.yml +6 -0
- data/Gemfile +3 -0
- data/README.md +59 -0
- data/Rakefile +9 -0
- data/lib/soda_xml_team.rb +9 -0
- data/lib/soda_xml_team/address.rb +97 -0
- data/lib/soda_xml_team/base.rb +4 -0
- data/lib/soda_xml_team/client.rb +25 -0
- data/lib/soda_xml_team/schedule.rb +42 -0
- data/lib/soda_xml_team/version.rb +3 -0
- data/soda_xml_team.gemspec +29 -0
- data/test/fixtures/test_get_document.xml +2234 -0
- data/test/fixtures/test_get_listing.xml +2 -0
- data/test/fixtures/test_parse_schedule.xml +2234 -0
- data/test/test_helper.rb +6 -0
- data/test/test_soda_xml_team.rb +55 -0
- metadata +147 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,55 @@
|
|
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
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: soda_xml_team
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen Yeargin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: webmock
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.18'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.18'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nokogiri
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.6.2
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '1.6'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.6.2
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: httparty
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0.13'
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0.13'
|
85
|
+
type: :runtime
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0.13'
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0.13'
|
95
|
+
description: A basic layer for interacting XML Team's Sports On Demand API (SODA)
|
96
|
+
email: stephen@yearg.in
|
97
|
+
executables: []
|
98
|
+
extensions: []
|
99
|
+
extra_rdoc_files: []
|
100
|
+
files:
|
101
|
+
- ".gitignore"
|
102
|
+
- ".travis.yml"
|
103
|
+
- Gemfile
|
104
|
+
- README.md
|
105
|
+
- Rakefile
|
106
|
+
- lib/soda_xml_team.rb
|
107
|
+
- lib/soda_xml_team/address.rb
|
108
|
+
- lib/soda_xml_team/base.rb
|
109
|
+
- lib/soda_xml_team/client.rb
|
110
|
+
- lib/soda_xml_team/schedule.rb
|
111
|
+
- lib/soda_xml_team/version.rb
|
112
|
+
- soda_xml_team.gemspec
|
113
|
+
- test/fixtures/test_get_document.xml
|
114
|
+
- test/fixtures/test_get_listing.xml
|
115
|
+
- test/fixtures/test_parse_schedule.xml
|
116
|
+
- test/test_helper.rb
|
117
|
+
- test/test_soda_xml_team.rb
|
118
|
+
homepage: https://github.com/seatshare/soda_xml_team
|
119
|
+
licenses:
|
120
|
+
- MIT
|
121
|
+
metadata: {}
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.3.0
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: XML Team Sports On Demand API
|
142
|
+
test_files:
|
143
|
+
- test/fixtures/test_get_document.xml
|
144
|
+
- test/fixtures/test_get_listing.xml
|
145
|
+
- test/fixtures/test_parse_schedule.xml
|
146
|
+
- test/test_helper.rb
|
147
|
+
- test/test_soda_xml_team.rb
|