exact4r 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/CHANGELOG +6 -1
  2. data/README +71 -3
  3. data/Rakefile +8 -7
  4. data/VERSION +1 -1
  5. data/doc/classes/EWS/Transaction/FakeResponse.html +451 -0
  6. data/doc/classes/EWS/Transaction/Request.html +61 -80
  7. data/doc/classes/EWS/Transaction/Response.html +206 -14
  8. data/doc/classes/EWS/Transaction/Validator.html +182 -0
  9. data/doc/classes/EWS/Transporter.html +269 -0
  10. data/doc/classes/REXML/Document.html +176 -0
  11. data/doc/classes/REXML/Entity.html +150 -0
  12. data/doc/classes/REXML.html +112 -0
  13. data/doc/created.rid +1 -1
  14. data/doc/files/CHANGELOG.html +156 -0
  15. data/doc/files/LICENCE.html +109 -0
  16. data/doc/files/README.html +164 -23
  17. data/doc/files/VERSION.html +107 -0
  18. data/doc/files/lib/ews/transaction/fake_response_rb.html +101 -0
  19. data/doc/files/lib/ews/transaction/mapping_rb.html +1 -1
  20. data/doc/files/lib/ews/transaction/request_rb.html +8 -1
  21. data/doc/files/lib/ews/transaction/response_rb.html +1 -1
  22. data/doc/files/lib/ews/transaction/validator_rb.html +101 -0
  23. data/doc/files/lib/ews/{transaction/transporter_rb.html → transporter_rb.html} +3 -3
  24. data/doc/files/lib/exact4r_rb.html +6 -2
  25. data/doc/fr_class_index.html +6 -1
  26. data/doc/fr_file_index.html +6 -1
  27. data/doc/fr_method_index.html +22 -7
  28. data/lib/ews/transaction/mapping.rb +41 -40
  29. data/lib/ews/transaction/request.rb +3 -4
  30. data/lib/ews/transaction/response.rb +5 -0
  31. data/lib/ews/transaction/validator.rb +44 -34
  32. data/lib/ews/transporter.rb +3 -3
  33. data/lib/exact4r.rb +1 -1
  34. data/test/exhaustive/forced_post_test.rb +75 -0
  35. data/test/exhaustive/online_debit_purchase_test.rb +66 -0
  36. data/test/exhaustive/online_debit_refund_test.rb +66 -0
  37. data/test/exhaustive/pre_auth_completion_test.rb +99 -0
  38. data/test/exhaustive/pre_auth_only_test.rb +68 -0
  39. data/test/exhaustive/pre_auth_test.rb +68 -0
  40. data/test/exhaustive/purchase_correction_test.rb +79 -0
  41. data/test/exhaustive/purchase_test.rb +68 -0
  42. data/test/exhaustive/recurring_seed_pre_auth_test.rb +68 -0
  43. data/test/exhaustive/recurring_seed_purchase_test.rb +68 -0
  44. data/test/exhaustive/refund_correction_test.rb +79 -0
  45. data/test/exhaustive/refund_test.rb +68 -0
  46. data/test/exhaustive/secure_storage_test.rb +75 -0
  47. data/test/exhaustive/tagged_online_debit_refund_test.rb +168 -0
  48. data/test/exhaustive/tagged_pre_auth_completion_test.rb +119 -0
  49. data/test/exhaustive/tagged_pre_auth_test.rb +116 -0
  50. data/test/exhaustive/tagged_purchase_test.rb +116 -0
  51. data/test/exhaustive/tagged_refund_test.rb +144 -0
  52. data/test/exhaustive/transaction_details_test.rb +86 -0
  53. data/test/exhaustive/void_test.rb +75 -0
  54. data/{spec/avs_spec.rb → test/general/avs_test.rb} +33 -44
  55. data/test/general/json_encoding_test.rb +62 -0
  56. data/test/general/request_test.rb +185 -0
  57. data/test/general/rest_encoding_test.rb +174 -0
  58. data/test/general/soap_encoding_test.rb +211 -0
  59. data/test/general/transporter_test.rb +54 -0
  60. data/test/general/validator_test.rb +150 -0
  61. data/test/samples/rest.dodgy.response.xml +60 -0
  62. data/test/samples/rest.everything.response.xml +67 -0
  63. data/test/samples/rest.response.xml +60 -0
  64. data/test/samples/soap.deserialization.fault.xml +10 -0
  65. data/test/samples/soap.dodgy.response.xml +95 -0
  66. data/test/samples/soap.everything.response.xml +75 -0
  67. data/test/samples/soap.generalfailure.fault.xml +13 -0
  68. data/test/samples/soap.nulltransaction.fault.xml +14 -0
  69. data/test/samples/soap.response.xml +95 -0
  70. data/test/test_helper.rb +115 -0
  71. metadata +52 -12
  72. data/doc/classes/EWS/Transaction/Transporter.html +0 -251
  73. data/pkg/exact4r-0.5.gem +0 -0
  74. data/spec/mapping_spec.rb +0 -126
  75. data/spec/request_spec.rb +0 -154
  76. data/spec/spec_helper.rb +0 -55
  77. data/spec/transporter_spec.rb +0 -43
  78. data/spec/validator_spec.rb +0 -150
@@ -0,0 +1,182 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: EWS::Transaction::Validator</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">EWS::Transaction::Validator</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/ews/transaction/validator_rb.html">
59
+ lib/ews/transaction/validator.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000001">valid?</a>&nbsp;&nbsp;
84
+ </div>
85
+ </div>
86
+
87
+ </div>
88
+
89
+
90
+ <!-- if includes -->
91
+
92
+ <div id="section">
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+ <!-- if method_list -->
102
+ <div id="methods">
103
+ <h3 class="section-bar">Public Instance methods</h3>
104
+
105
+ <div id="method-M000001" class="method-detail">
106
+ <a name="M000001"></a>
107
+
108
+ <div class="method-heading">
109
+ <a href="#M000001" class="method-signature">
110
+ <span class="method-name">valid?</span><span class="method-args">()</span>
111
+ </a>
112
+ </div>
113
+
114
+ <div class="method-description">
115
+ <p><a class="source-toggle" href="#"
116
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
117
+ <div class="method-source-code" id="M000001-source">
118
+ <pre>
119
+ <span class="ruby-comment cmt"># File lib/ews/transaction/validator.rb, line 30</span>
120
+ 30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid?</span>
121
+ 31: <span class="ruby-ivar">@errors</span> = {}
122
+ 32:
123
+ 33: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:transaction_type</span>, <span class="ruby-value str">&quot;transaction_type must be supplied&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">transaction_type</span>.<span class="ruby-identifier">blank?</span>
124
+ 34:
125
+ 35: <span class="ruby-comment cmt"># need to authenticate</span>
126
+ 36: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:gateway_id</span>, <span class="ruby-value str">&quot;gateway_id must be supplied&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gateway_id</span>.<span class="ruby-identifier">blank?</span>
127
+ 37: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:password</span>, <span class="ruby-value str">&quot;password must be supplied&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">password</span>.<span class="ruby-identifier">blank?</span>
128
+ 38:
129
+ 39: <span class="ruby-identifier">validate_lengths</span>
130
+ 40:
131
+ 41: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">transaction_type</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;CR&quot;</span>
132
+ 42: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:transaction_tag</span>, <span class="ruby-value str">&quot;transaction_tag must be supplied&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">transaction_tag</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span>
133
+ 43: <span class="ruby-keyword kw">elsif</span> <span class="ruby-node">%w(50 54)</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">transaction_type</span>)
134
+ 44: <span class="ruby-identifier">validate_for_pan</span>
135
+ 45: <span class="ruby-keyword kw">elsif</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">transaction_tag</span>.<span class="ruby-identifier">blank?</span>
136
+ 46: <span class="ruby-identifier">validate_for_transaction_tag</span>
137
+ 47: <span class="ruby-keyword kw">elsif</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">cc_number</span>.<span class="ruby-identifier">blank?</span>
138
+ 48: <span class="ruby-identifier">validate_for_cc_number</span>
139
+ 49: <span class="ruby-keyword kw">elsif</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">track1</span>.<span class="ruby-identifier">blank?</span>
140
+ 50: <span class="ruby-identifier">validate_for_track1</span>
141
+ 51: <span class="ruby-keyword kw">elsif</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">track2</span>.<span class="ruby-identifier">blank?</span>
142
+ 52: <span class="ruby-identifier">validate_for_track2</span>
143
+ 53: <span class="ruby-keyword kw">else</span>
144
+ 54: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:base</span>, <span class="ruby-value str">&quot;One of the following must be supplied: cc_number, track1, track2 or transaction_tag.&quot;</span>)
145
+ 55: <span class="ruby-keyword kw">end</span>
146
+ 56:
147
+ 57: <span class="ruby-comment cmt"># ensure we've been given valid amounts</span>
148
+ 58: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:amount</span>, <span class="ruby-value str">&quot;invalid amount supplied&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid_amount?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">amount</span>)
149
+ 59: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:surcharge_amount</span>, <span class="ruby-value str">&quot;invalid surcharge_amount supplied&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid_amount?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">surcharge_amount</span>)
150
+ 60: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:tax1_amount</span>, <span class="ruby-value str">&quot;invalid tax1_amount supplied&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid_amount?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tax1_amount</span>)
151
+ 61: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:tax2_amount</span>, <span class="ruby-value str">&quot;invalid tax2_amount supplied&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid_amount?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tax2_amount</span>)
152
+ 62:
153
+ 63: <span class="ruby-comment cmt"># ensure our amounts are within range</span>
154
+ 64: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:amount</span>, <span class="ruby-value str">&quot;amount must be between 0.00 and 99999.99&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">amount_in_range?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">amount</span>)
155
+ 65: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:surcharge_amount</span>, <span class="ruby-value str">&quot;amount must be between 0.00 and 99999.99&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">amount_in_range?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">surcharge_amount</span>)
156
+ 66: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:tax1_amount</span>, <span class="ruby-value str">&quot;amount must be between 0.00 and 99999.99&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">amount_in_range?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tax1_amount</span>)
157
+ 67: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:tax2_amount</span>, <span class="ruby-value str">&quot;amount must be between 0.00 and 99999.99&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">amount_in_range?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tax2_amount</span>)
158
+ 68:
159
+ 69: <span class="ruby-comment cmt"># ensure our credit card information is valid</span>
160
+ 70: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:cc_number</span>, <span class="ruby-value str">&quot;invalid cc_number supplied&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid_card_number?</span>
161
+ 71: <span class="ruby-identifier">append_error</span>(<span class="ruby-identifier">:cc_expiry</span>, <span class="ruby-value str">&quot;invalid cc_expiry supplied&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid_expiry_date?</span>
162
+ 72:
163
+ 73: <span class="ruby-ivar">@errors</span>.<span class="ruby-identifier">empty?</span>
164
+ 74: <span class="ruby-keyword kw">end</span>
165
+ </pre>
166
+ </div>
167
+ </div>
168
+ </div>
169
+
170
+
171
+ </div>
172
+
173
+
174
+ </div>
175
+
176
+
177
+ <div id="validator-badges">
178
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
179
+ </div>
180
+
181
+ </body>
182
+ </html>
@@ -0,0 +1,269 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: EWS::Transporter</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">EWS::Transporter</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/ews/transporter_rb.html">
59
+ lib/ews/transporter.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ A <a href="Transporter.html">Transporter</a> is responsible for
84
+ communicating with the E-xact Web Service in whichever dialect is chosen by
85
+ the user. The available options are:
86
+ </p>
87
+ <pre>
88
+ :json REST with JSON payload
89
+ :rest REST with XML payload (default)
90
+ :soap SOAP
91
+ </pre>
92
+ <p>
93
+ The <a href="Transporter.html">Transporter</a> will connect to the service,
94
+ using SSL if required, and will encode Reqests to send to the service, and
95
+ decode Responses received from the service.
96
+ </p>
97
+ <p>
98
+ Once configured to connect to a particular service, it can be used
99
+ repeatedly to send as many transactions as required.
100
+ </p>
101
+
102
+ </div>
103
+
104
+
105
+ </div>
106
+
107
+ <div id="method-list">
108
+ <h3 class="section-bar">Methods</h3>
109
+
110
+ <div class="name-list">
111
+ <a href="#M000018">new</a>&nbsp;&nbsp;
112
+ <a href="#M000019">submit</a>&nbsp;&nbsp;
113
+ </div>
114
+ </div>
115
+
116
+ </div>
117
+
118
+
119
+ <!-- if includes -->
120
+
121
+ <div id="section">
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+ <!-- if method_list -->
131
+ <div id="methods">
132
+ <h3 class="section-bar">Public Class methods</h3>
133
+
134
+ <div id="method-M000018" class="method-detail">
135
+ <a name="M000018"></a>
136
+
137
+ <div class="method-heading">
138
+ <a href="#M000018" class="method-signature">
139
+ <span class="method-name">new</span><span class="method-args">(url = &quot;https://api.e-xact.com&quot;, options = {})</span>
140
+ </a>
141
+ </div>
142
+
143
+ <div class="method-description">
144
+ <p>
145
+ Initialize a <a href="Transporter.html">Transporter</a>.
146
+ </p>
147
+ <p>
148
+ You can specify the URL you would like the <a
149
+ href="Transporter.html">Transporter</a> to connect to, although it defaults
150
+ to <a href="https://api.e-xact.com">api.e-xact.com</a>, the location of our
151
+ transaction processing web service.
152
+ </p>
153
+ <p>
154
+ You can also specify a hash of options as follows:
155
+ </p>
156
+ <pre>
157
+ :transport_type the transport_type for this transporter (defaults to :rest)
158
+ </pre>
159
+ <p>
160
+ The default certificates are those required to connect to <a
161
+ href="https://api.e-xact.com">api.e-xact.com</a> and the default
162
+ <tt>transport_type</tt> is <tt>:rest</tt>. The default
163
+ <tt>transport_type</tt> can be overridden on a per-transaction basis, if
164
+ you choose to do so, by specifying it as a parameter to the <tt><a
165
+ href="Transporter.html#M000019">submit</a></tt> method.
166
+ </p>
167
+ <p><a class="source-toggle" href="#"
168
+ onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
169
+ <div class="method-source-code" id="M000018-source">
170
+ <pre>
171
+ <span class="ruby-comment cmt"># File lib/ews/transporter.rb, line 30</span>
172
+ 30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">url</span> = <span class="ruby-value str">&quot;https://api.e-xact.com&quot;</span>, <span class="ruby-identifier">options</span> = {})
173
+ 31: <span class="ruby-ivar">@url</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">url</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\/$/</span>,<span class="ruby-value str">''</span>))
174
+ 32: <span class="ruby-ivar">@transport_type</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:transport_type</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:rest</span>
175
+ 33:
176
+ 34: <span class="ruby-ivar">@@issuer_cert</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>)<span class="ruby-operator">+</span><span class="ruby-value str">&quot;/../../certs/equifax_ca.cer&quot;</span>
177
+ 35: <span class="ruby-ivar">@@server_cert</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>)<span class="ruby-operator">+</span><span class="ruby-value str">&quot;/../../certs/exact.cer&quot;</span>).<span class="ruby-identifier">read</span>
178
+ 36: <span class="ruby-keyword kw">end</span>
179
+ </pre>
180
+ </div>
181
+ </div>
182
+ </div>
183
+
184
+ <h3 class="section-bar">Public Instance methods</h3>
185
+
186
+ <div id="method-M000019" class="method-detail">
187
+ <a name="M000019"></a>
188
+
189
+ <div class="method-heading">
190
+ <a href="#M000019" class="method-signature">
191
+ <span class="method-name">submit</span><span class="method-args">(transaction, transport_type = nil)</span>
192
+ </a>
193
+ </div>
194
+
195
+ <div class="method-description">
196
+ <p>
197
+ Submit a transaction request to the server
198
+ </p>
199
+ <table>
200
+ <tr><td valign="top"><tt>transaction</tt>:</td><td>the Request object to encode for transmission to the server
201
+
202
+ </td></tr>
203
+ <tr><td valign="top"><tt>transport_type</tt>:</td><td>(optional) the transport type to use for this transaction only. If it is
204
+ not specified, the <a href="Transporter.html">Transporter</a>&#8216;s
205
+ transport type will be used
206
+
207
+ </td></tr>
208
+ </table>
209
+ <p><a class="source-toggle" href="#"
210
+ onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
211
+ <div class="method-source-code" id="M000019-source">
212
+ <pre>
213
+ <span class="ruby-comment cmt"># File lib/ews/transporter.rb, line 42</span>
214
+ 42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit</span>(<span class="ruby-identifier">transaction</span>, <span class="ruby-identifier">transport_type</span> = <span class="ruby-keyword kw">nil</span>)
215
+ 43: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Request not supplied&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">transaction</span>.<span class="ruby-identifier">nil?</span>
216
+ 44: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">transaction</span>.<span class="ruby-identifier">valid?</span>
217
+ 45:
218
+ 46: <span class="ruby-identifier">transport_type</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@transport_type</span>
219
+ 47:
220
+ 48: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Transport type #{transport_type} is not supported&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@transport_types</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">transport_type</span>
221
+ 49:
222
+ 50: <span class="ruby-identifier">transport_details</span> = <span class="ruby-ivar">@@transport_types</span>[<span class="ruby-identifier">transport_type</span>]
223
+ 51:
224
+ 52: <span class="ruby-identifier">request</span> = <span class="ruby-identifier">build_http_request</span>(<span class="ruby-identifier">transaction</span>, <span class="ruby-identifier">transport_type</span>, <span class="ruby-identifier">transport_details</span>[<span class="ruby-identifier">:suffix</span>])
225
+ 53: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">basic_auth</span>(<span class="ruby-identifier">transaction</span>.<span class="ruby-identifier">gateway_id</span>, <span class="ruby-identifier">transaction</span>.<span class="ruby-identifier">password</span>)
226
+ 54: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">add_field</span> <span class="ruby-value str">&quot;Accept&quot;</span>, <span class="ruby-identifier">transport_details</span>[<span class="ruby-identifier">:content_type</span>]
227
+ 55: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">add_field</span> <span class="ruby-value str">&quot;User-Agent&quot;</span>, <span class="ruby-value str">&quot;exact4r v0.9.1&quot;</span>
228
+ 56: <span class="ruby-identifier">request</span>.<span class="ruby-identifier">add_field</span> <span class="ruby-value str">&quot;Content-type&quot;</span>, <span class="ruby-node">&quot;#{transport_details[:content_type]}; charset=UTF-8&quot;</span>
229
+ 57:
230
+ 58: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">get_connection</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">request</span>)
231
+ 59:
232
+ 60: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">response</span>
233
+ 61: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPSuccess</span> <span class="ruby-keyword kw">then</span> <span class="ruby-constant">EWS</span><span class="ruby-operator">::</span><span class="ruby-constant">Transaction</span><span class="ruby-operator">::</span><span class="ruby-constant">Mapping</span>.<span class="ruby-identifier">send</span> <span class="ruby-node">&quot;#{transport_type}_to_response&quot;</span>, <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>
234
+ 62: <span class="ruby-keyword kw">else</span>
235
+ 63: <span class="ruby-identifier">r</span> = <span class="ruby-operator">::</span><span class="ruby-constant">EWS</span><span class="ruby-operator">::</span><span class="ruby-constant">Transaction</span><span class="ruby-operator">::</span><span class="ruby-constant">Response</span>.<span class="ruby-identifier">new</span>
236
+ 64: <span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">transport_type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:soap</span>)
237
+ 65: <span class="ruby-comment cmt"># we may have a SOAP Fault</span>
238
+ 66: <span class="ruby-identifier">r</span> = <span class="ruby-constant">EWS</span><span class="ruby-operator">::</span><span class="ruby-constant">Transaction</span><span class="ruby-operator">::</span><span class="ruby-constant">Mapping</span>.<span class="ruby-identifier">send</span> <span class="ruby-node">&quot;#{transport_type}_to_response&quot;</span>, <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>
239
+ 67: <span class="ruby-keyword kw">end</span>
240
+ 68:
241
+ 69: <span class="ruby-comment cmt"># SOAP Fault may already have populated the error_number etc.</span>
242
+ 70: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">error_number</span>
243
+ 71: <span class="ruby-comment cmt"># populate the error number and description</span>
244
+ 72: <span class="ruby-identifier">r</span>.<span class="ruby-identifier">error_number</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span>.<span class="ruby-identifier">to_i</span>
245
+ 73: <span class="ruby-identifier">r</span>.<span class="ruby-identifier">error_description</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">message</span>
246
+ 74: <span class="ruby-keyword kw">end</span>
247
+ 75:
248
+ 76: <span class="ruby-identifier">r</span>
249
+ 77: <span class="ruby-keyword kw">end</span>
250
+ 78:
251
+ 79: <span class="ruby-keyword kw">end</span>
252
+ </pre>
253
+ </div>
254
+ </div>
255
+ </div>
256
+
257
+
258
+ </div>
259
+
260
+
261
+ </div>
262
+
263
+
264
+ <div id="validator-badges">
265
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
266
+ </div>
267
+
268
+ </body>
269
+ </html>
@@ -0,0 +1,176 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: REXML::Document</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">REXML::Document</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/exact4r_rb.html">
59
+ lib/exact4r.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Element
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000021">entity_expansion_limit=</a>&nbsp;&nbsp;
90
+ <a href="#M000022">record_entity_expansion!</a>&nbsp;&nbsp;
91
+ </div>
92
+ </div>
93
+
94
+ </div>
95
+
96
+
97
+ <!-- if includes -->
98
+
99
+ <div id="section">
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ <!-- if method_list -->
109
+ <div id="methods">
110
+ <h3 class="section-bar">Public Class methods</h3>
111
+
112
+ <div id="method-M000021" class="method-detail">
113
+ <a name="M000021"></a>
114
+
115
+ <div class="method-heading">
116
+ <a href="#M000021" class="method-signature">
117
+ <span class="method-name">entity_expansion_limit=</span><span class="method-args">(val)</span>
118
+ </a>
119
+ </div>
120
+
121
+ <div class="method-description">
122
+ <p><a class="source-toggle" href="#"
123
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
124
+ <div class="method-source-code" id="M000021-source">
125
+ <pre>
126
+ <span class="ruby-comment cmt"># File lib/exact4r.rb, line 27</span>
127
+ 27: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">entity_expansion_limit=</span> <span class="ruby-identifier">val</span>
128
+ 28: <span class="ruby-ivar">@@entity_expansion_limit</span> = <span class="ruby-identifier">val</span>
129
+ 29: <span class="ruby-keyword kw">end</span>
130
+ </pre>
131
+ </div>
132
+ </div>
133
+ </div>
134
+
135
+ <h3 class="section-bar">Public Instance methods</h3>
136
+
137
+ <div id="method-M000022" class="method-detail">
138
+ <a name="M000022"></a>
139
+
140
+ <div class="method-heading">
141
+ <a href="#M000022" class="method-signature">
142
+ <span class="method-name">record_entity_expansion!</span><span class="method-args">()</span>
143
+ </a>
144
+ </div>
145
+
146
+ <div class="method-description">
147
+ <p><a class="source-toggle" href="#"
148
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
149
+ <div class="method-source-code" id="M000022-source">
150
+ <pre>
151
+ <span class="ruby-comment cmt"># File lib/exact4r.rb, line 31</span>
152
+ 31: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">record_entity_expansion!</span>
153
+ 32: <span class="ruby-ivar">@number_of_expansions</span> <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
154
+ 33: <span class="ruby-ivar">@number_of_expansions</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
155
+ 34: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@number_of_expansions</span> <span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@@entity_expansion_limit</span>
156
+ 35: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Number of entity expansions exceeded, processing aborted.&quot;</span>
157
+ 36: <span class="ruby-keyword kw">end</span>
158
+ 37: <span class="ruby-keyword kw">end</span>
159
+ </pre>
160
+ </div>
161
+ </div>
162
+ </div>
163
+
164
+
165
+ </div>
166
+
167
+
168
+ </div>
169
+
170
+
171
+ <div id="validator-badges">
172
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
173
+ </div>
174
+
175
+ </body>
176
+ </html>