tufy 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +67 -9
- data/lib/tufy.rb +15 -3
- data/lib/tufy/build_account_segment.rb +1 -1
- data/lib/tufy/build_header_segment.rb +5 -6
- data/lib/tufy/{transform.rb → build_record.rb} +4 -3
- data/lib/tufy/build_records.rb +22 -0
- data/lib/tufy/transform_raw_data.rb +8 -0
- data/lib/tufy/transform_raw_data_array.rb +14 -0
- data/lib/tufy/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70647cdbae7d81d058c2ff8b915ca8ab4ead7080
|
4
|
+
data.tar.gz: 4efb1cd799d6c62e3e32fe3e09fe9c01546a0ee1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34cf815ab6b5f162dbce26d3fdc4832df81dc2cc31eb5da0b6a265f712095cfb1fae8d64f4cf2b85d19be4056163416a5aeb05e592fea843b178ca067f919390
|
7
|
+
data.tar.gz: 36b3c627366498c20c1c91ab7e2cc5d32718ce810c6769d2a397c5f34e09b28a86691d64bfc1a8be66cc6faf4526f64542081b391f22d9bf46f2ccef8a1fe38b
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
# v0.
|
1
|
+
# v0.0.6
|
2
|
+
|
3
|
+
- Added Tufy.transform_raw_data_array and refactor Tufy.transform
|
4
|
+
- Renamed Tufy::BuildAccountSegment.tu_past_due_code to ::past_due_code
|
5
|
+
- Use Unix timestamp for the Member Reference Number in the Header Segment
|
6
|
+
|
7
|
+
# v0.0.5
|
2
8
|
|
3
9
|
- Create method to return TU past due codes instead of using constants
|
4
10
|
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://badge.fury.io/rb/tufy)
|
2
|
+
|
1
3
|
# Tufy
|
2
4
|
|
3
5
|
"Pronounced as T-U-fy"
|
@@ -13,15 +15,20 @@ $ gem install tufy
|
|
13
15
|
```
|
14
16
|
|
15
17
|
### Usage
|
18
|
+
#### 1. Tufy.transform_raw_data_array(header_data, raw_data_array)
|
19
|
+
|
16
20
|
|
17
21
|
```ruby
|
18
|
-
|
19
|
-
Tufy.
|
22
|
+
transform_raw_data_array_result =
|
23
|
+
Tufy.transform_raw_data_array(
|
24
|
+
{
|
25
|
+
# for the header segment
|
26
|
+
member_reference_number: member_reference_number,
|
27
|
+
processor_name: processor_name,
|
28
|
+
user_id: user_id,
|
29
|
+
},
|
30
|
+
[
|
20
31
|
{
|
21
|
-
# for the header segment
|
22
|
-
member_reference_number: member_reference_number,
|
23
|
-
processor_name: processor_name,
|
24
|
-
user_id: user_id,
|
25
32
|
# for the name segment
|
26
33
|
first_name: first_name,
|
27
34
|
last_name: last_name,
|
@@ -66,13 +73,64 @@ transform_data_result =
|
|
66
73
|
legal_action: legal_action,
|
67
74
|
partial_payment: partial_payment,
|
68
75
|
fresh_cash_advance: fresh_cash_advance,
|
69
|
-
|
76
|
+
},
|
77
|
+
]
|
78
|
+
)
|
70
79
|
```
|
71
80
|
|
72
|
-
|
81
|
+
#### 2. Tufy.transform_raw_data(raw_data)
|
82
|
+
|
73
83
|
|
74
84
|
```ruby
|
75
|
-
|
85
|
+
transform_raw_data_result =
|
86
|
+
Tufy.transform_raw_data(
|
87
|
+
{
|
88
|
+
# for the name segment
|
89
|
+
first_name: first_name,
|
90
|
+
last_name: last_name,
|
91
|
+
civil_status: civil_status,
|
92
|
+
date_of_birth: date_of_birth,
|
93
|
+
gender: gender,
|
94
|
+
ac_holder_type: ac_holder_type,
|
95
|
+
# for the id segment
|
96
|
+
id_number: id_number,
|
97
|
+
id_type: id_type,
|
98
|
+
# for the address segment
|
99
|
+
address_line_1: address_line_1,
|
100
|
+
address_line_2: address_line_2,
|
101
|
+
address_type: address_type,
|
102
|
+
# for contact number segment
|
103
|
+
contact_number: contact_number,
|
104
|
+
contact_number_format: contact_number_format,
|
105
|
+
# for email address segment
|
106
|
+
email_address: email_address,
|
107
|
+
# for account segment
|
108
|
+
account_number: account_number,
|
109
|
+
restructured_account_number: restructured_account_number,
|
110
|
+
account_status: account_status,
|
111
|
+
account_type: account_type,
|
112
|
+
currency_code: currency_code,
|
113
|
+
opened_date: opened_date,
|
114
|
+
payment_amount: payment_amount,
|
115
|
+
closed_date: closed_date,
|
116
|
+
credit_limit_or_loan_amount: credit_limit_or_loan_amount,
|
117
|
+
shared_by: shared_by,
|
118
|
+
outstanding_balance: outstanding_balance,
|
119
|
+
interest_and_fees: interest_and_fees,
|
120
|
+
unbilled_balance: unbilled_balance,
|
121
|
+
cash_advance_balance: cash_advance_balance,
|
122
|
+
number_of_days_past_due: number_of_days_past_due,
|
123
|
+
past_due_amount: past_due_amount,
|
124
|
+
installment_amount: installment_amount,
|
125
|
+
number_of_installments: number_of_installments,
|
126
|
+
payment_frequency: payment_frequency,
|
127
|
+
expiry_date: expiry_date,
|
128
|
+
consumer_or_commercial: consumer_or_commercial,
|
129
|
+
legal_action: legal_action,
|
130
|
+
partial_payment: partial_payment,
|
131
|
+
fresh_cash_advance: fresh_cash_advance,
|
132
|
+
}
|
133
|
+
)
|
76
134
|
```
|
77
135
|
|
78
136
|
### Supported Data
|
data/lib/tufy.rb
CHANGED
@@ -12,10 +12,22 @@ require "tufy/build_contact_number_segment"
|
|
12
12
|
require "tufy/build_email_address_segment"
|
13
13
|
require "tufy/build_account_segment"
|
14
14
|
require "tufy/build_end_of_subject_segment"
|
15
|
-
require "tufy/
|
15
|
+
require "tufy/build_records"
|
16
|
+
require "tufy/build_record"
|
17
|
+
require "tufy/transform_raw_data"
|
18
|
+
require "tufy/transform_raw_data_array"
|
19
|
+
|
20
|
+
|
16
21
|
|
17
22
|
module Tufy
|
18
|
-
def self.
|
19
|
-
|
23
|
+
def self.transform_raw_data(raw_data)
|
24
|
+
TransformRawData.execute(raw_data: raw_data)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.transform_raw_data_array(header_data, raw_data_array)
|
28
|
+
TransformRawDataArray.execute({
|
29
|
+
header_data: header_data,
|
30
|
+
raw_data_array: raw_data_array
|
31
|
+
})
|
20
32
|
end
|
21
33
|
end
|
@@ -1,16 +1,15 @@
|
|
1
1
|
module Tufy
|
2
2
|
class BuildHeaderSegment < BuildSegment
|
3
|
-
expects :
|
3
|
+
expects :header_data
|
4
4
|
promises :transformed_data
|
5
5
|
|
6
6
|
REQUIRED_KEYS = [
|
7
|
-
:member_reference_number,
|
8
7
|
:processor_name,
|
9
8
|
:user_id
|
10
9
|
]
|
11
10
|
|
12
11
|
executed do |ctx|
|
13
|
-
validate_presence_of_required_keys(ctx.
|
12
|
+
validate_presence_of_required_keys(ctx.header_data, REQUIRED_KEYS)
|
14
13
|
ctx.transformed_data = ctx.transformed_data + transform(ctx).upcase
|
15
14
|
end
|
16
15
|
|
@@ -19,9 +18,9 @@ module Tufy
|
|
19
18
|
def self.transform(ctx)
|
20
19
|
Constants::SEGMENT_TAG + # Segment Tag (Required)
|
21
20
|
Constants::TUDF_VERSION + # Version Tag (Required)
|
22
|
-
"#{FormatStrings::F25TS %
|
23
|
-
"#{FormatStrings::F26TS % ctx.
|
24
|
-
"#{FormatStrings::F10TS % ctx.
|
21
|
+
"#{FormatStrings::F25TS % Time.now.to_i.to_s}" + # Member Reference Number (Required)
|
22
|
+
"#{FormatStrings::F26TS % ctx.header_data[:processor_name].upcase}" + # Member Processor Name (Required)
|
23
|
+
"#{FormatStrings::F10TS % ctx.header_data[:user_id].upcase}" + # User ID (Required)
|
25
24
|
"#{transform_date(Date.today)}" + # Reported Date (Required)
|
26
25
|
Constants::FILLER # Filler (Required)
|
27
26
|
end
|
@@ -1,11 +1,10 @@
|
|
1
1
|
module Tufy
|
2
|
-
class
|
2
|
+
class BuildRecord
|
3
3
|
include LightService::Organizer
|
4
4
|
|
5
5
|
def self.execute(ctx)
|
6
6
|
ctx[:transformed_data] = ''
|
7
|
-
with(ctx).reduce(
|
8
|
-
BuildHeaderSegment,
|
7
|
+
ctx = with(ctx).reduce(
|
9
8
|
BuildNameSegment,
|
10
9
|
BuildAddressSegment,
|
11
10
|
BuildContactNumberSegment,
|
@@ -13,6 +12,8 @@ module Tufy
|
|
13
12
|
BuildAccountSegment,
|
14
13
|
BuildEndOfSubjectSegment,
|
15
14
|
)
|
15
|
+
ctx[:transformed_data]
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Tufy
|
2
|
+
class BuildRecords
|
3
|
+
include LightService::Action
|
4
|
+
|
5
|
+
expects :raw_data_array, :transformed_data
|
6
|
+
promises :transformed_data
|
7
|
+
|
8
|
+
executed do |ctx|
|
9
|
+
ctx.transformed_data = ctx.transformed_data + transform(ctx).upcase
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def self.transform(ctx)
|
15
|
+
raw_data_array = ctx[:raw_data_array]
|
16
|
+
raw_data_array.inject("") do |data, raw_data|
|
17
|
+
data = data + BuildRecord.execute(raw_data: raw_data)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
data/lib/tufy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tufy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil Marion dela Cruz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: light-service
|
@@ -107,10 +107,13 @@ files:
|
|
107
107
|
- lib/tufy/build_header_segment.rb
|
108
108
|
- lib/tufy/build_id_segment.rb
|
109
109
|
- lib/tufy/build_name_segment.rb
|
110
|
+
- lib/tufy/build_record.rb
|
111
|
+
- lib/tufy/build_records.rb
|
110
112
|
- lib/tufy/build_segment.rb
|
111
113
|
- lib/tufy/errors/required_data_missing_error.rb
|
112
114
|
- lib/tufy/format_strings.rb
|
113
|
-
- lib/tufy/
|
115
|
+
- lib/tufy/transform_raw_data.rb
|
116
|
+
- lib/tufy/transform_raw_data_array.rb
|
114
117
|
- lib/tufy/version.rb
|
115
118
|
- tufy.gemspec
|
116
119
|
homepage: https://github.com/carabao-capital/tufy
|