geti 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/geti/app_client.rb +15 -0
- data/spec/geti_app_client_spec.rb +40 -0
- data/spec/remote/geti_app_client_spec.rb +2 -2
- data/spec/remote/geti_auth_client_spec.rb +1 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
data/lib/geti/app_client.rb
CHANGED
@@ -174,6 +174,7 @@ class Geti::AppClient < Geti::Client
|
|
174
174
|
end
|
175
175
|
|
176
176
|
def data(xml, opts)
|
177
|
+
opts = filter_invalid_characters(opts)
|
177
178
|
filename = "%s_%s.xml" % [opts[:id].to_s, Time.now.strftime("%d_%b_%Y_%H_%M_%S")]
|
178
179
|
xml.Envelope do
|
179
180
|
xml.Body :FileName => filename, :FileDate => Time.now.iso8601 do
|
@@ -255,6 +256,20 @@ class Geti::AppClient < Geti::Client
|
|
255
256
|
end
|
256
257
|
end
|
257
258
|
|
259
|
+
def filter_invalid_characters(opts)
|
260
|
+
opts = opts.dup
|
261
|
+
opts[:address].gsub!(/[^a-zA-Z0-9 #-:;']/, '')
|
262
|
+
opts[:physical_address].gsub!(/[^a-zA-Z0-9 #-:;']/, '')
|
263
|
+
opts[:principal_address].gsub!(/[^a-zA-Z0-9 #-:;']/, '')
|
264
|
+
|
265
|
+
opts[:city].gsub!(/[^a-zA-Z0-9 ]/, '')
|
266
|
+
opts[:physical_city].gsub!(/[^a-zA-Z0-9 ]/, '')
|
267
|
+
opts[:principal_city].gsub!(/[^a-zA-Z0-9 ]/, '')
|
268
|
+
|
269
|
+
opts[:principal_ssn].gsub!(/[^0-9]/, '')
|
270
|
+
opts
|
271
|
+
end
|
272
|
+
|
258
273
|
def service_address
|
259
274
|
"https://#{domain}/webservices/AppGateway.asmx?WSDL"
|
260
275
|
end
|
@@ -147,6 +147,46 @@ describe Geti::AppClient do
|
|
147
147
|
client.board_merchant_ach(request_payload)
|
148
148
|
end
|
149
149
|
|
150
|
+
describe 'character filtering' do
|
151
|
+
let(:client) { Geti::AppClient.new(test_credentials, {}) }
|
152
|
+
|
153
|
+
it 'filters city' do
|
154
|
+
data = request_payload.merge(:city => 'St. Johns')
|
155
|
+
client.filter_invalid_characters(data)[:city].should == "St Johns"
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'filters address' do
|
159
|
+
data = request_payload.merge(:address => '12 Main St, Suite B!')
|
160
|
+
client.filter_invalid_characters(data)[:address].should == "12 Main St, Suite B"
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'filters physical_city' do
|
164
|
+
data = request_payload.merge(:physical_city => 'St. Johns')
|
165
|
+
client.filter_invalid_characters(data)[:physical_city].should == "St Johns"
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'filters physical_address' do
|
169
|
+
data = request_payload.merge(:physical_address => '12 Main St, Suite B!')
|
170
|
+
client.filter_invalid_characters(data)[:physical_address].should == "12 Main St, Suite B"
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'filters principal_city' do
|
174
|
+
data = request_payload.merge(:principal_city => 'St. Johns')
|
175
|
+
client.filter_invalid_characters(data)[:principal_city].should == "St Johns"
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'filters principal_address' do
|
179
|
+
data = request_payload.merge(:principal_address => '12 Main St, Suite B!')
|
180
|
+
client.filter_invalid_characters(data)[:principal_address].should == "12 Main St, Suite B"
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'filters principal_ssn' do
|
184
|
+
data = request_payload.merge(:principal_ssn => '111-22-3333')
|
185
|
+
client.filter_invalid_characters(data)[:principal_ssn].should == "111223333"
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
|
150
190
|
describe 'response on success' do
|
151
191
|
let(:client) {
|
152
192
|
Geti::AppClient.new(test_credentials, {}).tap{|c|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
describe Geti::AppClient do
|
3
|
+
describe Geti::AppClient, :remote => true do
|
4
4
|
before :all do
|
5
5
|
@timestamp = Time.now.to_i
|
6
6
|
end
|
@@ -18,7 +18,7 @@ describe Geti::AppClient do
|
|
18
18
|
:days_in_business => 404,
|
19
19
|
|
20
20
|
:contact_name => 'George Jetson',
|
21
|
-
:physical_address => "123 Main St",
|
21
|
+
:physical_address => "123 Main St, Suite B",
|
22
22
|
:physical_city => "Vancouver",
|
23
23
|
:physical_state => "WA",
|
24
24
|
:physical_zip => "10120",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jamie Macey
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-11-
|
18
|
+
date: 2012-11-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: savon
|