regenersis-savon 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.gitignore +10 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +12 -0
  4. data/CHANGELOG.md +639 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +20 -0
  7. data/README.md +42 -0
  8. data/Rakefile +7 -0
  9. data/lib/regenersis-savon.rb +1 -0
  10. data/lib/savon.rb +15 -0
  11. data/lib/savon/client.rb +168 -0
  12. data/lib/savon/core_ext/object.rb +14 -0
  13. data/lib/savon/core_ext/string.rb +23 -0
  14. data/lib/savon/error.rb +6 -0
  15. data/lib/savon/global.rb +115 -0
  16. data/lib/savon/hooks/group.rb +46 -0
  17. data/lib/savon/hooks/hook.rb +36 -0
  18. data/lib/savon/http/error.rb +42 -0
  19. data/lib/savon/model.rb +103 -0
  20. data/lib/savon/soap.rb +21 -0
  21. data/lib/savon/soap/fault.rb +59 -0
  22. data/lib/savon/soap/request.rb +71 -0
  23. data/lib/savon/soap/response.rb +109 -0
  24. data/lib/savon/soap/xml.rb +227 -0
  25. data/lib/savon/version.rb +5 -0
  26. data/lib/savon/wasabi/document.rb +41 -0
  27. data/regenersis-savon.gemspec +35 -0
  28. data/spec/fixtures/gzip/message.gz +0 -0
  29. data/spec/fixtures/response/another_soap_fault.xml +14 -0
  30. data/spec/fixtures/response/authentication.xml +14 -0
  31. data/spec/fixtures/response/header.xml +13 -0
  32. data/spec/fixtures/response/list.xml +18 -0
  33. data/spec/fixtures/response/multi_ref.xml +39 -0
  34. data/spec/fixtures/response/soap_fault.xml +8 -0
  35. data/spec/fixtures/response/soap_fault12.xml +18 -0
  36. data/spec/fixtures/response/taxcloud.xml +1 -0
  37. data/spec/fixtures/wsdl/authentication.xml +63 -0
  38. data/spec/fixtures/wsdl/lower_camel.xml +52 -0
  39. data/spec/fixtures/wsdl/multiple_namespaces.xml +61 -0
  40. data/spec/fixtures/wsdl/multiple_types.xml +60 -0
  41. data/spec/fixtures/wsdl/taxcloud.xml +934 -0
  42. data/spec/savon/client_spec.rb +461 -0
  43. data/spec/savon/core_ext/object_spec.rb +19 -0
  44. data/spec/savon/core_ext/string_spec.rb +37 -0
  45. data/spec/savon/http/error_spec.rb +52 -0
  46. data/spec/savon/model_spec.rb +194 -0
  47. data/spec/savon/savon_spec.rb +85 -0
  48. data/spec/savon/soap/fault_spec.rb +89 -0
  49. data/spec/savon/soap/request_spec.rb +57 -0
  50. data/spec/savon/soap/response_spec.rb +224 -0
  51. data/spec/savon/soap/xml_spec.rb +309 -0
  52. data/spec/savon/soap_spec.rb +16 -0
  53. data/spec/savon/wasabi/document_spec.rb +45 -0
  54. data/spec/spec_helper.rb +15 -0
  55. data/spec/support/endpoint.rb +25 -0
  56. data/spec/support/fixture.rb +35 -0
  57. metadata +323 -0
@@ -0,0 +1,16 @@
1
+ require "spec_helper"
2
+
3
+ describe Savon::SOAP do
4
+
5
+ it "should contain the SOAP namespace for each supported SOAP version" do
6
+ Savon::SOAP::Versions.each do |soap_version|
7
+ Savon::SOAP::Namespace[soap_version].should be_a(String)
8
+ Savon::SOAP::Namespace[soap_version].should_not be_empty
9
+ end
10
+ end
11
+
12
+ it "should contain a Rage of supported SOAP versions" do
13
+ Savon::SOAP::Versions.should == (1..2)
14
+ end
15
+
16
+ end
@@ -0,0 +1,45 @@
1
+ require "spec_helper"
2
+
3
+ describe Savon::Wasabi::Document do
4
+
5
+ context "with a remote document" do
6
+ before do
7
+ response = HTTPI::Response.new 200, {}, Fixture.wsdl(:authentication)
8
+ HTTPI.stubs(:get).returns(response)
9
+ end
10
+
11
+ it "should resolve via HTTP" do
12
+ wsdl = Savon::Wasabi::Document.new("http://example.com?wsdl")
13
+ wsdl.xml.should == Fixture.wsdl(:authentication)
14
+ end
15
+
16
+ it "should resolve via HTTPS" do
17
+ wsdl = Savon::Wasabi::Document.new("https://example.com?wsdl")
18
+ wsdl.xml.should == Fixture.wsdl(:authentication)
19
+ end
20
+ end
21
+
22
+ context "with a local document" do
23
+ before do
24
+ HTTPI.expects(:get).never
25
+ end
26
+
27
+ it "should read the file" do
28
+ wsdl = Savon::Wasabi::Document.new("spec/fixtures/wsdl/authentication.xml")
29
+ wsdl.xml.should == Fixture.wsdl(:authentication)
30
+ end
31
+ end
32
+
33
+ context "with raw XML" do
34
+ before do
35
+ HTTPI.expects(:get).never
36
+ File.expects(:read).never
37
+ end
38
+
39
+ it "should use the raw XML" do
40
+ wsdl = Savon::Wasabi::Document.new Fixture.wsdl(:authentication)
41
+ wsdl.xml.should == Fixture.wsdl(:authentication)
42
+ end
43
+ end
44
+
45
+ end
@@ -0,0 +1,15 @@
1
+ require "bundler"
2
+ Bundler.require :default, :development
3
+
4
+ RSpec.configure do |config|
5
+ config.mock_with :mocha
6
+ end
7
+
8
+ # Disable logging and deprecations for specs.
9
+ Savon.configure do |config|
10
+ config.log = false
11
+ config.deprecate = false
12
+ end
13
+
14
+ require "support/endpoint"
15
+ require "support/fixture"
@@ -0,0 +1,25 @@
1
+ class Endpoint
2
+ class << self
3
+
4
+ # Returns the WSDL endpoint for a given +type+ of request.
5
+ def wsdl(type = nil)
6
+ case type
7
+ when :no_namespace then "http://nons.example.com/Service?wsdl"
8
+ when :namespaced_actions then "http://nsactions.example.com/Service?wsdl"
9
+ when :geotrust then "https://test-api.geotrust.com/webtrust/query.jws?WSDL"
10
+ else soap(type)
11
+ end
12
+ end
13
+
14
+ # Returns the SOAP endpoint for a given +type+ of request.
15
+ def soap(type = nil)
16
+ case type
17
+ when :soap_fault then "http://soapfault.example.com/Service?wsdl"
18
+ when :http_error then "http://httperror.example.com/Service?wsdl"
19
+ when :invalid then "http://invalid.example.com/Service?wsdl"
20
+ else "http://example.com/validation/1.0/AuthenticationService"
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,35 @@
1
+ class Fixture
2
+
3
+ TYPES = { :gzip => "gz", :response => "xml", :wsdl => "xml" }
4
+
5
+ class << self
6
+
7
+ def [](type, fixture)
8
+ fixtures(type)[fixture] ||= read_file type, fixture
9
+ end
10
+
11
+ def response_hash(fixture)
12
+ @response_hash ||= {}
13
+ @response_hash[fixture] ||= Nori.parse(response(fixture))[:envelope][:body]
14
+ end
15
+
16
+ TYPES.each do |type, ext|
17
+ define_method(type) { |fixture| self[type, fixture] }
18
+ end
19
+
20
+ private
21
+
22
+ def fixtures(type)
23
+ @fixtures ||= {}
24
+ @fixtures[type] ||= {}
25
+ end
26
+
27
+ def read_file(type, fixture)
28
+ path = File.expand_path "../../fixtures/#{type}/#{fixture}.#{TYPES[type]}", __FILE__
29
+ raise ArgumentError, "Unable to load: #{path}" unless File.exist? path
30
+
31
+ File.read path
32
+ end
33
+
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,323 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: regenersis-savon
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Daniel Harrington
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-10-11 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: builder
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 2
32
+ - 1
33
+ - 2
34
+ version: 2.1.2
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: nori
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 15
46
+ segments:
47
+ - 1
48
+ - 0
49
+ version: "1.0"
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: regenersis-httpi
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 25
61
+ segments:
62
+ - 0
63
+ - 9
64
+ version: "0.9"
65
+ type: :runtime
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: wasabi
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 2
78
+ - 0
79
+ version: "2.0"
80
+ type: :runtime
81
+ version_requirements: *id004
82
+ - !ruby/object:Gem::Dependency
83
+ name: akami
84
+ prerelease: false
85
+ requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ hash: 15
91
+ segments:
92
+ - 1
93
+ - 0
94
+ version: "1.0"
95
+ type: :runtime
96
+ version_requirements: *id005
97
+ - !ruby/object:Gem::Dependency
98
+ name: gyoku
99
+ prerelease: false
100
+ requirement: &id006 !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ hash: 15
106
+ segments:
107
+ - 0
108
+ - 4
109
+ - 0
110
+ version: 0.4.0
111
+ type: :runtime
112
+ version_requirements: *id006
113
+ - !ruby/object:Gem::Dependency
114
+ name: nokogiri
115
+ prerelease: false
116
+ requirement: &id007 !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ hash: 7
122
+ segments:
123
+ - 1
124
+ - 4
125
+ - 0
126
+ version: 1.4.0
127
+ type: :runtime
128
+ version_requirements: *id007
129
+ - !ruby/object:Gem::Dependency
130
+ name: rake
131
+ prerelease: false
132
+ requirement: &id008 !ruby/object:Gem::Requirement
133
+ none: false
134
+ requirements:
135
+ - - ~>
136
+ - !ruby/object:Gem::Version
137
+ hash: 49
138
+ segments:
139
+ - 0
140
+ - 8
141
+ - 7
142
+ version: 0.8.7
143
+ type: :development
144
+ version_requirements: *id008
145
+ - !ruby/object:Gem::Dependency
146
+ name: rspec
147
+ prerelease: false
148
+ requirement: &id009 !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ~>
152
+ - !ruby/object:Gem::Version
153
+ hash: 27
154
+ segments:
155
+ - 2
156
+ - 5
157
+ - 0
158
+ version: 2.5.0
159
+ type: :development
160
+ version_requirements: *id009
161
+ - !ruby/object:Gem::Dependency
162
+ name: mocha
163
+ prerelease: false
164
+ requirement: &id010 !ruby/object:Gem::Requirement
165
+ none: false
166
+ requirements:
167
+ - - ~>
168
+ - !ruby/object:Gem::Version
169
+ hash: 43
170
+ segments:
171
+ - 0
172
+ - 9
173
+ - 8
174
+ version: 0.9.8
175
+ type: :development
176
+ version_requirements: *id010
177
+ - !ruby/object:Gem::Dependency
178
+ name: timecop
179
+ prerelease: false
180
+ requirement: &id011 !ruby/object:Gem::Requirement
181
+ none: false
182
+ requirements:
183
+ - - ~>
184
+ - !ruby/object:Gem::Version
185
+ hash: 25
186
+ segments:
187
+ - 0
188
+ - 3
189
+ - 5
190
+ version: 0.3.5
191
+ type: :development
192
+ version_requirements: *id011
193
+ - !ruby/object:Gem::Dependency
194
+ name: autotest
195
+ prerelease: false
196
+ requirement: &id012 !ruby/object:Gem::Requirement
197
+ none: false
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ hash: 3
202
+ segments:
203
+ - 0
204
+ version: "0"
205
+ type: :development
206
+ version_requirements: *id012
207
+ - !ruby/object:Gem::Dependency
208
+ name: ZenTest
209
+ prerelease: false
210
+ requirement: &id013 !ruby/object:Gem::Requirement
211
+ none: false
212
+ requirements:
213
+ - - "="
214
+ - !ruby/object:Gem::Version
215
+ hash: 43
216
+ segments:
217
+ - 4
218
+ - 5
219
+ - 0
220
+ version: 4.5.0
221
+ type: :development
222
+ version_requirements: *id013
223
+ description: Ruby's heavy metal SOAP client
224
+ email: me@rubiii.com
225
+ executables: []
226
+
227
+ extensions: []
228
+
229
+ extra_rdoc_files: []
230
+
231
+ files:
232
+ - .gitignore
233
+ - .rspec
234
+ - .travis.yml
235
+ - CHANGELOG.md
236
+ - Gemfile
237
+ - LICENSE
238
+ - README.md
239
+ - Rakefile
240
+ - lib/regenersis-savon.rb
241
+ - lib/savon.rb
242
+ - lib/savon/client.rb
243
+ - lib/savon/core_ext/object.rb
244
+ - lib/savon/core_ext/string.rb
245
+ - lib/savon/error.rb
246
+ - lib/savon/global.rb
247
+ - lib/savon/hooks/group.rb
248
+ - lib/savon/hooks/hook.rb
249
+ - lib/savon/http/error.rb
250
+ - lib/savon/model.rb
251
+ - lib/savon/soap.rb
252
+ - lib/savon/soap/fault.rb
253
+ - lib/savon/soap/request.rb
254
+ - lib/savon/soap/response.rb
255
+ - lib/savon/soap/xml.rb
256
+ - lib/savon/version.rb
257
+ - lib/savon/wasabi/document.rb
258
+ - regenersis-savon.gemspec
259
+ - spec/fixtures/gzip/message.gz
260
+ - spec/fixtures/response/another_soap_fault.xml
261
+ - spec/fixtures/response/authentication.xml
262
+ - spec/fixtures/response/header.xml
263
+ - spec/fixtures/response/list.xml
264
+ - spec/fixtures/response/multi_ref.xml
265
+ - spec/fixtures/response/soap_fault.xml
266
+ - spec/fixtures/response/soap_fault12.xml
267
+ - spec/fixtures/response/taxcloud.xml
268
+ - spec/fixtures/wsdl/authentication.xml
269
+ - spec/fixtures/wsdl/lower_camel.xml
270
+ - spec/fixtures/wsdl/multiple_namespaces.xml
271
+ - spec/fixtures/wsdl/multiple_types.xml
272
+ - spec/fixtures/wsdl/taxcloud.xml
273
+ - spec/savon/client_spec.rb
274
+ - spec/savon/core_ext/object_spec.rb
275
+ - spec/savon/core_ext/string_spec.rb
276
+ - spec/savon/http/error_spec.rb
277
+ - spec/savon/model_spec.rb
278
+ - spec/savon/savon_spec.rb
279
+ - spec/savon/soap/fault_spec.rb
280
+ - spec/savon/soap/request_spec.rb
281
+ - spec/savon/soap/response_spec.rb
282
+ - spec/savon/soap/xml_spec.rb
283
+ - spec/savon/soap_spec.rb
284
+ - spec/savon/wasabi/document_spec.rb
285
+ - spec/spec_helper.rb
286
+ - spec/support/endpoint.rb
287
+ - spec/support/fixture.rb
288
+ has_rdoc: true
289
+ homepage: http://savonrb.com
290
+ licenses: []
291
+
292
+ post_install_message:
293
+ rdoc_options: []
294
+
295
+ require_paths:
296
+ - lib
297
+ required_ruby_version: !ruby/object:Gem::Requirement
298
+ none: false
299
+ requirements:
300
+ - - ">="
301
+ - !ruby/object:Gem::Version
302
+ hash: 3
303
+ segments:
304
+ - 0
305
+ version: "0"
306
+ required_rubygems_version: !ruby/object:Gem::Requirement
307
+ none: false
308
+ requirements:
309
+ - - ">="
310
+ - !ruby/object:Gem::Version
311
+ hash: 3
312
+ segments:
313
+ - 0
314
+ version: "0"
315
+ requirements: []
316
+
317
+ rubyforge_project: regenersis-savon
318
+ rubygems_version: 1.3.7
319
+ signing_key:
320
+ specification_version: 3
321
+ summary: Heavy metal Ruby SOAP client
322
+ test_files: []
323
+