dcas-ruby 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/dcas-ruby.gemspec +2 -2
- data/lib/dcas.rb +12 -12
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.9
|
data/dcas-ruby.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dcas-ruby}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["BehindLogic"]
|
12
|
-
s.date = %q{2010-01
|
12
|
+
s.date = %q{2010-02-01}
|
13
13
|
s.description = %q{Ruby codebase for creating payment batch files for DCAS, uploading them, and receiving response files from DCAS.}
|
14
14
|
s.email = %q{gems@behindlogic.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/dcas.rb
CHANGED
@@ -3,8 +3,8 @@ require 'ftools'
|
|
3
3
|
module DCAS
|
4
4
|
TESTING = false
|
5
5
|
BUCKET_HOST = 'ftp.ezpaycenters.net'
|
6
|
-
DEFAULT_OUTGOING_BUCKET = 'outgoing'
|
7
|
-
|
6
|
+
DEFAULT_OUTGOING_BUCKET = 'outgoing' # The return files coming back to us.
|
7
|
+
DEFAULT_INCOMING_BUCKET = 'incoming' # The payment files we're sending TO dcas.
|
8
8
|
STAGING_BUCKET = 'staging'
|
9
9
|
DEFAULT_CACHE_LOCATION = 'EFT'
|
10
10
|
|
@@ -24,12 +24,12 @@ module DCAS
|
|
24
24
|
@company_username = options[:company_username].to_s
|
25
25
|
@company_password = options[:company_password].to_s
|
26
26
|
@cache_location = options[:cache_location].to_s || DEFAULT_CACHE_LOCATION
|
27
|
-
@
|
27
|
+
@incoming_bucket = DEFAULT_INCOMING_BUCKET
|
28
28
|
@testing = TESTING
|
29
29
|
end
|
30
30
|
|
31
31
|
attr_reader :username, :password, :company_alias, :company_username, :company_password
|
32
|
-
attr_accessor :cache_location, :
|
32
|
+
attr_accessor :cache_location, :incoming_bucket, :testing
|
33
33
|
|
34
34
|
# :nodoc:
|
35
35
|
def batches
|
@@ -42,7 +42,7 @@ module DCAS
|
|
42
42
|
batches.last
|
43
43
|
end
|
44
44
|
|
45
|
-
# Uploads a single payments file to the DCAS
|
45
|
+
# Uploads a single payments file to the DCAS incoming payments bucket.
|
46
46
|
# You can optionally supply a 'lock' object, which must respond to:
|
47
47
|
# #submit_locked?(filename)
|
48
48
|
# #submit_lock!(filename)
|
@@ -74,7 +74,7 @@ module DCAS
|
|
74
74
|
# 4) If we're still connected, check the file size of the file, then move it out of STAGING and mark file as completed.
|
75
75
|
if ftp.nlst.include?(shortname) && ftp.size(shortname) == File.size(filename)
|
76
76
|
begin
|
77
|
-
ftp.rename(shortname, "../#{
|
77
|
+
ftp.rename(shortname, "../#{incoming_bucket}/#{shortname}") unless testing || incoming_bucket == DCAS::STAGING_BUCKET
|
78
78
|
true
|
79
79
|
rescue Object
|
80
80
|
false
|
@@ -100,7 +100,7 @@ module DCAS
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
# Writes one batch to file and submits it to the DCAS
|
103
|
+
# Writes one batch to file and submits it to the DCAS incoming payments bucket.
|
104
104
|
# You can optionally supply a 'lock' object, which must respond to:
|
105
105
|
# #submit_locked?
|
106
106
|
# #submit_lock!(filename)
|
@@ -112,11 +112,11 @@ module DCAS
|
|
112
112
|
filename = cache_location + "/" + batch.filename
|
113
113
|
# 1) Create the file locally.
|
114
114
|
File.open(filename, 'w') {|f| f << batch.to_csv }
|
115
|
-
# 2) Upload it to the DCAS
|
115
|
+
# 2) Upload it to the DCAS incoming payments bucket.
|
116
116
|
submit_payments_file!(filename, lock_object)
|
117
117
|
end
|
118
118
|
|
119
|
-
# Writes all batches to file and submits them to the DCAS
|
119
|
+
# Writes all batches to file and submits them to the DCAS incoming payments bucket.
|
120
120
|
# You can optionally supply a 'lock' object, which must respond to:
|
121
121
|
# #submit_locked?
|
122
122
|
# #submit_lock!(filename)
|
@@ -137,9 +137,9 @@ module DCAS
|
|
137
137
|
# Checks for response files in the DCAS incoming responses bucket.
|
138
138
|
def available_response_files
|
139
139
|
with_ftp do |ftp|
|
140
|
-
# 3) List the *.csv files in the
|
141
|
-
result = if ftp.nlst.include?(DCAS::
|
142
|
-
ftp.chdir(DCAS::
|
140
|
+
# 3) List the *.csv files in the OUTGOING bucket.
|
141
|
+
result = if ftp.nlst.include?(DCAS::DEFAULT_OUTGOING_BUCKET)
|
142
|
+
ftp.chdir(DCAS::DEFAULT_OUTGOING_BUCKET)
|
143
143
|
ftp.nlst.select {|f| f =~ /\.csv$/}
|
144
144
|
else
|
145
145
|
[]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dcas-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BehindLogic
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01
|
12
|
+
date: 2010-02-01 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|