lolsoap 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,7 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
- - 1.9.2
5
3
  - 1.9.3
6
- # - jruby
7
- # - rbx-18mode
4
+ - 2.0.0
data/README.md CHANGED
@@ -105,6 +105,17 @@ Development sponsored by [Loco2](http://loco2.com/).
105
105
 
106
106
  ## Changelog ##
107
107
 
108
+ ### 0.4 ###
109
+
110
+ * Don't raise an exception on when a SOAP fault is detected. Whether or
111
+ not this is an exceptional situation should be up to the user, as APIs
112
+ may use SOAP faults to implement business logic errors.
113
+ * Ruby 1.8 support dropped
114
+
115
+ ### 0.3 ###
116
+
117
+ * Support for WSDL inline type definitions and type extensions
118
+
108
119
  ### 0.2 ###
109
120
 
110
121
  * SOAP 1.1 support
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.4.0
data/lib/lolsoap/fault.rb CHANGED
@@ -17,21 +17,21 @@ module LolSoap
17
17
 
18
18
  def code
19
19
  node.at_xpath(
20
- soap_version == '1.2' ? './soap:Code/soap:Value' : './soap:faultcode',
20
+ soap_version == '1.2' ? './soap:Code/soap:Value' : './faultcode',
21
21
  'soap' => soap_namespace
22
22
  ).text.to_s
23
23
  end
24
24
 
25
25
  def reason
26
26
  node.at_xpath(
27
- soap_version == '1.2' ? './soap:Reason/soap:Text' : './soap:faultstring',
27
+ soap_version == '1.2' ? './soap:Reason/soap:Text' : './faultstring',
28
28
  'soap' => soap_namespace
29
29
  ).text.to_s
30
30
  end
31
31
 
32
32
  def detail
33
33
  node.at_xpath(
34
- soap_version == '1.2' ? './soap:Detail/*' : './soap:detail/*',
34
+ soap_version == '1.2' ? './soap:Detail/*' : './detail/*',
35
35
  'soap' => soap_namespace
36
36
  ).to_xml
37
37
  end
@@ -1,4 +1,3 @@
1
- require 'lolsoap/errors'
2
1
  require 'lolsoap/fault'
3
2
  require 'lolsoap/hash_builder'
4
3
  require 'nokogiri'
@@ -22,8 +21,6 @@ module LolSoap
22
21
  def initialize(request, doc)
23
22
  @request = request
24
23
  @doc = doc
25
-
26
- raise FaultRaised.new(fault) if fault
27
24
  end
28
25
 
29
26
  # Namespace used for SOAP Envelope tags
@@ -46,7 +43,7 @@ module LolSoap
46
43
  @header ||= doc.at_xpath('/soap:Envelope/soap:Header', 'soap' => soap_namespace)
47
44
  end
48
45
 
49
- # SOAP fault, if any (an exception will be raised in the initializer, if there is one)
46
+ # SOAP fault, if any
50
47
  def fault
51
48
  @fault ||= begin
52
49
  node = doc.at_xpath('/soap:Envelope/soap:Body/soap:Fault', 'soap' => soap_namespace)
@@ -1,4 +1,5 @@
1
1
  require 'nokogiri'
2
+ require 'cgi'
2
3
 
3
4
  module LolSoap
4
5
  # @private
@@ -125,7 +126,7 @@ module LolSoap
125
126
  end
126
127
 
127
128
  def endpoint
128
- @endpoint ||= doc.at_xpath('/d:definitions/d:service/d:port/s:address/@location', ns).to_s
129
+ @endpoint ||= CGI.unescape(doc.at_xpath('/d:definitions/d:service/d:port/s:address/@location', ns).to_s)
129
130
  end
130
131
 
131
132
  def schemas
@@ -251,3 +252,4 @@ module LolSoap
251
252
  end
252
253
  end
253
254
  end
255
+
data/lib/lolsoap.rb CHANGED
@@ -2,7 +2,6 @@ module LolSoap
2
2
  require 'lolsoap/builder'
3
3
  require 'lolsoap/client'
4
4
  require 'lolsoap/envelope'
5
- require 'lolsoap/errors'
6
5
  require 'lolsoap/fault'
7
6
  require 'lolsoap/request'
8
7
  require 'lolsoap/response'
data/lolsoap.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "lolsoap"
8
- s.version = "0.3.2"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jon Leighton"]
12
- s.date = "2013-06-27"
12
+ s.date = "2013-08-17"
13
13
  s.description = "A library for dealing with SOAP requests and responses. We tear our hair out so you don't have to."
14
14
  s.email = "j@jonathanleighton.com"
15
15
  s.extra_rdoc_files = [
@@ -30,7 +30,6 @@ Gem::Specification.new do |s|
30
30
  "lib/lolsoap/builder.rb",
31
31
  "lib/lolsoap/client.rb",
32
32
  "lib/lolsoap/envelope.rb",
33
- "lib/lolsoap/errors.rb",
34
33
  "lib/lolsoap/fault.rb",
35
34
  "lib/lolsoap/hash_builder.rb",
36
35
  "lib/lolsoap/request.rb",
@@ -134,7 +134,7 @@
134
134
  <service name="StockQuoteService">
135
135
  <documentation>My first service</documentation>
136
136
  <port name="StockQuotePort" binding="tns:StockQuoteSoapBinding">
137
- <soap:address location="http://example.com/stockquote"/>
137
+ <soap:address location="http://example.com%2Fstockquote"/>
138
138
  </port>
139
139
  </service>
140
140
 
@@ -1,10 +1,10 @@
1
1
  <?xml version="1.0"?>
2
2
  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
3
- <soap:Body>
4
- <soap:Fault>
5
- <soap:faultcode>soap:Sender</soap:faultcode>
6
- <soap:faultstring>Omg! stock market has crashed!</soap:faultstring>
7
- <soap:detail><Foo>Some detail</Foo></soap:detail>
8
- </soap:Fault>
9
- </soap:Body>
3
+ <soap:Body>
4
+ <soap:Fault>
5
+ <faultcode>soap:Sender</faultcode>
6
+ <faultstring>Omg! stock market has crashed!</faultstring>
7
+ <detail><Foo>Some detail</Foo></detail>
8
+ </soap:Fault>
9
+ </soap:Body>
10
10
  </soap:Envelope>
@@ -37,9 +37,9 @@ module LolSoap
37
37
  end
38
38
  end
39
39
 
40
- it 'should raise a FaultRaised error when initialized, if there is a SOAP fault' do
41
- lambda { Response.new(request, Nokogiri::XML(File.read(TEST_ROOT + '/fixtures/stock_quote_fault.xml'))) }.
42
- must_raise FaultRaised
40
+ it 'should return the soap fault' do
41
+ response = Response.new(request, Nokogiri::XML(File.read(TEST_ROOT + '/fixtures/stock_quote_fault.xml')))
42
+ response.fault.wont_equal nil
43
43
  end
44
44
  end
45
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolsoap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.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-06-27 00:00:00.000000000 Z
12
+ date: 2013-08-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -113,7 +113,6 @@ files:
113
113
  - lib/lolsoap/builder.rb
114
114
  - lib/lolsoap/client.rb
115
115
  - lib/lolsoap/envelope.rb
116
- - lib/lolsoap/errors.rb
117
116
  - lib/lolsoap/fault.rb
118
117
  - lib/lolsoap/hash_builder.rb
119
118
  - lib/lolsoap/request.rb
@@ -164,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
163
  version: '0'
165
164
  segments:
166
165
  - 0
167
- hash: 765502511
166
+ hash: 2957288385863743172
168
167
  required_rubygems_version: !ruby/object:Gem::Requirement
169
168
  none: false
170
169
  requirements:
@@ -1,15 +0,0 @@
1
- module LolSoap
2
- class Error < StandardError; end
3
-
4
- class FaultRaised < Error
5
- attr_reader :fault
6
-
7
- def initialize(fault)
8
- @fault = fault
9
- end
10
-
11
- def message
12
- "#{fault.reason}\n#{fault.detail}"
13
- end
14
- end
15
- end