savon 0.8.0.beta.4 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG.md +95 -80
  2. data/lib/savon/core_ext/hash.rb +0 -87
  3. data/lib/savon/core_ext/object.rb +0 -10
  4. data/lib/savon/core_ext/string.rb +0 -17
  5. data/lib/savon/soap/xml.rb +28 -8
  6. data/lib/savon/version.rb +1 -1
  7. data/savon.gemspec +3 -1
  8. data/spec/fixtures/response/{xml/another_soap_fault.xml → another_soap_fault.xml} +0 -0
  9. data/spec/fixtures/response/{xml/authentication.xml → authentication.xml} +0 -0
  10. data/spec/fixtures/response/{xml/list.xml → list.xml} +0 -0
  11. data/spec/fixtures/response/{xml/multi_ref.xml → multi_ref.xml} +0 -0
  12. data/spec/fixtures/response/{xml/soap_fault.xml → soap_fault.xml} +0 -0
  13. data/spec/fixtures/response/{xml/soap_fault12.xml → soap_fault12.xml} +0 -0
  14. data/spec/fixtures/wsdl/{xml/authentication.xml → authentication.xml} +0 -0
  15. data/spec/fixtures/wsdl/{xml/geotrust.xml → geotrust.xml} +0 -0
  16. data/spec/fixtures/wsdl/{xml/namespaced_actions.xml → namespaced_actions.xml} +0 -0
  17. data/spec/fixtures/wsdl/{xml/no_namespace.xml → no_namespace.xml} +0 -0
  18. data/spec/savon/client_spec.rb +8 -8
  19. data/spec/savon/core_ext/hash_spec.rb +0 -126
  20. data/spec/savon/core_ext/object_spec.rb +0 -15
  21. data/spec/savon/core_ext/string_spec.rb +0 -22
  22. data/spec/savon/http/error_spec.rb +1 -1
  23. data/spec/savon/soap/fault_spec.rb +4 -4
  24. data/spec/savon/soap/request_spec.rb +1 -1
  25. data/spec/savon/soap/response_spec.rb +6 -5
  26. data/spec/savon/soap/xml_spec.rb +33 -5
  27. data/spec/savon/wsdl/document_spec.rb +3 -3
  28. data/spec/savon/wsdl/parser_spec.rb +1 -1
  29. data/spec/savon/wsdl/request_spec.rb +1 -1
  30. data/spec/spec_helper.rb +3 -9
  31. data/spec/support/fixture.rb +37 -0
  32. metadata +56 -39
  33. data/lib/savon/core_ext/array.rb +0 -45
  34. data/lib/savon/core_ext/datetime.rb +0 -19
  35. data/lib/savon/core_ext/symbol.rb +0 -16
  36. data/spec/fixtures/gzip/gzip_response_fixture.rb +0 -7
  37. data/spec/fixtures/response/response_fixture.rb +0 -40
  38. data/spec/fixtures/wsdl/wsdl_fixture.rb +0 -43
  39. data/spec/fixtures/wsdl/wsdl_fixture.yml +0 -42
  40. data/spec/savon/core_ext/array_spec.rb +0 -49
  41. data/spec/savon/core_ext/datetime_spec.rb +0 -21
  42. data/spec/savon/core_ext/symbol_spec.rb +0 -12
@@ -1,19 +0,0 @@
1
- require "date"
2
- require "savon/soap"
3
-
4
- module Savon
5
- module CoreExt
6
- module DateTime
7
-
8
- # Returns the DateTime as an xs:dateTime formatted String.
9
- def to_soap_value
10
- strftime Savon::SOAP::DateTimeFormat
11
- end
12
-
13
- alias_method :to_soap_value!, :to_soap_value
14
-
15
- end
16
- end
17
- end
18
-
19
- DateTime.send :include, Savon::CoreExt::DateTime
@@ -1,16 +0,0 @@
1
- require "savon/core_ext/string"
2
-
3
- module Savon
4
- module CoreExt
5
- module Symbol
6
-
7
- # Returns the Symbol as a lowerCamelCase String.
8
- def to_soap_key
9
- to_s.to_soap_key.lower_camelcase
10
- end
11
-
12
- end
13
- end
14
- end
15
-
16
- Symbol.send :include, Savon::CoreExt::Symbol
@@ -1,7 +0,0 @@
1
- class GzipResponseFixture
2
-
3
- def self.message
4
- File.read(File.join(File.dirname(__FILE__), 'message.gz'))
5
- end
6
- end
7
-
@@ -1,40 +0,0 @@
1
- class ResponseFixture
2
- class << self
3
-
4
- def authentication(value = nil)
5
- @authentication ||= load_fixture :authentication
6
-
7
- case value
8
- when :to_hash then Savon::SOAP::XML.to_hash(@authentication)[:authenticate_response][:return]
9
- else @authentication
10
- end
11
- end
12
-
13
- def soap_fault
14
- @soap_fault ||= load_fixture :soap_fault
15
- end
16
-
17
- def soap_fault12
18
- @soap_fault12 ||= load_fixture :soap_fault12
19
- end
20
-
21
- def another_soap_fault
22
- @another_soap_fault ||= load_fixture :another_soap_fault
23
- end
24
-
25
- def multi_ref
26
- @multi_ref ||= load_fixture :multi_ref
27
- end
28
-
29
- def list
30
- @list ||= load_fixture :list
31
- end
32
-
33
- private
34
-
35
- def load_fixture(fixture)
36
- File.read File.dirname(__FILE__) + "/xml/#{fixture}.xml"
37
- end
38
-
39
- end
40
- end
@@ -1,43 +0,0 @@
1
- require "yaml"
2
- require "erb"
3
-
4
- class WSDLFixture
5
-
6
- # Returns a given +fixture+. Defaults to :authentication.
7
- def self.load(fixture = nil)
8
- fixture ||= :authentication
9
- method_missing fixture
10
- end
11
-
12
- # Returns a WSDL document matching a given +method+ name when called without
13
- # arguments. Otherwise returns the expected value for a given +method+ name
14
- # matching a fixture.
15
- def self.method_missing(method, *args)
16
- return wsdl(method) unless args.first
17
- expectations[method][args.first]
18
- end
19
-
20
- private
21
-
22
- @@expectations = nil
23
-
24
- # Returns a Hash of expected namespace URI's and SOAP operations loaded
25
- # from wsdl_fixture.yml.
26
- def self.expectations
27
- return @@expectations if @@expectations
28
-
29
- file = File.read File.dirname(__FILE__) + "/wsdl_fixture.yml"
30
- @@expectations = YAML.load ERB.new(file).result
31
- end
32
-
33
- @@wsdl = {}
34
-
35
- # Returns the WSDL document by a given file name.
36
- def self.wsdl(wsdl)
37
- return @@wsdl[wsdl] if @@wsdl[wsdl]
38
-
39
- file = File.read File.dirname(__FILE__) + "/xml/#{wsdl}.xml"
40
- @@wsdl[wsdl] = file
41
- end
42
-
43
- end
@@ -1,42 +0,0 @@
1
- :authentication:
2
- :namespace: "http://v1_0.ws.auth.order.example.com/"
3
- :operations:
4
- :authenticate:
5
- :action: "authenticate"
6
- :input: "authenticate"
7
-
8
- :no_namespace:
9
- :namespace: "urn:ActionWebService"
10
- :operations:
11
- :get_all_contacts:
12
- :action: "/api/api/GetAllContacts"
13
- :input: "GetAllContacts"
14
- :search_user:
15
- :action: "/api/api/SearchUser"
16
- :input: "SearchUser"
17
- :get_user_login_by_id:
18
- :action: "/api/api/GetUserLoginById"
19
- :input: "GetUserLoginById"
20
-
21
- :namespaced_actions:
22
- :namespace: "http://api.example.com/api/"
23
- :operations:
24
- :get_api_key:
25
- :input: "GetApiKey"
26
- :action: "http://api.example.com/api/User.GetApiKey"
27
- :delete_client:
28
- :input: "DeleteClient"
29
- :action: "http://api.example.com/api/Client.Delete"
30
- :get_clients:
31
- :input: "GetClients"
32
- :action: "http://api.example.com/api/User.GetClients"
33
-
34
- :geotrust:
35
- :namespace: "http://api.geotrust.com/webtrust/query"
36
- :operations:
37
- :get_quick_approver_list:
38
- :action: "GetQuickApproverList"
39
- :input: "GetQuickApproverList"
40
- :hello:
41
- :input: "hello"
42
- :action: "hello"
@@ -1,49 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Array do
4
-
5
- describe "to_soap_xml" do
6
- it "should return the XML for an Array of Hashes" do
7
- array = [{ :name => "adam" }, { :name => "eve" }]
8
- result = "<user><name>adam</name></user><user><name>eve</name></user>"
9
-
10
- array.to_soap_xml("user").should == result
11
- end
12
-
13
- it "should return the XML for an Array of different Objects" do
14
- array = [:symbol, "string", 123]
15
- result = "<value>symbol</value><value>string</value><value>123</value>"
16
-
17
- array.to_soap_xml("value").should == result
18
- end
19
-
20
- it "should default to escape special characters" do
21
- array = ["<tag />", "adam & eve"]
22
- result = "<value>&lt;tag /&gt;</value><value>adam &amp; eve</value>"
23
-
24
- array.to_soap_xml("value").should == result
25
- end
26
-
27
- it "should not escape special characters when told to" do
28
- array = ["<tag />", "adam & eve"]
29
- result = "<value><tag /></value><value>adam & eve</value>"
30
-
31
- array.to_soap_xml("value", false).should == result
32
- end
33
-
34
- it "should add attributes to a given tag" do
35
- array = ["adam", "eve"]
36
- result = '<value active="true">adam</value><value active="true">eve</value>'
37
-
38
- array.to_soap_xml("value", :escape_xml, :active => true).should == result
39
- end
40
-
41
- it "should add attributes to duplicate tags" do
42
- array = ["adam", "eve"]
43
- result = '<value id="1">adam</value><value id="2">eve</value>'
44
-
45
- array.to_soap_xml("value", :escape_xml, :id => [1, 2]).should == result
46
- end
47
- end
48
-
49
- end
@@ -1,21 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe DateTime do
4
- before do
5
- @datetime = DateTime.new 2012, 03, 22, 16, 22, 33
6
- @datetime_string = "2012-03-22T16:22:33+00:00"
7
- end
8
-
9
- describe "to_soap_value" do
10
- it "should return an xs:dateTime compliant String" do
11
- @datetime.to_soap_value.should == @datetime_string
12
- end
13
- end
14
-
15
- describe "to_soap_value!" do
16
- it "should act like :to_soap_value" do
17
- @datetime.to_soap_value.should == @datetime_string
18
- end
19
- end
20
-
21
- end
@@ -1,12 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Symbol do
4
-
5
- describe "to_soap_key" do
6
- it "converts the Symbol from snake_case to a lowerCamelCase String" do
7
- :lower_camel_case.to_soap_key.should == "lowerCamelCase"
8
- :lower_camel_case!.to_soap_key.should == "lowerCamelCase"
9
- end
10
- end
11
-
12
- end