exact4r 0.5 → 0.5.1

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.
data/CHANGELOG ADDED
@@ -0,0 +1,8 @@
1
+ == v0.5.1
2
+ Added CHANGELOG, LICENCE & VERSION
3
+ Ensured README etc. were included in gem and displayed as default in RDoc
4
+ Renamed send() to submit() in Transporter
5
+ Fixed path to default E-xact certificates
6
+
7
+ == v0.5
8
+ Initial Release
data/LICENCE ADDED
@@ -0,0 +1,3 @@
1
+ =Licence Terms
2
+
3
+ Distributed under the Ruby software licence[http://www.ruby-lang.org/en/LICENSE.txt]
data/README ADDED
@@ -0,0 +1,122 @@
1
+ = exact4r
2
+ A gem which rrovides access to E-xact's Web Services API, allowing the submission
3
+ of financial transactions via REST, JSON or SOAP.
4
+
5
+ == Getting Started
6
+
7
+ =1. Submit a transaction
8
+
9
+ require 'rubygems'
10
+ require 'exact4r'
11
+
12
+ # build a purchase request
13
+ request = EWS::Transaction::Request.new({
14
+ :transaction_type => :purchase,
15
+ :amount => 10.50,
16
+ :cardholder_name => "Simon Brown",
17
+ :cc_number => "4111111111111111",
18
+ :cc_expiry => "1005", # MUST be YYMM format
19
+ :gateway_id => "XXXXXXX", # which gateway to submit the request to
20
+ :password => "YYYYYY" # your password for that gateway
21
+ })
22
+
23
+ transporter = EWS::Transaction::Transporter.new
24
+ response = transporter.submit(request) # submits using REST (XML) by default
25
+
26
+ # submit using JSON, or
27
+ response = transporter.submit(request, :json)
28
+
29
+ # submit using SOAP, or
30
+ response = transporter.submit(request, :soap)
31
+
32
+ # submit explicitly via REST
33
+ response = transporter.submit(request, :rest)
34
+
35
+ # The response object is independent of type of transport chosen.
36
+ # We decode the payload into a regular object
37
+ response.transaction_tag # 1234
38
+ response.exact_resp_code # "00"
39
+ response.exact_message # "Transaction Normal"
40
+ response.bank_resp_code # "00"
41
+ response.bank_message # "APPROVED"
42
+
43
+ =2. Find information on an existing transaction
44
+
45
+ require 'rubygems'
46
+ require 'exact4r'
47
+
48
+ # build a purchase request
49
+ request = EWS::Transaction::Request.new({
50
+ :transaction_type => :purchase,
51
+ :amount => 10.50,
52
+ :cardholder_name => "Simon Brown",
53
+ :cc_number => "4111111111111111",
54
+ :cc_expiry => "1005", # MUST be YYMM format
55
+ :gateway_id => "XXXXXXX", # which gateway to submit the request to
56
+ :password => "YYYYYY" # your password for that gateway
57
+ })
58
+
59
+ transporter = EWS::Transaction::Transporter.new
60
+ response = transporter.submit(request) # submits using REST (XML) by default
61
+
62
+ # you need to know the transaction tag of the transaction you are looking for
63
+ find_request = EWS::Transaction::Request.new({
64
+ :transaction_type => :transaction_details,
65
+ :transaction_tag => response.transaction_tag,
66
+ :gateway_id => "XXXXXXX",
67
+ :password => "YYYYYY"
68
+ })
69
+
70
+ find_response = transporter.submit(find_request, :json) # again, can choose your transport type as before
71
+ find_response.cc_number # 4111111111111111
72
+ find_response.amount # 10.50
73
+
74
+ =3. Re-using a Transporter
75
+
76
+ require 'rubygems'
77
+ require 'exact4r'
78
+
79
+ # The transporter object can be re-used across multiple transactions, so set it up once
80
+ # and forget about it.
81
+ # In this example, we will continue to use E-xact's default web-service URL, but we
82
+ # will specify a default transport_type of :soap
83
+ transporter = EWS::Transaction::Transporter.new(nil, {:transaction_type => :soap})
84
+
85
+ # now let's submit do a recurring seed purchase...
86
+ rsp_req = EWS::Transaction::Request.new({
87
+ :transaction_type => :recurring_seed_purchase,
88
+ :amount => 12.00,
89
+ :cardholder_name => "Simon Brown",
90
+ :cc_number => "4111111111111111",
91
+ :cc_expiry => "1005",
92
+ :gateway_id => "XXXXXX",
93
+ :password => "YYYYYY"
94
+ })
95
+
96
+ rsp_resp = transporter.submit(rsp_req)
97
+ raise "Seed Purchase failed" unless rsp_resp.approved?
98
+
99
+ # ...then do multiple refunds against it
100
+ 1.upto(10) do
101
+ rf_req = EWS::Transaction::Request.new({
102
+ :transaction_type => :tagged_refund,
103
+ :transaction_tag => rsp_resp.transaction_tag, # need to know which transaction we're refunding against...
104
+ :auth_number => rsp_resp.auth_number, # and its auth_number
105
+ :amount => 1.00, # refund a dollar at a time
106
+ :gateway_id => "XXXXXX",
107
+ :password => "YYYYYY"
108
+ })
109
+ rf_resp = transporter.submit(rf_req)
110
+ raise "Refund failed: #{rf_resp.exact_resp_code}, #{rf_resp.exact_message}" unless rf_resp.approved?
111
+ end
112
+
113
+ == Rake tasks
114
+
115
+ spec
116
+ Run all test in spec/ folder (default)
117
+
118
+ rdoc
119
+ Generate rdoc html in doc/
120
+
121
+ gem
122
+ Build gem
data/Rakefile ADDED
@@ -0,0 +1,41 @@
1
+ require 'spec/rake/spectask'
2
+ require 'rake/rdoctask'
3
+ require "rubygems"
4
+ Gem::manage_gems
5
+ require "rake/gempackagetask"
6
+
7
+ task :default => :spec
8
+
9
+ desc "Run all specs"
10
+ Spec::Rake::SpecTask.new(:spec) do |t|
11
+ t.spec_files = FileList['spec/**/*_spec.rb']
12
+ end
13
+
14
+ desc "Build the RDoc"
15
+ Rake::RDocTask.new { |rdoc|
16
+ rdoc.rdoc_dir = 'doc'
17
+ rdoc.title = "exact4r"
18
+ rdoc.options << '--main' << 'README' << "--inline-source" << "--line-numbers"
19
+ rdoc.rdoc_files.include('CHANGELOG', 'LICENCE', 'README', 'VERSION', 'lib/**/*.rb')
20
+ }
21
+
22
+ desc "Build the exact4r gem"
23
+ spec = Gem::Specification.new do |s|
24
+ s.name="exact4r"
25
+ s.author = "E-xact Transactions Ltd."
26
+ s.homepage = "http://e-xact4r.rubyforge.org/"
27
+ s.rubyforge_project = "exact4r"
28
+ s.email = "dredmond@e-xact.com"
29
+ s.version=`cat VERSION`
30
+ s.summary = 'E-xact Web Services Client Library.'
31
+ s.files = FileList["./**/**"].to_a
32
+ s.has_rdoc = true
33
+ s.extra_rdoc_files = ['CHANGELOG', 'LICENCE', 'README', 'VERSION']
34
+ s.rdoc_options << '--main' << 'README' << '--inline-source' << '--line-numbers'
35
+ s.add_dependency('activesupport', '>= 2.0.2')
36
+ s.add_dependency('builder', '>= 2.1.2')
37
+ end
38
+
39
+ Rake::GemPackageTask.new(spec) do |pkg|
40
+ pkg.need_tar = true
41
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.5.1
@@ -362,11 +362,11 @@ Initialize a <a href="Request.html">Request</a> with a hash of values
362
362
  onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
363
363
  <div class="method-source-code" id="M000004-source">
364
364
  <pre>
365
- <span class="ruby-comment cmt"># File lib/ews/transaction/request.rb, line 54</span>
366
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">hash</span> = {})
367
- <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span> <span class="ruby-node">&quot;#{k.to_s}=&quot;</span>, <span class="ruby-identifier">v</span>}
368
- <span class="ruby-ivar">@errors</span> = {}
369
- <span class="ruby-keyword kw">end</span>
365
+ <span class="ruby-comment cmt"># File lib/ews/transaction/request.rb, line 54</span>
366
+ 54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">hash</span> = {})
367
+ 55: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span> <span class="ruby-node">&quot;#{k.to_s}=&quot;</span>, <span class="ruby-identifier">v</span>}
368
+ 56: <span class="ruby-ivar">@errors</span> = {}
369
+ 57: <span class="ruby-keyword kw">end</span>
370
370
  </pre>
371
371
  </div>
372
372
  </div>
@@ -392,10 +392,10 @@ Indicates whether or not this transaction is a
392
392
  onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
393
393
  <div class="method-source-code" id="M000006-source">
394
394
  <pre>
395
- <span class="ruby-comment cmt"># File lib/ews/transaction/request.rb, line 71</span>
396
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_find_transaction?</span>
397
- <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>
398
- <span class="ruby-keyword kw">end</span>
395
+ <span class="ruby-comment cmt"># File lib/ews/transaction/request.rb, line 71</span>
396
+ 71: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_find_transaction?</span>
397
+ 72: <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>
398
+ 73: <span class="ruby-keyword kw">end</span>
399
399
  </pre>
400
400
  </div>
401
401
  </div>
@@ -420,15 +420,15 @@ relevant code, e.g: for a purchase you can use either
420
420
  onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
421
421
  <div class="method-source-code" id="M000005-source">
422
422
  <pre>
423
- <span class="ruby-comment cmt"># File lib/ews/transaction/request.rb, line 61</span>
424
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">transaction_type=</span>(<span class="ruby-identifier">type_sym</span>)
425
- <span class="ruby-comment cmt"># assume we're given a symbol, so look up the code</span>
426
- <span class="ruby-identifier">value</span> = <span class="ruby-ivar">@@transaction_codes</span>[<span class="ruby-identifier">type_sym</span>]
427
- <span class="ruby-comment cmt"># if nothing found, then maybe we were given an actual code?</span>
428
- <span class="ruby-identifier">value</span> = <span class="ruby-identifier">type_sym</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@@transaction_codes</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">type_sym</span>
429
-
430
- <span class="ruby-ivar">@transaction_type</span> = <span class="ruby-identifier">value</span>
431
- <span class="ruby-keyword kw">end</span>
423
+ <span class="ruby-comment cmt"># File lib/ews/transaction/request.rb, line 61</span>
424
+ 61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">transaction_type=</span>(<span class="ruby-identifier">type_sym</span>)
425
+ 62: <span class="ruby-comment cmt"># assume we're given a symbol, so look up the code</span>
426
+ 63: <span class="ruby-identifier">value</span> = <span class="ruby-ivar">@@transaction_codes</span>[<span class="ruby-identifier">type_sym</span>]
427
+ 64: <span class="ruby-comment cmt"># if nothing found, then maybe we were given an actual code?</span>
428
+ 65: <span class="ruby-identifier">value</span> = <span class="ruby-identifier">type_sym</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@@transaction_codes</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">type_sym</span>)
429
+ 66:
430
+ 67: <span class="ruby-ivar">@transaction_type</span> = <span class="ruby-identifier">value</span>
431
+ 68: <span class="ruby-keyword kw">end</span>
432
432
  </pre>
433
433
  </div>
434
434
  </div>
@@ -448,26 +448,26 @@ relevant code, e.g: for a purchase you can use either
448
448
  onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
449
449
  <div class="method-source-code" id="M000007-source">
450
450
  <pre>
451
- <span class="ruby-comment cmt"># File lib/ews/transaction/request.rb, line 75</span>
452
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid?</span>
453
- <span class="ruby-identifier">errors</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>
454
- <span class="ruby-identifier">errors</span>[<span class="ruby-identifier">:transaction_type</span>] = <span class="ruby-value str">&quot;invalid transaction_type supplied&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@transaction_codes</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">include?</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">transaction_type</span>
455
-
456
- <span class="ruby-comment cmt"># need to authenticate</span>
457
- <span class="ruby-identifier">errors</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>
458
- <span class="ruby-identifier">errors</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>
459
-
460
- <span class="ruby-comment cmt"># ensure we've been given valid amounts</span>
461
- <span class="ruby-identifier">errors</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>)
462
- <span class="ruby-identifier">errors</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>)
463
- <span class="ruby-identifier">errors</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>)
464
- <span class="ruby-identifier">errors</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>)
465
-
466
- <span class="ruby-identifier">errors</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>
467
- <span class="ruby-identifier">errors</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>
468
-
469
- <span class="ruby-identifier">errors</span>.<span class="ruby-identifier">empty?</span>
470
- <span class="ruby-keyword kw">end</span>
451
+ <span class="ruby-comment cmt"># File lib/ews/transaction/request.rb, line 75</span>
452
+ 75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid?</span>
453
+ 76: <span class="ruby-identifier">errors</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>
454
+ 77: <span class="ruby-identifier">errors</span>[<span class="ruby-identifier">:transaction_type</span>] = <span class="ruby-value str">&quot;invalid transaction_type supplied&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@@transaction_codes</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">include?</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">transaction_type</span>
455
+ 78:
456
+ 79: <span class="ruby-comment cmt"># need to authenticate</span>
457
+ 80: <span class="ruby-identifier">errors</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>
458
+ 81: <span class="ruby-identifier">errors</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>
459
+ 82:
460
+ 83: <span class="ruby-comment cmt"># ensure we've been given valid amounts</span>
461
+ 84: <span class="ruby-identifier">errors</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>)
462
+ 85: <span class="ruby-identifier">errors</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>)
463
+ 86: <span class="ruby-identifier">errors</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>)
464
+ 87: <span class="ruby-identifier">errors</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>)
465
+ 88:
466
+ 89: <span class="ruby-identifier">errors</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>
467
+ 90: <span class="ruby-identifier">errors</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>
468
+ 91:
469
+ 92: <span class="ruby-identifier">errors</span>.<span class="ruby-identifier">empty?</span>
470
+ 93: <span class="ruby-keyword kw">end</span>
471
471
  </pre>
472
472
  </div>
473
473
  </div>
@@ -256,10 +256,10 @@ Indicates whether or not the transaction was approved
256
256
  onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
257
257
  <div class="method-source-code" id="M000003-source">
258
258
  <pre>
259
- <span class="ruby-comment cmt"># File lib/ews/transaction/response.rb, line 13</span>
260
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">approved?</span>
261
- <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">transaction_approved</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
262
- <span class="ruby-keyword kw">end</span>
259
+ <span class="ruby-comment cmt"># File lib/ews/transaction/response.rb, line 13</span>
260
+ 13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">approved?</span>
261
+ 14: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">transaction_approved</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
262
+ 15: <span class="ruby-keyword kw">end</span>
263
263
  </pre>
264
264
  </div>
265
265
  </div>
@@ -91,14 +91,12 @@ the user. The available options are:
91
91
  </pre>
92
92
  <p>
93
93
  The <a href="Transporter.html">Transporter</a> will connect to the service,
94
- using SSL if required, and will encode Reqests to <a
95
- href="Transporter.html#M000002">send</a> to the service, and decode
96
- Responses received from the service.
94
+ using SSL if required, and will encode Reqests to send to the service, and
95
+ decode Responses received from the service.
97
96
  </p>
98
97
  <p>
99
98
  Once configured to connect to a particular service, it can be used
100
- repeatedly to <a href="Transporter.html#M000002">send</a> as many
101
- transactions as required.
99
+ repeatedly to send as many transactions as required.
102
100
  </p>
103
101
 
104
102
  </div>
@@ -111,7 +109,7 @@ transactions as required.
111
109
 
112
110
  <div class="name-list">
113
111
  <a href="#M000001">new</a>&nbsp;&nbsp;
114
- <a href="#M000002">send</a>&nbsp;&nbsp;
112
+ <a href="#M000002">submit</a>&nbsp;&nbsp;
115
113
  </div>
116
114
  </div>
117
115
 
@@ -165,20 +163,21 @@ The default certificates are those required to connect to <a
165
163
  href="https://api.e-xact.com">api.e-xact.com</a> and the default
166
164
  <tt>transport_type</tt> is <tt>:rest</tt>. The default
167
165
  <tt>transport_type</tt> can be overridden on a per-transaction basis, if
168
- you choose to do so, by specifying it as a parameter to the <tt><a
169
- href="Transporter.html#M000002">send</a></tt> method.
166
+ you choose to do so, by specifying it as a parameter to the <tt>send</tt>
167
+ method.
170
168
  </p>
171
169
  <p><a class="source-toggle" href="#"
172
170
  onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
173
171
  <div class="method-source-code" id="M000001-source">
174
172
  <pre>
175
- <span class="ruby-comment cmt"># File lib/ews/transaction/transporter.rb, line 34</span>
176
- <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> = {})
177
- <span class="ruby-ivar">@url</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">url</span>)
178
- <span class="ruby-ivar">@server_cert</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:server_cert</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;certs/exact.cer&quot;</span>
179
- <span class="ruby-ivar">@issuer_cert</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:issuer_cert</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;certs/equifax_ca.cer&quot;</span>
180
- <span class="ruby-ivar">@transport_type</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:issuer_cert</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:rest</span>
181
- <span class="ruby-keyword kw">end</span>
173
+ <span class="ruby-comment cmt"># File lib/ews/transaction/transporter.rb, line 34</span>
174
+ 34: <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> = {})
175
+ 35: <span class="ruby-ivar">@url</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">url</span>)
176
+ 36: <span class="ruby-identifier">base</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>)
177
+ 37: <span class="ruby-ivar">@server_cert</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:server_cert</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">base</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;/../../../certs/exact.cer&quot;</span>
178
+ 38: <span class="ruby-ivar">@issuer_cert</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:issuer_cert</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">base</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;/../../../certs/equifax_ca.cer&quot;</span>
179
+ 39: <span class="ruby-ivar">@transport_type</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:issuer_cert</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:rest</span>
180
+ 40: <span class="ruby-keyword kw">end</span>
182
181
  </pre>
183
182
  </div>
184
183
  </div>
@@ -191,7 +190,7 @@ href="Transporter.html#M000002">send</a></tt> method.
191
190
 
192
191
  <div class="method-heading">
193
192
  <a href="#M000002" class="method-signature">
194
- <span class="method-name">send</span><span class="method-args">(request, transport_type = nil)</span>
193
+ <span class="method-name">submit</span><span class="method-args">(request, transport_type = nil)</span>
195
194
  </a>
196
195
  </div>
197
196
 
@@ -214,23 +213,23 @@ href="Transporter.html">Transporter</a> will be used
214
213
  onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
215
214
  <div class="method-source-code" id="M000002-source">
216
215
  <pre>
217
- <span class="ruby-comment cmt"># File lib/ews/transaction/transporter.rb, line 45</span>
218
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">transport_type</span> = <span class="ruby-keyword kw">nil</span>)
219
- <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Request not supplied&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">nil?</span>
220
- <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">request</span>.<span class="ruby-identifier">valid?</span>
221
-
222
- <span class="ruby-identifier">transport_type</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@transport_type</span>
223
-
224
- <span class="ruby-identifier">raise</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>
225
-
226
- <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">request</span>.<span class="ruby-identifier">is_find_transaction?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">transport_type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:soap</span>
227
- <span class="ruby-identifier">content</span> = <span class="ruby-identifier">post</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">transport_type</span>)
228
- <span class="ruby-keyword kw">else</span>
229
- <span class="ruby-identifier">content</span> = <span class="ruby-identifier">get</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">transport_type</span>)
230
- <span class="ruby-keyword kw">end</span>
231
-
232
- <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">content</span>
233
- <span class="ruby-keyword kw">end</span>
216
+ <span class="ruby-comment cmt"># File lib/ews/transaction/transporter.rb, line 46</span>
217
+ 46: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">transport_type</span> = <span class="ruby-keyword kw">nil</span>)
218
+ 47: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Request not supplied&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">nil?</span>
219
+ 48: <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">request</span>.<span class="ruby-identifier">valid?</span>
220
+ 49:
221
+ 50: <span class="ruby-identifier">transport_type</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@transport_type</span>
222
+ 51:
223
+ 52: <span class="ruby-identifier">raise</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>
224
+ 53:
225
+ 54: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">request</span>.<span class="ruby-identifier">is_find_transaction?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">transport_type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:soap</span>
226
+ 55: <span class="ruby-identifier">content</span> = <span class="ruby-identifier">post</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">transport_type</span>)
227
+ 56: <span class="ruby-keyword kw">else</span>
228
+ 57: <span class="ruby-identifier">content</span> = <span class="ruby-identifier">get</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">transport_type</span>)
229
+ 58: <span class="ruby-keyword kw">end</span>
230
+ 59:
231
+ 60: <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">content</span>
232
+ 61: <span class="ruby-keyword kw">end</span>
234
233
  </pre>
235
234
  </div>
236
235
  </div>
data/doc/created.rid CHANGED
@@ -1 +1 @@
1
- Fri, 30 May 2008 00:08:04 +1000
1
+ Fri, 30 May 2008 14:52:32 +1000
@@ -0,0 +1,115 @@
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>File: CHANGELOG</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="fileHeader">
50
+ <h1>CHANGELOG</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>CHANGELOG
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri May 30 14:51:29 +1000 2008</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h2>v0.5.1</h2>
73
+ <pre>
74
+ Added CHANGELOG, LICENCE &amp; VERSION
75
+ Ensured README etc. were included in gem and displayed as default in RDoc
76
+ Renamed send() to submit() in Transporter
77
+ Fixed path to default E-xact certificates
78
+ </pre>
79
+ <h2>v0.5</h2>
80
+ <pre>
81
+ Initial Release
82
+ </pre>
83
+
84
+ </div>
85
+
86
+
87
+ </div>
88
+
89
+
90
+ </div>
91
+
92
+
93
+ <!-- if includes -->
94
+
95
+ <div id="section">
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <!-- if method_list -->
105
+
106
+
107
+ </div>
108
+
109
+
110
+ <div id="validator-badges">
111
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
112
+ </div>
113
+
114
+ </body>
115
+ </html>