savon 0.7.5 → 0.7.6

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.
Files changed (62) hide show
  1. data/CHANGELOG +11 -0
  2. data/README.rdoc +5 -3
  3. data/Rakefile +2 -0
  4. data/lib/savon.rb +1 -0
  5. data/lib/savon/client.rb +54 -13
  6. data/lib/savon/core_ext.rb +0 -0
  7. data/lib/savon/core_ext/array.rb +20 -6
  8. data/lib/savon/core_ext/datetime.rb +0 -0
  9. data/lib/savon/core_ext/hash.rb +36 -15
  10. data/lib/savon/core_ext/net_http.rb +1 -2
  11. data/lib/savon/core_ext/object.rb +1 -3
  12. data/lib/savon/core_ext/string.rb +9 -2
  13. data/lib/savon/core_ext/symbol.rb +0 -0
  14. data/lib/savon/core_ext/uri.rb +1 -1
  15. data/lib/savon/logger.rb +56 -0
  16. data/lib/savon/request.rb +42 -50
  17. data/lib/savon/response.rb +62 -9
  18. data/lib/savon/soap.rb +157 -42
  19. data/lib/savon/wsdl.rb +71 -6
  20. data/lib/savon/wsdl_stream.rb +2 -2
  21. data/lib/savon/wsse.rb +36 -5
  22. data/spec/basic_spec_helper.rb +0 -0
  23. data/spec/endpoint_helper.rb +0 -0
  24. data/spec/fixtures/response/response_fixture.rb +0 -0
  25. data/spec/fixtures/response/xml/authentication.xml +0 -0
  26. data/spec/fixtures/response/xml/multi_ref.xml +0 -0
  27. data/spec/fixtures/response/xml/soap_fault.xml +0 -0
  28. data/spec/fixtures/response/xml/soap_fault12.xml +0 -0
  29. data/spec/fixtures/wsdl/wsdl_fixture.rb +0 -0
  30. data/spec/fixtures/wsdl/xml/authentication.xml +0 -0
  31. data/spec/fixtures/wsdl/xml/geotrust.xml +0 -0
  32. data/spec/fixtures/wsdl/xml/namespaced_actions.xml +0 -0
  33. data/spec/fixtures/wsdl/xml/no_namespace.xml +0 -0
  34. data/spec/http_stubs.rb +0 -0
  35. data/spec/integration/http_basic_auth_spec.rb +0 -0
  36. data/spec/integration/server.rb +0 -0
  37. data/spec/savon/client_spec.rb +5 -1
  38. data/spec/savon/core_ext/array_spec.rb +0 -0
  39. data/spec/savon/core_ext/datetime_spec.rb +0 -0
  40. data/spec/savon/core_ext/hash_spec.rb +10 -1
  41. data/spec/savon/core_ext/net_http_spec.rb +0 -0
  42. data/spec/savon/core_ext/object_spec.rb +0 -0
  43. data/spec/savon/core_ext/string_spec.rb +6 -2
  44. data/spec/savon/core_ext/symbol_spec.rb +0 -0
  45. data/spec/savon/core_ext/uri_spec.rb +4 -0
  46. data/spec/savon/request_spec.rb +5 -4
  47. data/spec/savon/response_spec.rb +0 -0
  48. data/spec/savon/soap_spec.rb +124 -130
  49. data/spec/savon/wsdl_spec.rb +0 -0
  50. data/spec/savon/wsse_spec.rb +0 -0
  51. data/spec/spec_helper.rb +0 -0
  52. metadata +55 -37
  53. data/readme/client.rdoc +0 -18
  54. data/readme/errors.rdoc +0 -11
  55. data/readme/logging.rdoc +0 -11
  56. data/readme/participate.rdoc +0 -21
  57. data/readme/request.rdoc +0 -37
  58. data/readme/response.rdoc +0 -46
  59. data/readme/soap.rdoc +0 -71
  60. data/readme/value_mapping.rdoc +0 -49
  61. data/readme/wsdl.rdoc +0 -39
  62. data/readme/wsse.rdoc +0 -28
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: savon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 7
8
+ - 6
9
+ version: 0.7.6
5
10
  platform: ruby
6
11
  authors:
7
12
  - Daniel Harrington
@@ -9,59 +14,79 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-19 00:00:00 +01:00
17
+ date: 2010-03-21 00:00:00 +01:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: builder
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 1
30
+ - 2
23
31
  version: 2.1.2
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: crack
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 1
44
+ - 4
33
45
  version: 0.1.4
34
- version:
46
+ type: :runtime
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: rspec
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ">="
42
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 1
57
+ - 2
58
+ - 8
43
59
  version: 1.2.8
44
- version:
60
+ type: :development
61
+ version_requirements: *id003
45
62
  - !ruby/object:Gem::Dependency
46
63
  name: mocha
47
- type: :development
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  requirements:
51
67
  - - ">="
52
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
71
+ - 9
72
+ - 7
53
73
  version: 0.9.7
54
- version:
74
+ type: :development
75
+ version_requirements: *id004
55
76
  - !ruby/object:Gem::Dependency
56
77
  name: fakeweb
57
- type: :development
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
60
80
  requirements:
61
81
  - - ">="
62
82
  - !ruby/object:Gem::Version
83
+ segments:
84
+ - 1
85
+ - 2
86
+ - 7
63
87
  version: 1.2.7
64
- version:
88
+ type: :development
89
+ version_requirements: *id005
65
90
  description:
66
91
  email: me@rubiii.com
67
92
  executables: []
@@ -84,6 +109,7 @@ files:
84
109
  - lib/savon/core_ext/symbol.rb
85
110
  - lib/savon/core_ext/uri.rb
86
111
  - lib/savon/core_ext.rb
112
+ - lib/savon/logger.rb
87
113
  - lib/savon/request.rb
88
114
  - lib/savon/response.rb
89
115
  - lib/savon/soap.rb
@@ -121,16 +147,6 @@ files:
121
147
  - spec/fixtures/wsdl/xml/geotrust.xml
122
148
  - spec/fixtures/wsdl/xml/namespaced_actions.xml
123
149
  - spec/fixtures/wsdl/xml/no_namespace.xml
124
- - readme/client.rdoc
125
- - readme/errors.rdoc
126
- - readme/logging.rdoc
127
- - readme/participate.rdoc
128
- - readme/request.rdoc
129
- - readme/response.rdoc
130
- - readme/soap.rdoc
131
- - readme/value_mapping.rdoc
132
- - readme/wsdl.rdoc
133
- - readme/wsse.rdoc
134
150
  has_rdoc: true
135
151
  homepage: http://github.com/rubiii/savon
136
152
  licenses: []
@@ -138,28 +154,30 @@ licenses: []
138
154
  post_install_message:
139
155
  rdoc_options:
140
156
  - --charset=UTF-8
141
- - --title
142
- - Savon
143
157
  - --line-numbers
144
158
  - --inline-source
159
+ - --title
160
+ - Savon - Heavy metal Ruby SOAP client library
145
161
  require_paths:
146
162
  - lib
147
163
  required_ruby_version: !ruby/object:Gem::Requirement
148
164
  requirements:
149
165
  - - ">="
150
166
  - !ruby/object:Gem::Version
167
+ segments:
168
+ - 0
151
169
  version: "0"
152
- version:
153
170
  required_rubygems_version: !ruby/object:Gem::Requirement
154
171
  requirements:
155
172
  - - ">="
156
173
  - !ruby/object:Gem::Version
174
+ segments:
175
+ - 0
157
176
  version: "0"
158
- version:
159
177
  requirements: []
160
178
 
161
179
  rubyforge_project:
162
- rubygems_version: 1.3.5
180
+ rubygems_version: 1.3.6
163
181
  signing_key:
164
182
  specification_version: 3
165
183
  summary: Heavy metal Ruby SOAP client library
@@ -1,18 +0,0 @@
1
- Savon::Client is the main object to connect to a SOAP service. It includes methods to access both Savon::WSDL and Savon::Request objects.
2
-
3
- == Instantiate Savon::Client
4
-
5
- Depending on whether you aim to use Savon with or without Savon::WSDL, you need to instantiate Savon::Client by passing in the WSDL or SOAP endpoint.
6
-
7
- # Client instance with a WSDL endpoint
8
- client = Savon::Client.new "http://example.com/UserService?wsdl"
9
-
10
- # Client instance with a SOAP endpoint (for using Savon without a WSDL)
11
- client = Savon::Client.new "http://example.com/UserService"
12
-
13
- == Using a proxy server
14
-
15
- You can specify the URI to a proxy server via optional Hash arguments.
16
-
17
- client = Savon::Client.new "http://example.com/UserService?wsdl",
18
- :proxy => "http://proxy.example.com"
@@ -1,11 +0,0 @@
1
- == HTTP errors
2
-
3
- In case of an HTTP error, a Savon::HTTPError will be raised. Any HTTP response code >= 300 raises this error. The only exception to this rule is when the server also returns a SOAP fault. In this case, a Savon::SOAPFault is raised.
4
-
5
- == SOAP faults
6
-
7
- A Savon::SOAPFault is raised in case the server returned a SOAP fault.
8
-
9
- == Rails tip
10
-
11
- In case you're using Savon inside a Rails application, you can use {rescue_from}[http://api.rubyonrails.org/classes/ActiveSupport/Rescuable/ClassMethods.html] to handle these errors
@@ -1,11 +0,0 @@
1
- Savon logs each request and response to STDOUT. Specifying your own logger is as easy as it gets:
2
-
3
- Savon::Request.logger = RAILS_DEFAULT_LOGGER
4
-
5
- The default log level is set to :debug. In case you need to change this:
6
-
7
- Savon::Request.log_level = :info
8
-
9
- You can also disable logging if you need to:
10
-
11
- Savon::Request.log = false
@@ -1,21 +0,0 @@
1
- == Provide feedback
2
-
3
- Let me know about your experiences using Savon. What's good, what's not? {Open an issue}[http://github.com/rubiii/savon/issues] if you encounter a bug. Feedback is always appreciated.
4
-
5
- == Spread the word
6
-
7
- Let others know about Savon by talking, tweeting or blogging about it. The more people use Savon, the more stable it becomes.
8
-
9
- == Fix bugs or implement features
10
-
11
- You're welcome to fork the project to fix bugs, implement features, etc. But please make sure to follow "the rules":
12
-
13
- * Follow the coding and naming conventions of the code
14
- * Do not edit the CHANGELOG and .gemspec files
15
- * Test all the fucking time!
16
-
17
- Also, if you're thinking about adding some big new feature or if you're not sure about how to implement it, please just get in touch.
18
-
19
- Please note that Savon {does not require Rubygems}[http://gist.github.com/54177]. So make sure your environment is set up to load the package manager of your choice. In order to run autospec, you could use the following alias:
20
-
21
- alias autospec='RUBYLIB=./lib RUBYOPT=-rubygems AUTOFEATURE=true autospec'
@@ -1,37 +0,0 @@
1
- Savon::Request handles both WSDL and SOAP requests.
2
-
3
- == The Net::HTTP object
4
-
5
- You can access the Net::HTTP object used for both WSDL and SOAP requests via:
6
-
7
- client.request.http
8
-
9
- Here's an example of how to set open and read timeouts on the Net::HTTP object.
10
-
11
- client.request.http.open_timeout = 30
12
- client.request.http.read_timeout = 30
13
-
14
- Please refer to the {official documentation}[http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html] for more information.
15
-
16
- == HTTP basic authentication
17
-
18
- Setting credentials for HTTP basic authentication:
19
-
20
- client.request.basic_auth "username", "password"
21
-
22
- == SSL client authentication
23
-
24
- You can use the methods provided by Net::HTTP to set SSL client authentication or use this shortcut:
25
-
26
- client.request.http.ssl_client_auth(
27
- :cert => OpenSSL::X509::Certificate.new(File.read("client_cert.pem")),
28
- :key => OpenSSL::PKey::RSA.new(File.read("client_key.pem"), "password if one exists"),
29
- :ca_file => "cacert.pem",
30
- :verify_mode => OpenSSL::SSL::VERIFY_PEER
31
- )
32
-
33
- == HTTP headers
34
-
35
- There's an accessor for the Hash of HTTP headers sent with any SOAP call:
36
-
37
- client.request.headers["custom"] = "header"
@@ -1,46 +0,0 @@
1
- The response is wrapped in an object to give you various options of handling it.
2
-
3
- == SOAP fault
4
-
5
- Assuming the default behavior of raising errors is disabled, you can ask the response object if there was a SOAP fault or an HTTP error and get the SOAP fault or HTTP error message.
6
-
7
- response.soap_fault?
8
- => true
9
-
10
- response.soap_fault
11
- => "(soap:Server) Fault occurred while processing."
12
-
13
- response.http_error?
14
- => true
15
-
16
- response.http_error
17
- => "Not found (404)"
18
-
19
- == Response as XML
20
-
21
- To get the raw SOAP response XML, you can call to_xml or to_s on the response object.
22
-
23
- response.to_xml
24
- => "<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
25
- => "..."
26
- => "</soap:Envelope>"
27
-
28
- == Response as a Hash
29
-
30
- You can also let Savon translate the SOAP response body to a Hash.
31
-
32
- response.to_hash
33
- => { :findUserByIdResponse => {
34
- => :id => "666",
35
- => :username => "thedude"
36
- => :firstname => "The",
37
- => :lastname => "Dude",
38
- => :active => true
39
- => }
40
-
41
- == Net::HTTP response
42
-
43
- If for reason you need to access the Net::HTTP response object ... you can.
44
-
45
- bc. response.http
46
- => #<Net::HTTPOK:0x7f749a1aa4a8>
@@ -1,71 +0,0 @@
1
- Savon::SOAP represents the SOAP request. Pass a block to your SOAP call and the SOAP object is passed to it as the first argument. The object allows setting the SOAP version, header, body and namespaces per request.
2
-
3
- == Body
4
-
5
- The body method lets you specify parameters to be received by the SOAP action. The value is expected to be a Hash (which will be translated to XML via Hash.to_soap_xml) or an XML String.
6
-
7
- response = client.get_user_by_id do |soap|
8
- soap.body = { :id => 666 }
9
- end
10
-
11
- response = client.get_user_by_id do |soap|
12
- soap.body = "<id>666</id>"
13
- end
14
-
15
- In case your service requires the elements to be in a specific order, you have two options. The first is to specify your body as an XML String. The second is to add an ":order!" key containing an Array of elements in the specific order to your Hash. Here's an example:
16
-
17
- response = client.add_user do |soap|
18
- soap.body = { :user => { :name => "Lucy", :id => 666, :order! => [:id, :name] } }
19
- end
20
-
21
- == Version
22
-
23
- Savon defaults to SOAP 1.1. In case your service uses SOAP 1.2, you can use the version method to change the default.
24
-
25
- response = client.get_all_users do |soap|
26
- soap.version = 2
27
- end
28
-
29
- You can also change the default to SOAP 1.2 for all request:
30
-
31
- Savon::SOAP.version = 2
32
-
33
- == Header
34
-
35
- If you need to add custom XML into the SOAP header, you can use the header method. The value is expected to be a Hash (which will be translated to XML via Hash.to_soap_xml) or an XML String.
36
-
37
- response = client.get_all_users do |soap|
38
- soap.header["specialApiKey"] = "secret"
39
- end
40
-
41
- response = client.get_all_users do |soap|
42
- soap.header = "<specialApiKey>secret</specialApiKey>"
43
- end
44
-
45
- == Namespaces
46
-
47
- The namespaces method contains a Hash of namespaces for the SOAP envelope.
48
-
49
- response = client.get_all_users do |soap|
50
- soap.namespaces["xmlns:whatever"] = "http://example.com"
51
- end
52
-
53
- == Input
54
-
55
- You can change the name of the SOAP input node in case you need to.
56
-
57
- response = client.get_all_users do |soap|
58
- soap.input = "GetAllUsersRequest"
59
- end
60
-
61
- The request is going to look something like this:
62
-
63
- => <env:Envelope
64
- => xmlns:wsdl="http://example.com/user/1.0/UserService"
65
- => xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
66
- => <env:Header></env:Header>
67
- => <env:Body>
68
- => <wsdl:GetAllUsersRequest></wsdl:GetAllUsersRequest>
69
- => </env:Body>
70
- => </env:Envelope>
71
-
@@ -1,49 +0,0 @@
1
- Of course both SOAP request and response are pure XML. Even though (assuming your XML applies to some defaults), Savon lets you specify the SOAP header and body as a Hash as well as returning the [[Response]] as a Hash.
2
-
3
- == SOAP header and body
4
-
5
- Some Hash keys and values passed to [[SOAP]] header and body are converted to SOAP compatible values automatically.
6
-
7
- * Hash keys specified as Symbols are converted to lowerCamelCase Strings
8
- * Hash keys specified as Strings are not converted and may contain namespaces
9
- * DateTime Hash values are converted to xs:dateTime Strings
10
- * Objects respond to to_datetime (except Strings) are converted to xs:dateTime Strings
11
- * TrueClass and FalseClass objects are converted to "true" and "false"
12
- * All other objects are expected to be converted to Strings using to_s
13
-
14
- Example:
15
-
16
- date = DateTime.new 2010, 11, 22, 11, 22, 33
17
- response = client.user_magic do |soap|
18
- soap.body = {
19
- :magic_request => {
20
- :perform_move => true,
21
- "perform_at" => date
22
- }
23
- }
24
- end
25
-
26
- Request:
27
-
28
- <env:Envelope
29
- xmlns:wsdl="http://ws.user.example.com"
30
- xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
31
- <env:Header></env:Header>
32
- <env:Body>
33
- <wsdl:userMagic>
34
- <magicRequest>
35
- <performMove>true</performMove>
36
- <perform_at>2012-06-11T10:42:21</perform_at>
37
- </magicRequest>
38
- </wsdl:userMagic>
39
- </env:Body>
40
- </env:Envelope>
41
-
42
- == SOAP response as a Hash
43
-
44
- When translating the SOAP response to a Hash, some XML nodes and values are converted to more convenient Ruby objects. Translation is done using John Nunemaker's {Crack}[http://github.com/jnunemaker/crack] library. Afterward, Savon does some extra mapping.
45
-
46
- * Hash keys get converted to snake_case Symbols and namespaces are stripped off
47
- * SOAP nil values are converted to nil
48
- * Hash values specified in xs:DateTime format are converted to DateTime objects
49
- * Hash values of "true" and "false" are converted to TrueClass and FalseClass