tufy 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/tufy/build_account_segment.rb +30 -56
  4. data/lib/tufy/build_address_segment.rb +7 -10
  5. data/lib/tufy/build_contact_number_segment.rb +6 -7
  6. data/lib/tufy/build_email_address_segment.rb +3 -4
  7. data/lib/tufy/build_field.rb +18 -0
  8. data/lib/tufy/build_header_segment.rb +1 -1
  9. data/lib/tufy/build_id_segment.rb +6 -7
  10. data/lib/tufy/build_name_segment.rb +10 -19
  11. data/lib/tufy/build_segment.rb +1 -11
  12. data/lib/tufy/fields/account/build_account_number_field.rb +26 -0
  13. data/lib/tufy/fields/account/build_account_status_field.rb +26 -0
  14. data/lib/tufy/fields/account/build_account_type_field.rb +25 -0
  15. data/lib/tufy/fields/account/build_cash_advance_balance_field.rb +26 -0
  16. data/lib/tufy/fields/account/build_closed_date_field.rb +26 -0
  17. data/lib/tufy/fields/account/build_consumer_or_commercial_field.rb +26 -0
  18. data/lib/tufy/fields/account/build_credit_limit_or_loan_amount_field.rb +26 -0
  19. data/lib/tufy/fields/account/build_currency_code_field.rb +25 -0
  20. data/lib/tufy/fields/account/build_expiry_date_field.rb +26 -0
  21. data/lib/tufy/fields/account/build_fresh_cash_advance_field.rb +26 -0
  22. data/lib/tufy/fields/account/build_installment_amount_field.rb +26 -0
  23. data/lib/tufy/fields/account/build_interest_and_fees_field.rb +26 -0
  24. data/lib/tufy/fields/account/build_legal_action_field.rb +26 -0
  25. data/lib/tufy/fields/account/build_number_of_days_past_due_field.rb +26 -0
  26. data/lib/tufy/fields/account/build_number_of_installments_field.rb +26 -0
  27. data/lib/tufy/fields/account/build_opened_date_field.rb +26 -0
  28. data/lib/tufy/fields/account/build_outstanding_balance_field.rb +26 -0
  29. data/lib/tufy/fields/account/build_partial_payment_field.rb +26 -0
  30. data/lib/tufy/fields/account/build_past_due_amount_field.rb +26 -0
  31. data/lib/tufy/fields/account/build_payment_amount_field.rb +26 -0
  32. data/lib/tufy/fields/account/build_payment_frequency_field.rb +26 -0
  33. data/lib/tufy/fields/account/build_reported_date_field.rb +26 -0
  34. data/lib/tufy/fields/account/build_restructured_account_number_field.rb +26 -0
  35. data/lib/tufy/fields/account/build_shared_by_field.rb +26 -0
  36. data/lib/tufy/fields/account/build_unbilled_balance_field.rb +26 -0
  37. data/lib/tufy/fields/account/build_user_id_field.rb +26 -0
  38. data/lib/tufy/fields/address/build_address_1_field.rb +26 -0
  39. data/lib/tufy/fields/address/build_address_2_field.rb +26 -0
  40. data/lib/tufy/fields/address/build_address_type_field.rb +26 -0
  41. data/lib/tufy/fields/contact_number/build_contact_number_field.rb +26 -0
  42. data/lib/tufy/fields/contact_number/build_contact_number_format_field.rb +26 -0
  43. data/lib/tufy/fields/email_address/build_email_address_field.rb +26 -0
  44. data/lib/tufy/fields/id/build_id_number_field.rb +26 -0
  45. data/lib/tufy/fields/id/build_id_type_field.rb +26 -0
  46. data/lib/tufy/fields/name/build_ac_holder_type_field.rb +26 -0
  47. data/lib/tufy/fields/name/build_civil_status_field.rb +26 -0
  48. data/lib/tufy/fields/name/build_date_of_birth_field.rb +26 -0
  49. data/lib/tufy/fields/name/build_first_name_field.rb +26 -0
  50. data/lib/tufy/fields/name/build_gender_field.rb +26 -0
  51. data/lib/tufy/fields/name/build_last_name_field.rb +26 -0
  52. data/lib/tufy/version.rb +1 -1
  53. data/lib/tufy.rb +41 -2
  54. metadata +43 -2
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildNumberOfDaysPastDueField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::NUMBER_OF_DAYS_PAST_DUE_TAG +
20
+ FormatStrings::F2TS % (FormatStrings::F3TS % raw_data[:number_of_days_past_due]).size +
21
+ FormatStrings::F3TS % raw_data[:number_of_days_past_due]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildNumberOfInstallmentsField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::NUMBER_OF_INSTALLMENTS_TAG +
20
+ FormatStrings::F2TS % raw_data[:number_of_installments].to_i.to_s.size +
21
+ raw_data[:number_of_installments].to_i.to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildOpenedDateField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::OPENED_DATE_TAG +
20
+ FormatStrings::F2TS % transform_date(raw_data[:opened_date]).size +
21
+ transform_date(raw_data[:opened_date])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildOutstandingBalanceField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::OUTSTANDING_BALANCE_TAG +
20
+ FormatStrings::F2TS % raw_data[:outstanding_balance].to_i.to_s.size +
21
+ raw_data[:outstanding_balance].to_i.to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildPartialPaymentField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::PARTIAL_PAYMENT_TAG +
20
+ FormatStrings::F2TS % raw_data[:partial_payment].size +
21
+ raw_data[:partial_payment]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildPastDueAmountField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::PAST_DUE_AMOUNT_TAG +
20
+ FormatStrings::F2TS % raw_data[:past_due_amount].to_i.to_s.size +
21
+ raw_data[:past_due_amount].to_i.to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildPaymentAmountField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::PAYMENT_AMOUNT_TAG +
20
+ FormatStrings::F2TS % raw_data[:payment_amount].to_i.to_s.size +
21
+ raw_data[:payment_amount].to_i.to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildPaymentFrequencyField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::PAYMENT_FREQUENCY_TAG +
20
+ FormatStrings::F2TS % raw_data[:payment_frequency].size +
21
+ raw_data[:payment_frequency]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildReportedDateField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::REPORTED_DATE_TAG +
20
+ FormatStrings::F2TS % transform_date(DateTime.now).size +
21
+ transform_date(DateTime.now)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildRestructuredAccountNumberField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::RESTRUCTURED_ACCOUNT_NUMBER_TAG +
20
+ FormatStrings::F2TS % raw_data[:restructured_account_number].to_s.size +
21
+ raw_data[:restructured_account_number].to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildSharedByField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::SHARED_BY_TAG +
20
+ FormatStrings::F2TS % raw_data[:shared_by].size +
21
+ raw_data[:shared_by]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildUnbilledBalanceField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::UNBILLED_BALANCE_TAG +
20
+ FormatStrings::F2TS % raw_data[:unbilled_balance].to_i.to_s.size +
21
+ raw_data[:unbilled_balance].to_i.to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildUserIdField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::USER_ID_TAG +
20
+ FormatStrings::F2TS % raw_data[:user_id].size +
21
+ raw_data[:user_id]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Address
4
+ class BuildAddress1Field < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAddressSegment::Constants::ADDRESS_LINE_1_TAG +
20
+ FormatStrings::F2TS % remove_special_characters(raw_data[:address_line_1]).size +
21
+ remove_special_characters(raw_data[:address_line_1])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Address
4
+ class BuildAddress2Field < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAddressSegment::Constants::ADDRESS_LINE_2_TAG +
20
+ FormatStrings::F2TS % remove_special_characters(raw_data[:address_line_2]).size +
21
+ remove_special_characters(raw_data[:address_line_2])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Address
4
+ class BuildAddressTypeField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAddressSegment::Constants::ADDRESS_TYPE_TAG +
20
+ FormatStrings::F2TS % raw_data[:address_type].size +
21
+ raw_data[:address_type]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module ContactNumber
4
+ class BuildContactNumberField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildContactNumberSegment::Constants::CONTACT_NUMBER_TAG +
20
+ FormatStrings::F2TS % remove_special_characters(raw_data[:contact_number]).size +
21
+ remove_special_characters(raw_data[:contact_number])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module ContactNumber
4
+ class BuildContactNumberFormatField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildContactNumberSegment::Constants::CONTACT_NUMBER_FORMAT_TAG +
20
+ FormatStrings::F2TS % raw_data[:contact_number_format].size +
21
+ raw_data[:contact_number_format]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module EmailAddress
4
+ class BuildEmailAddressField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildEmailAddressSegment::Constants::EMAIL_ADDRESS_TAG +
20
+ FormatStrings::F2TS % raw_data[:email_address].size +
21
+ raw_data[:email_address]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Id
4
+ class BuildIdNumberField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildIdSegment::Constants::ID_NUMBER_TAG +
20
+ FormatStrings::F2TS % remove_special_characters(raw_data[:id_number]).size +
21
+ remove_special_characters(raw_data[:id_number])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Id
4
+ class BuildIdTypeField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildIdSegment::Constants::ID_TYPE_TAG +
20
+ FormatStrings::F2TS % raw_data[:id_type].size +
21
+ raw_data[:id_type]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Name
4
+ class BuildAcHolderTypeField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildNameSegment::Constants::AC_HOLDER_TYPE_TAG +
20
+ FormatStrings::F2TS % raw_data[:ac_holder_type].size +
21
+ raw_data[:ac_holder_type]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Name
4
+ class BuildCivilStatusField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildNameSegment::Constants::CIVIL_STATUS_TAG +
20
+ FormatStrings::F2TS % raw_data[:civil_status].size +
21
+ raw_data[:civil_status]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Name
4
+ class BuildDateOfBirthField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildNameSegment::Constants::DATE_OF_BIRTH_TAG +
20
+ FormatStrings::F2TS % transform_date(raw_data[:date_of_birth]).size +
21
+ transform_date(raw_data[:date_of_birth])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Name
4
+ class BuildFirstNameField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildNameSegment::Constants::FIRST_NAME_TAG +
20
+ FormatStrings::F2TS % raw_data[:first_name].size +
21
+ raw_data[:first_name]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end