sekken 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.travis.yml +11 -0
  4. data/.yardopts +6 -0
  5. data/CONTRIBUTING.md +46 -0
  6. data/Gemfile +27 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +28 -0
  9. data/Rakefile +21 -0
  10. data/donate.png +0 -0
  11. data/lib/sekken.rb +75 -0
  12. data/lib/sekken/envelope.rb +92 -0
  13. data/lib/sekken/errors.rb +9 -0
  14. data/lib/sekken/example_message.rb +41 -0
  15. data/lib/sekken/httpclient.rb +35 -0
  16. data/lib/sekken/importer.rb +77 -0
  17. data/lib/sekken/message.rb +135 -0
  18. data/lib/sekken/operation.rb +100 -0
  19. data/lib/sekken/resolver.rb +20 -0
  20. data/lib/sekken/response.rb +50 -0
  21. data/lib/sekken/version.rb +5 -0
  22. data/lib/sekken/wsdl.rb +86 -0
  23. data/lib/sekken/wsdl/binding.rb +64 -0
  24. data/lib/sekken/wsdl/binding_operation.rb +85 -0
  25. data/lib/sekken/wsdl/document.rb +83 -0
  26. data/lib/sekken/wsdl/document_collection.rb +61 -0
  27. data/lib/sekken/wsdl/input_output.rb +84 -0
  28. data/lib/sekken/wsdl/message.rb +38 -0
  29. data/lib/sekken/wsdl/operation.rb +47 -0
  30. data/lib/sekken/wsdl/port.rb +29 -0
  31. data/lib/sekken/wsdl/port_type.rb +38 -0
  32. data/lib/sekken/wsdl/port_type_operation.rb +42 -0
  33. data/lib/sekken/wsdl/service.rb +55 -0
  34. data/lib/sekken/xml/attribute.rb +13 -0
  35. data/lib/sekken/xml/element.rb +82 -0
  36. data/lib/sekken/xml/element_builder.rb +220 -0
  37. data/lib/sekken/xs/schema.rb +57 -0
  38. data/lib/sekken/xs/schema_collection.rb +49 -0
  39. data/lib/sekken/xs/types.rb +272 -0
  40. data/sekken.gemspec +42 -0
  41. data/spec/fixtures/response/another_soap_fault.xml +14 -0
  42. data/spec/fixtures/response/authentication.xml +14 -0
  43. data/spec/fixtures/response/header.xml +13 -0
  44. data/spec/fixtures/response/list.xml +18 -0
  45. data/spec/fixtures/response/multi_ref.xml +39 -0
  46. data/spec/fixtures/response/soap_fault.xml +8 -0
  47. data/spec/fixtures/response/soap_fault12.xml +18 -0
  48. data/spec/fixtures/response/taxcloud.xml +1 -0
  49. data/spec/fixtures/wsdl/amazon.wsdl +1920 -0
  50. data/spec/fixtures/wsdl/arrays_with_attributes.wsdl +117 -0
  51. data/spec/fixtures/wsdl/authentication.wsdl +63 -0
  52. data/spec/fixtures/wsdl/awse.wsdl +1510 -0
  53. data/spec/fixtures/wsdl/betfair.wsdl +2981 -0
  54. data/spec/fixtures/wsdl/blz_service.wsdl +88 -0
  55. data/spec/fixtures/wsdl/bookt/bookt.wsdl +11 -0
  56. data/spec/fixtures/wsdl/bookt/bookt0.xsd +433 -0
  57. data/spec/fixtures/wsdl/bookt/bookt1.xsd +42 -0
  58. data/spec/fixtures/wsdl/bookt/bookt10.xsd +38 -0
  59. data/spec/fixtures/wsdl/bookt/bookt11.xsd +17 -0
  60. data/spec/fixtures/wsdl/bookt/bookt12.xsd +18 -0
  61. data/spec/fixtures/wsdl/bookt/bookt13.xsd +22 -0
  62. data/spec/fixtures/wsdl/bookt/bookt14.xsd +27 -0
  63. data/spec/fixtures/wsdl/bookt/bookt15.xsd +28 -0
  64. data/spec/fixtures/wsdl/bookt/bookt2.wsdl +243 -0
  65. data/spec/fixtures/wsdl/bookt/bookt2.xsd +81 -0
  66. data/spec/fixtures/wsdl/bookt/bookt3.wsdl +286 -0
  67. data/spec/fixtures/wsdl/bookt/bookt3.xsd +61 -0
  68. data/spec/fixtures/wsdl/bookt/bookt4.xsd +35 -0
  69. data/spec/fixtures/wsdl/bookt/bookt5.xsd +22 -0
  70. data/spec/fixtures/wsdl/bookt/bookt6.xsd +26 -0
  71. data/spec/fixtures/wsdl/bookt/bookt7.xsd +18 -0
  72. data/spec/fixtures/wsdl/bookt/bookt8.xsd +22 -0
  73. data/spec/fixtures/wsdl/bookt/bookt9.xsd +29 -0
  74. data/spec/fixtures/wsdl/bronto.wsdl +3285 -0
  75. data/spec/fixtures/wsdl/bydexchange/bydexchange.wsdl +104 -0
  76. data/spec/fixtures/wsdl/bydexchange/bydexchange0.xsd +1 -0
  77. data/spec/fixtures/wsdl/bydexchange/bydexchange1.xsd +1 -0
  78. data/spec/fixtures/wsdl/bydexchange/bydexchange2.wsdl +119 -0
  79. data/spec/fixtures/wsdl/bydexchange/bydexchange2.xsd +1 -0
  80. data/spec/fixtures/wsdl/bydexchange/bydexchange3.xsd +1 -0
  81. data/spec/fixtures/wsdl/bydexchange/bydexchange4.xsd +1 -0
  82. data/spec/fixtures/wsdl/bydexchange/bydexchange5.xsd +1 -0
  83. data/spec/fixtures/wsdl/bydexchange/bydexchange6.xsd +1 -0
  84. data/spec/fixtures/wsdl/bydexchange/bydexchange7.xsd +1 -0
  85. data/spec/fixtures/wsdl/bydexchange/bydexchange8.xsd +1 -0
  86. data/spec/fixtures/wsdl/crowd.wsdl +2437 -0
  87. data/spec/fixtures/wsdl/data_exchange.wsdl +98 -0
  88. data/spec/fixtures/wsdl/document_literal_wrapped.wsdl +153 -0
  89. data/spec/fixtures/wsdl/economic.wsdl +65660 -0
  90. data/spec/fixtures/wsdl/edialog.wsdl +13148 -0
  91. data/spec/fixtures/wsdl/email_verification.wsdl +394 -0
  92. data/spec/fixtures/wsdl/equifax.wsdl +794 -0
  93. data/spec/fixtures/wsdl/geotrust.wsdl +156 -0
  94. data/spec/fixtures/wsdl/interhome.wsdl +2137 -0
  95. data/spec/fixtures/wsdl/iws.wsdl +695 -0
  96. data/spec/fixtures/wsdl/jetairways.wsdl +156 -0
  97. data/spec/fixtures/wsdl/jira.wsdl +3890 -0
  98. data/spec/fixtures/wsdl/juniper.wsdl +215 -0
  99. data/spec/fixtures/wsdl/namespaced_actions.wsdl +307 -0
  100. data/spec/fixtures/wsdl/oracle.wsdl +3629 -0
  101. data/spec/fixtures/wsdl/ratp.wsdl +955 -0
  102. data/spec/fixtures/wsdl/rio2/rio2.wsdl +74 -0
  103. data/spec/fixtures/wsdl/rio2/rio2_0.wsdl +55 -0
  104. data/spec/fixtures/wsdl/rio2/rio2_0.xsd +58 -0
  105. data/spec/fixtures/wsdl/rio2/rio2_1.xsd +41 -0
  106. data/spec/fixtures/wsdl/rio2/rio2_2.xsd +222 -0
  107. data/spec/fixtures/wsdl/rio2/rio2_3.xsd +10 -0
  108. data/spec/fixtures/wsdl/rpc_literal.wsdl +105 -0
  109. data/spec/fixtures/wsdl/spyne.wsdl +70 -0
  110. data/spec/fixtures/wsdl/stockquote.wsdl +124 -0
  111. data/spec/fixtures/wsdl/taxcloud.wsdl +934 -0
  112. data/spec/fixtures/wsdl/team_software/team_software.wsdl +542 -0
  113. data/spec/fixtures/wsdl/team_software/team_software0.xsd +448 -0
  114. data/spec/fixtures/wsdl/team_software/team_software1.xsd +41 -0
  115. data/spec/fixtures/wsdl/team_software/team_software2.xsd +258 -0
  116. data/spec/fixtures/wsdl/team_software/team_software3.xsd +14 -0
  117. data/spec/fixtures/wsdl/telefonkatalogen.wsdl +45 -0
  118. data/spec/fixtures/wsdl/temperature.wsdl +136 -0
  119. data/spec/fixtures/wsdl/wasmuth/wasmuth.wsdl +157 -0
  120. data/spec/fixtures/wsdl/wasmuth/wasmuth1.xsd +210 -0
  121. data/spec/fixtures/wsdl/wasmuth/wasmuth2.xsd +549 -0
  122. data/spec/fixtures/wsdl/xignite.wsdl +3470 -0
  123. data/spec/fixtures/wsdl/yahoo.wsdl +2425 -0
  124. data/spec/fixtures/wsdl/zanox_export_service.xml +520 -0
  125. data/spec/integration/amazon_spec.rb +51 -0
  126. data/spec/integration/authentication_spec.rb +38 -0
  127. data/spec/integration/awse_spec.rb +95 -0
  128. data/spec/integration/betfair_spec.rb +179 -0
  129. data/spec/integration/blz_service_spec.rb +46 -0
  130. data/spec/integration/bookt_spec.rb +59 -0
  131. data/spec/integration/bronto_spec.rb +178 -0
  132. data/spec/integration/bydexchange_spec.rb +40 -0
  133. data/spec/integration/crowd_spec.rb +44 -0
  134. data/spec/integration/data_exchange_spec.rb +27 -0
  135. data/spec/integration/document_literal_spec.rb +104 -0
  136. data/spec/integration/economic_spec.rb +64 -0
  137. data/spec/integration/email_verification_spec.rb +82 -0
  138. data/spec/integration/equifax_spec.rb +216 -0
  139. data/spec/integration/geotrust_spec.rb +17 -0
  140. data/spec/integration/interhome_spec.rb +156 -0
  141. data/spec/integration/iws_spec.rb +27 -0
  142. data/spec/integration/jetairways_spec.rb +142 -0
  143. data/spec/integration/jira_spec.rb +27 -0
  144. data/spec/integration/juniper_spec.rb +20 -0
  145. data/spec/integration/namespaced_actions_spec.rb +37 -0
  146. data/spec/integration/oracle_spec.rb +61 -0
  147. data/spec/integration/ratp_spec.rb +178 -0
  148. data/spec/integration/rio2_spec.rb +56 -0
  149. data/spec/integration/rpc_literal_spec.rb +101 -0
  150. data/spec/integration/spyne_spec.rb +60 -0
  151. data/spec/integration/stockquote_spec.rb +46 -0
  152. data/spec/integration/taxcloud_spec.rb +45 -0
  153. data/spec/integration/team_software_spec.rb +51 -0
  154. data/spec/integration/telefonkatalogen_spec.rb +42 -0
  155. data/spec/integration/temperature_spec.rb +71 -0
  156. data/spec/integration/wasmuth_spec.rb +47 -0
  157. data/spec/integration/xignite_spec.rb +112 -0
  158. data/spec/integration/yahoo_spec.rb +116 -0
  159. data/spec/sekken/httpclient_spec.rb +41 -0
  160. data/spec/sekken/operation/build_spec.rb +308 -0
  161. data/spec/sekken/operation/document_literal_spec.rb +53 -0
  162. data/spec/sekken/operation/example_body_spec.rb +95 -0
  163. data/spec/sekken/operation/rpc_literal_spec.rb +50 -0
  164. data/spec/sekken/operation_spec.rb +169 -0
  165. data/spec/sekken/resolver_spec.rb +38 -0
  166. data/spec/sekken/response_spec.rb +17 -0
  167. data/spec/sekken/wsdl/document_spec.rb +191 -0
  168. data/spec/sekken/wsdl_spec.rb +46 -0
  169. data/spec/sekken/xs/complex_type_spec.rb +197 -0
  170. data/spec/sekken/xs/element_spec.rb +82 -0
  171. data/spec/sekken/xs/simple_type_spec.rb +39 -0
  172. data/spec/sekken_spec.rb +128 -0
  173. data/spec/spec_helper.rb +37 -0
  174. data/spec/support/fixture.rb +19 -0
  175. data/spec/support/http_mock.rb +43 -0
  176. metadata +344 -0
@@ -0,0 +1,82 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with EmailVerification service' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/email_verification') }
6
+
7
+ let(:service_name) { :EmailVerNoTestEmail }
8
+ let(:port_name) { :EmailVerNoTestEmailSoap12 }
9
+
10
+ it 'returns a map of services and ports' do
11
+ expect(client.services).to eq(
12
+ 'EmailVerNoTestEmail' => {
13
+ :ports => {
14
+ 'EmailVerNoTestEmailSoap' => {
15
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap/',
16
+ :location => 'http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx'
17
+ },
18
+ 'EmailVerNoTestEmailSoap12' => {
19
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap12/',
20
+ :location => 'http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx'
21
+ }
22
+ }
23
+ }
24
+ )
25
+ end
26
+
27
+ it 'knows the operations' do
28
+ service, port = 'EmailVerNoTestEmail', 'EmailVerNoTestEmailSoap12'
29
+ operation = client.operation(service, port, 'VerifyEmail')
30
+
31
+ expect(operation.soap_action).to eq('http://ws.cdyne.com/VerifyEmail')
32
+ expect(operation.endpoint).to eq('http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx')
33
+
34
+ namespace = 'http://ws.cdyne.com/'
35
+
36
+ expect(operation.body_parts).to eq([
37
+ [['VerifyEmail'], { namespace: namespace, form: 'qualified', singular: true }],
38
+ [['VerifyEmail', 'email'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
39
+ [['VerifyEmail', 'LicenseKey'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }]
40
+ ])
41
+ end
42
+
43
+ it 'creates an example request' do
44
+ operation = client.operation(service_name, port_name, :VerifyEmail)
45
+
46
+ expect(operation.example_body).to eq(
47
+ VerifyEmail: {
48
+ email: 'string',
49
+ LicenseKey: 'string'
50
+ }
51
+ )
52
+ end
53
+
54
+ it 'builds a request' do
55
+ operation = client.operation(service_name, port_name, :VerifyEmail)
56
+
57
+ operation.body = {
58
+ VerifyEmail: {
59
+ email: 'soap@example.com',
60
+ LicenseKey: '?'
61
+ }
62
+ }
63
+
64
+ expected = Nokogiri.XML(%{
65
+ <env:Envelope
66
+ xmlns:lol0="http://ws.cdyne.com/"
67
+ xmlns:env="http://www.w3.org/2003/05/soap-envelope">
68
+ <env:Header/>
69
+ <env:Body>
70
+ <lol0:VerifyEmail>
71
+ <lol0:email>soap@example.com</lol0:email>
72
+ <lol0:LicenseKey>?</lol0:LicenseKey>
73
+ </lol0:VerifyEmail>
74
+ </env:Body>
75
+ </env:Envelope>
76
+ })
77
+
78
+ expect(Nokogiri.XML operation.build).
79
+ to be_equivalent_to(expected).respecting_element_order
80
+ end
81
+
82
+ end
@@ -0,0 +1,216 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with Equifax' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/equifax') }
6
+
7
+ let(:service_name) { :canadav2 }
8
+ let(:port_name) { :canadaHttpPortV2 }
9
+
10
+ it 'returns a map of services and ports' do
11
+ expect(client.services).to eq(
12
+ 'canadav2' => {
13
+ ports: {
14
+ 'canadaHttpPortV2' => {
15
+ type: 'http://schemas.xmlsoap.org/wsdl/soap/',
16
+ location: 'https://pilot.eidverifier.com/uru/soap/cert/canadav2'
17
+ }
18
+ }
19
+ }
20
+ )
21
+ end
22
+
23
+ it 'knows operations with attributes and attribute groups' do
24
+ operation = client.operation(service_name, port_name, 'startTransaction')
25
+
26
+ expect(operation.soap_action).to eq('')
27
+ expect(operation.endpoint).to eq('https://pilot.eidverifier.com/uru/soap/cert/canadav2')
28
+
29
+ ns1 = 'http://eid.equifax.com/soap/schema/canada/v2'
30
+
31
+ expect(operation.body_parts).to eq([
32
+ [['InitialRequest'], { namespace: ns1, form: 'qualified', singular: true }],
33
+ [['InitialRequest', 'Identity'], { namespace: ns1, form: 'qualified', singular: true }],
34
+ [['InitialRequest', 'Identity', 'Name'], { namespace: ns1, form: 'qualified', singular: true }],
35
+ [['InitialRequest', 'Identity', 'Name', 'FirstName'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
36
+ [['InitialRequest', 'Identity', 'Name', 'MiddleName'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
37
+ [['InitialRequest', 'Identity', 'Name', 'MiddleInitial'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
38
+ [['InitialRequest', 'Identity', 'Name', 'LastName'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
39
+ [['InitialRequest', 'Identity', 'Name', 'Suffix'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
40
+
41
+ [['InitialRequest', 'Identity', 'Address'], { namespace: ns1, form: 'qualified', singular: false,
42
+ attributes: {
43
+ 'timeAtAddress' => { optional: true },
44
+ 'addressType' => { optional: false }
45
+ }
46
+ }],
47
+
48
+ [['InitialRequest', 'Identity', 'Address', 'FreeFormAddress'], { namespace: ns1, form: 'qualified', singular: true }],
49
+ [['InitialRequest', 'Identity', 'Address', 'FreeFormAddress', 'AddressLine'], { namespace: ns1, form: 'qualified', singular: false, type: 'string' }],
50
+ [['InitialRequest', 'Identity', 'Address', 'HybridAddress'], { namespace: ns1, form: 'qualified', singular: true }],
51
+ [['InitialRequest', 'Identity', 'Address', 'HybridAddress', 'AddressLine'], { namespace: ns1, form: 'qualified', singular: false, type: 'string' }],
52
+ [['InitialRequest', 'Identity', 'Address', 'HybridAddress', 'City'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
53
+ [['InitialRequest', 'Identity', 'Address', 'HybridAddress', 'Province'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
54
+ [['InitialRequest', 'Identity', 'Address', 'HybridAddress', 'PostalCode'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
55
+ [['InitialRequest', 'Identity', 'SIN'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
56
+ [['InitialRequest', 'Identity', 'DateOfBirth'], { namespace: ns1, form: 'qualified', singular: true }],
57
+ [['InitialRequest', 'Identity', 'DateOfBirth', 'Day'], { namespace: ns1, form: 'qualified', singular: true, type: 'positiveInteger' }],
58
+ [['InitialRequest', 'Identity', 'DateOfBirth', 'Month'], { namespace: ns1, form: 'qualified', singular: true, type: 'positiveInteger' }],
59
+ [['InitialRequest', 'Identity', 'DateOfBirth', 'Year'], { namespace: ns1, form: 'qualified', singular: true, type: 'positiveInteger' }],
60
+
61
+ [['InitialRequest', 'Identity', 'DriversLicense'], { namespace: ns1, form: 'qualified', singular: true,
62
+ attributes: {
63
+ 'driversLicenseAddressType'=> { optional: true }
64
+ }
65
+ }],
66
+
67
+ [['InitialRequest', 'Identity', 'DriversLicense', 'Number'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
68
+ [['InitialRequest', 'Identity', 'DriversLicense', 'Province'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
69
+
70
+ [['InitialRequest', 'Identity', 'PhoneNumber'], { namespace: ns1, form: 'qualified', singular: false,
71
+ attributes: {
72
+ 'phoneType' => { optional: true }
73
+ }
74
+ }],
75
+
76
+ [['InitialRequest', 'Identity', 'PhoneNumber', 'AreaCode'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
77
+ [['InitialRequest', 'Identity', 'PhoneNumber', 'Exchange'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
78
+ [['InitialRequest', 'Identity', 'PhoneNumber', 'Number'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
79
+ [['InitialRequest', 'Identity', 'PhoneNumber', 'PhoneNumber'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
80
+ [['InitialRequest', 'Identity', 'Email'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
81
+ [['InitialRequest', 'Identity', 'IPAddress'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
82
+ [['InitialRequest', 'Identity', 'CreditCardNumber'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
83
+ [['InitialRequest', 'Identity', 'CustomerId'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
84
+ [['InitialRequest', 'ProcessingOptions'], { namespace: ns1, form: 'qualified', singular: true }],
85
+ [['InitialRequest', 'ProcessingOptions', 'Language'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }],
86
+ [['InitialRequest', 'ProcessingOptions', 'EnvironmentOverride'], { namespace: ns1, form: 'qualified', singular: true, type: 'string' }]
87
+ ])
88
+ end
89
+
90
+ it 'creates an example body with attributes' do
91
+ operation = client.operation(service_name, port_name, :startTransaction)
92
+
93
+ expect(operation.example_body).to eq(
94
+ InitialRequest: {
95
+ Identity: {
96
+ Name: {
97
+ FirstName: 'string',
98
+ MiddleName: 'string',
99
+ MiddleInitial: 'string',
100
+ LastName: 'string',
101
+ Suffix: 'string'
102
+ },
103
+ Address: [
104
+ {
105
+ FreeFormAddress: {
106
+ AddressLine: ['string']
107
+ },
108
+ HybridAddress: {
109
+ AddressLine: ['string'],
110
+ City: 'string',
111
+ Province: 'string',
112
+ PostalCode: 'string'
113
+ },
114
+
115
+ # attributes are prefixed with an underscore.
116
+ _timeAtAddress: 'nonNegativeInteger',
117
+ _addressType: 'string'
118
+ }
119
+ ],
120
+ SIN: 'string',
121
+ DateOfBirth: {
122
+ Day: 'positiveInteger',
123
+ Month: 'positiveInteger',
124
+ Year: 'positiveInteger'
125
+ },
126
+ DriversLicense: {
127
+ Number: 'string',
128
+ Province: 'string',
129
+
130
+ # another attribute
131
+ _driversLicenseAddressType: 'string'
132
+ },
133
+ PhoneNumber: [
134
+ {
135
+ AreaCode: 'string',
136
+ Exchange: 'string',
137
+ Number: 'string',
138
+ PhoneNumber: 'string',
139
+
140
+ # another attribute
141
+ _phoneType: 'string'
142
+ }
143
+ ],
144
+ Email: 'string',
145
+ IPAddress: 'string',
146
+ CreditCardNumber: 'string',
147
+ CustomerId: 'string'
148
+ },
149
+ ProcessingOptions: {
150
+ Language: 'string',
151
+ EnvironmentOverride: 'string'
152
+ }
153
+ }
154
+ )
155
+ end
156
+
157
+ it 'creates a request with attributes' do
158
+ operation = client.operation(service_name, port_name, :startTransaction)
159
+
160
+ operation.body = {
161
+ InitialRequest: {
162
+ Identity: {
163
+ Address: [
164
+ {
165
+ FreeFormAddress: {
166
+ AddressLine: ['The original', 'Abbey Road, London']
167
+ },
168
+ HybridAddress: {
169
+ AddressLine: ['The original', 'Abbey Road'],
170
+ City: 'London',
171
+ Province: 'Camden',
172
+ PostalCode: 'NW8 9BS'
173
+ },
174
+
175
+ # attributes are prefixed with an underscore
176
+ _timeAtAddress: 3,
177
+ _addressType: 'public'
178
+ }
179
+ ]
180
+ }
181
+ }
182
+ }
183
+
184
+ expected = Nokogiri.XML('
185
+ <env:Envelope
186
+ xmlns:lol0="http://eid.equifax.com/soap/schema/canada/v2"
187
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
188
+ <env:Header>
189
+ </env:Header>
190
+ <env:Body>
191
+ <lol0:InitialRequest>
192
+ <lol0:Identity>
193
+ <lol0:Address timeAtAddress="3" addressType="public">
194
+ <lol0:FreeFormAddress>
195
+ <lol0:AddressLine>The original</lol0:AddressLine>
196
+ <lol0:AddressLine>Abbey Road, London</lol0:AddressLine>
197
+ </lol0:FreeFormAddress>
198
+ <lol0:HybridAddress>
199
+ <lol0:AddressLine>The original</lol0:AddressLine>
200
+ <lol0:AddressLine>Abbey Road</lol0:AddressLine>
201
+ <lol0:City>London</lol0:City>
202
+ <lol0:Province>Camden</lol0:Province>
203
+ <lol0:PostalCode>NW8 9BS</lol0:PostalCode>
204
+ </lol0:HybridAddress>
205
+ </lol0:Address>
206
+ </lol0:Identity>
207
+ </lol0:InitialRequest>
208
+ </env:Body>
209
+ </env:Envelope>
210
+ ')
211
+
212
+ expect(Nokogiri.XML operation.build).
213
+ to be_equivalent_to(expected).respecting_element_order
214
+ end
215
+
216
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with Geotrust' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/geotrust') }
6
+
7
+ it 'knows the operations' do
8
+ pending "this fixture is missing a message element! " \
9
+ "find out if we need to handle this case or if the fixture is incomplete." do
10
+
11
+ operation = client.operation('GetQuickApproverList')
12
+ expect(operation.name).to eq('THIS-TEST-FAILS')
13
+ expect(operation.endpoint).to eq('https://test-api.geotrust.com:443/webtrust/query.jws')
14
+ end
15
+ end
16
+
17
+ end
@@ -0,0 +1,156 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with Interhome' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/interhome') }
6
+
7
+ let(:service_name) { :WebService }
8
+ let(:port_name) { :WebServiceSoap }
9
+
10
+ it 'returns a map of services and ports' do
11
+ expect(client.services).to eq(
12
+ 'WebService' => {
13
+ :ports => {
14
+ 'WebServiceSoap' => {
15
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap/',
16
+ :location => 'https://webservices.interhome.com/quality/partnerV3/WebService.asmx'
17
+ },
18
+ 'WebServiceSoap12' => {
19
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap12/',
20
+ :location => 'https://webservices.interhome.com/quality/partnerV3/WebService.asmx'
21
+ }
22
+ }
23
+ }
24
+ )
25
+ end
26
+
27
+ it 'knows the operations' do
28
+ operation = client.operation(service_name, port_name, 'ClientBooking')
29
+
30
+ expect(operation.soap_action).to eq('http://www.interhome.com/webservice/ClientBooking')
31
+ expect(operation.endpoint).to eq('https://webservices.interhome.com/quality/partnerV3/WebService.asmx')
32
+
33
+ namespace = 'http://www.interhome.com/webservice'
34
+
35
+ expect(operation.body_parts).to eq([
36
+ [['ClientBooking'], { namespace: namespace, form: 'qualified', singular: true }],
37
+ [['ClientBooking', 'inputValue'], { namespace: namespace, form: 'qualified', singular: true }],
38
+ [['ClientBooking', 'inputValue', 'SalesOfficeCode'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
39
+ [['ClientBooking', 'inputValue', 'AccommodationCode'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
40
+
41
+ [['ClientBooking', 'inputValue', 'AdditionalServices'],
42
+ {namespace: namespace, form: 'qualified', singular: true }],
43
+ [['ClientBooking', 'inputValue', 'AdditionalServices', 'AdditionalServiceInputItem'],
44
+ {namespace: namespace, form: 'qualified', singular: false }],
45
+ [['ClientBooking', 'inputValue', 'AdditionalServices', 'AdditionalServiceInputItem', 'Code'],
46
+ {namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
47
+ [['ClientBooking', 'inputValue', 'AdditionalServices', 'AdditionalServiceInputItem', 'Count'],
48
+ {namespace: namespace, form: 'qualified', singular: true, type: 's:int' }],
49
+
50
+ [['ClientBooking', 'inputValue', 'CustomerSalutationType'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
51
+ [['ClientBooking', 'inputValue', 'CustomerName'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
52
+ [['ClientBooking', 'inputValue', 'CustomerFirstName'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
53
+ [['ClientBooking', 'inputValue', 'CustomerPhone'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
54
+ [['ClientBooking', 'inputValue', 'CustomerFax'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
55
+ [['ClientBooking', 'inputValue', 'CustomerEmail'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
56
+ [['ClientBooking', 'inputValue', 'CustomerAddressStreet'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
57
+ [['ClientBooking', 'inputValue', 'CustomerAddressAdditionalStreet'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
58
+ [['ClientBooking', 'inputValue', 'CustomerAddressZIP'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
59
+ [['ClientBooking', 'inputValue', 'CustomerAddressPlace'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
60
+ [['ClientBooking', 'inputValue', 'CustomerAddressState'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
61
+ [['ClientBooking', 'inputValue', 'CustomerAddressCountryCode'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
62
+ [['ClientBooking', 'inputValue', 'Comment'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
63
+ [['ClientBooking', 'inputValue', 'Adults'], { namespace: namespace, form: 'qualified', singular: true, type: 's:int' }],
64
+ [['ClientBooking', 'inputValue', 'Babies'], { namespace: namespace, form: 'qualified', singular: true, type: 's:int' }],
65
+ [['ClientBooking', 'inputValue', 'Children'], { namespace: namespace, form: 'qualified', singular: true, type: 's:int' }],
66
+ [['ClientBooking', 'inputValue', 'CheckIn'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
67
+ [['ClientBooking', 'inputValue', 'CheckOut'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
68
+ [['ClientBooking', 'inputValue', 'LanguageCode'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
69
+ [['ClientBooking', 'inputValue', 'CurrencyCode'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
70
+ [['ClientBooking', 'inputValue', 'RetailerCode'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
71
+ [['ClientBooking', 'inputValue', 'RetailerExtraCode'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
72
+ [['ClientBooking', 'inputValue', 'PaymentType'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
73
+ [['ClientBooking', 'inputValue', 'CreditCardType'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
74
+ [['ClientBooking', 'inputValue', 'CreditCardNumber'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
75
+ [['ClientBooking', 'inputValue', 'CreditCardCvc'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
76
+ [['ClientBooking', 'inputValue', 'CreditCardExpiry'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
77
+ [['ClientBooking', 'inputValue', 'CreditCardHolder'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
78
+ [['ClientBooking', 'inputValue', 'BankAccountNumber'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
79
+ [['ClientBooking', 'inputValue', 'BankCode'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
80
+ [['ClientBooking', 'inputValue', 'BankAccountHolder'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }]
81
+ ])
82
+ end
83
+
84
+ # implicit headers. reference: http://www.ibm.com/developerworks/library/ws-tip-headers/index.html
85
+ it 'creates an example header' do
86
+ operation = client.operation(service_name, port_name, :Availability)
87
+
88
+ expect(operation.example_header).to eq(
89
+ ServiceAuthHeader: {
90
+ Username: 'string',
91
+ Password: 'string'
92
+ }
93
+ )
94
+ end
95
+
96
+ it 'creates an example body including optional elements' do
97
+ operation = client.operation(service_name, port_name, :Availability)
98
+
99
+ expect(operation.example_body).to eq(
100
+ Availability: {
101
+
102
+ # These are optional.
103
+ inputValue: {
104
+ AccommodationCode: 'string',
105
+ CheckIn: 'string',
106
+ CheckOut: 'string'
107
+ }
108
+
109
+ }
110
+ )
111
+ end
112
+
113
+ it 'skips optional elements in the request' do
114
+ operation = client.operation(service_name, port_name, :Availability)
115
+
116
+ operation.header = {
117
+ ServiceAuthHeader: {
118
+ Username: 'test',
119
+ Password: 'secret'
120
+ }
121
+ }
122
+
123
+ operation.body = {
124
+ Availability: {
125
+ inputValue: {
126
+ # Leaving out two optional elements on purpose.
127
+ AccommodationCode: 'secret'
128
+ }
129
+ }
130
+ }
131
+
132
+ expected = Nokogiri.XML('
133
+ <env:Envelope
134
+ xmlns:lol0="http://www.interhome.com/webservice"
135
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
136
+ <env:Header>
137
+ <lol0:ServiceAuthHeader>
138
+ <lol0:Username>test</lol0:Username>
139
+ <lol0:Password>secret</lol0:Password>
140
+ </lol0:ServiceAuthHeader>
141
+ </env:Header>
142
+ <env:Body>
143
+ <lol0:Availability>
144
+ <lol0:inputValue>
145
+ <lol0:AccommodationCode>secret</lol0:AccommodationCode>
146
+ </lol0:inputValue>
147
+ </lol0:Availability>
148
+ </env:Body>
149
+ </env:Envelope>
150
+ ')
151
+
152
+ expect(Nokogiri.XML operation.build).
153
+ to be_equivalent_to(expected).respecting_element_order
154
+ end
155
+
156
+ end