ci_power 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,46 +1,46 @@
1
- module CiPower
2
- class OpenAppointment < Record
3
- attr_accessor :action,
4
- :execute_date,
5
- :execute_mkz_date,
6
- :planned_date,
7
- :planned_mkz_date,
8
- :mutable,
9
- :comment,
10
- :customer_specific_field_1,
11
- :customer_specific_field_2,
12
- :customer_specific_field_3,
13
- :customer_specific_field_4,
14
- :customer_specific_field_5,
15
- :cip_dossier_no
16
-
17
- def initialize(attributes = {})
18
- if attributes.is_a? Hash
19
- attributes.merge! :record_type => '18'
20
- attributes.each do |key, value|
21
- self.send("#{key}=".to_sym, value) if self.respond_to?("#{key}=")
22
- end
23
- end
24
- end
25
-
26
- def to_cip(with_line_terminator = true)
27
- cip_default_data << fill_up(
28
- {
29
- :action => 10,
30
- :execute_date => 10,
31
- :execute_mkz_date => 10,
32
- :planned_date => 10,
33
- :planned_mkz_date => 10,
34
- :mutable => 1,
35
- :comment => 240,
36
- :customer_specific_field_1 => 10,
37
- :customer_specific_field_2 => 10,
38
- :customer_specific_field_3 => 10,
39
- :customer_specific_field_4 => 32,
40
- :customer_specific_field_5 => 32,
41
- :cip_dossier_no => 9
42
- }, with_line_terminator
43
- )
44
- end
45
- end
1
+ module CiPower
2
+ class OpenAppointment < Record
3
+ attr_accessor :action,
4
+ :execute_date,
5
+ :execute_mkz_date,
6
+ :planned_date,
7
+ :planned_mkz_date,
8
+ :mutable,
9
+ :comment,
10
+ :customer_specific_field_1,
11
+ :customer_specific_field_2,
12
+ :customer_specific_field_3,
13
+ :customer_specific_field_4,
14
+ :customer_specific_field_5,
15
+ :cip_dossier_no
16
+
17
+ def initialize(attributes = {})
18
+ if attributes.is_a? Hash
19
+ attributes.merge! :record_type => '18'
20
+ attributes.each do |key, value|
21
+ self.send("#{key}=".to_sym, value) if self.respond_to?("#{key}=")
22
+ end
23
+ end
24
+ end
25
+
26
+ def to_cip(with_line_terminator = true)
27
+ cip_default_data << fill_up(
28
+ {
29
+ :action => 10,
30
+ :execute_date => 10,
31
+ :execute_mkz_date => 10,
32
+ :planned_date => 10,
33
+ :planned_mkz_date => 10,
34
+ :mutable => 1,
35
+ :comment => 240,
36
+ :customer_specific_field_1 => 10,
37
+ :customer_specific_field_2 => 10,
38
+ :customer_specific_field_3 => 10,
39
+ :customer_specific_field_4 => 32,
40
+ :customer_specific_field_5 => 32,
41
+ :cip_dossier_no => 9
42
+ }, with_line_terminator
43
+ )
44
+ end
45
+ end
46
46
  end
@@ -1,109 +1,109 @@
1
- module CiPower
2
- class ProcessData < Record
3
- attr_accessor :enforcement_date,
4
- :enforcement_demand_action,
5
- :delivery_date,
6
- :continue_date,
7
- :enforcement_no,
8
- :enforcement_on,
9
- :enforcement_bureau,
10
- :comment,
11
- :processes_to_date,
12
- :execution_date,
13
- :reclamation_from_date,
14
- :reclamation_to_date,
15
- :is_income_variable,
16
- :is_third_party_claim,
17
- :is_real_estate,
18
- :execution_amount,
19
- :income,
20
- :quote,
21
- :living_wage,
22
- :execution_type,
23
- :enforcement_group,
24
- :third_party_claim,
25
- :real_estate,
26
- :reclamation_objects,
27
- :unpaid_debts_certificate_date,
28
- :is_continuable_after_6months,
29
- :unpaid_debts_amount,
30
- :gain,
31
- :loss,
32
- :unpaid_debts_type,
33
- :gain_dropdown,
34
- :unpaid_debts_certificate_no,
35
- :claim_petition_date,
36
- :opening_of_bankruptcy_date,
37
- :opening_of_bankruptcy_process,
38
- :opening_of_bankruptcy_process_no,
39
- :directive_date,
40
- :decision_date,
41
- :judicial_vitiation_date,
42
- :legal_effect_date,
43
- :case_no_directive,
44
- :case_no_decision,
45
- :cip_dossier_no,
46
- :unpaid_debts_certificate_transfer_application_date
47
-
48
- def initialize(attributes = {})
49
- if attributes.is_a? Hash
50
- attributes.merge! :record_type => '19'
51
- attributes.each do |key, value|
52
- self.send("#{key}=".to_sym, value) if self.respond_to?("#{key}=")
53
- end
54
- end
55
- end
56
-
57
- def to_cip(with_line_terminator = true)
58
- cip_default_data << fill_up(
59
- {
60
- :enforcement_date => 10,
61
- :enforcement_demand_action => 10,
62
- :delivery_date => 10,
63
- :continue_date => 10,
64
- :enforcement_no => 32,
65
- :enforcement_on => 32,
66
- :enforcement_bureau => 120,
67
- :comment => 120,
68
- :processes_to_date => 10,
69
- :execution_date => 10,
70
- :reclamation_from_date => 10,
71
- :reclamation_to_date => 10,
72
- :is_income_variable => 1,
73
- :is_third_party_claim => 1,
74
- :is_real_estate => 1,
75
- :execution_amount => 15,
76
- :income => 15,
77
- :quote => 15,
78
- :living_wage => 15,
79
- :execution_type => 32,
80
- :enforcement_group => 32,
81
- :third_party_claim => 64,
82
- :real_estate => 64,
83
- :reclamation_objects => 240,
84
- :unpaid_debts_certificate_date => 10,
85
- :is_continuable_after_6months => 1,
86
- :unpaid_debts_amount => 15,
87
- :gain => 15,
88
- :loss => 15,
89
- :unpaid_debts_type => 32,
90
- :gain_dropdown => 32,
91
- :unpaid_debts_certificate_no => 32,
92
- :claim_petition_date => 10,
93
- :opening_of_bankruptcy_date => 10,
94
- :opening_of_bankruptcy_process => 32,
95
- :opening_of_bankruptcy_process_no => 32,
96
- :directive_date => 10,
97
- :decision_date => 10,
98
- :judicial_vitiation_date => 10,
99
- :legal_effect_date => 10,
100
- :case_no_directive => 32,
101
- :case_no_decision => 32,
102
- :cip_dossier_no => 9,
103
- :unpaid_debts_certificate_transfer_application_date => 10
104
- }, with_line_terminator
105
- )
106
- end
107
-
108
- end
1
+ module CiPower
2
+ class ProcessData < Record
3
+ attr_accessor :enforcement_date,
4
+ :enforcement_demand_action,
5
+ :delivery_date,
6
+ :continue_date,
7
+ :enforcement_no,
8
+ :enforcement_on,
9
+ :enforcement_bureau,
10
+ :comment,
11
+ :processes_to_date,
12
+ :execution_date,
13
+ :reclamation_from_date,
14
+ :reclamation_to_date,
15
+ :is_income_variable,
16
+ :is_third_party_claim,
17
+ :is_real_estate,
18
+ :execution_amount,
19
+ :income,
20
+ :quote,
21
+ :living_wage,
22
+ :execution_type,
23
+ :enforcement_group,
24
+ :third_party_claim,
25
+ :real_estate,
26
+ :reclamation_objects,
27
+ :unpaid_debts_certificate_date,
28
+ :is_continuable_after_6months,
29
+ :unpaid_debts_amount,
30
+ :gain,
31
+ :loss,
32
+ :unpaid_debts_type,
33
+ :gain_dropdown,
34
+ :unpaid_debts_certificate_no,
35
+ :claim_petition_date,
36
+ :opening_of_bankruptcy_date,
37
+ :opening_of_bankruptcy_process,
38
+ :opening_of_bankruptcy_process_no,
39
+ :directive_date,
40
+ :decision_date,
41
+ :judicial_vitiation_date,
42
+ :legal_effect_date,
43
+ :case_no_directive,
44
+ :case_no_decision,
45
+ :cip_dossier_no,
46
+ :unpaid_debts_certificate_transfer_application_date
47
+
48
+ def initialize(attributes = {})
49
+ if attributes.is_a? Hash
50
+ attributes.merge! :record_type => '19'
51
+ attributes.each do |key, value|
52
+ self.send("#{key}=".to_sym, value) if self.respond_to?("#{key}=")
53
+ end
54
+ end
55
+ end
56
+
57
+ def to_cip(with_line_terminator = true)
58
+ cip_default_data << fill_up(
59
+ {
60
+ :enforcement_date => 10,
61
+ :enforcement_demand_action => 10,
62
+ :delivery_date => 10,
63
+ :continue_date => 10,
64
+ :enforcement_no => 32,
65
+ :enforcement_on => 32,
66
+ :enforcement_bureau => 120,
67
+ :comment => 120,
68
+ :processes_to_date => 10,
69
+ :execution_date => 10,
70
+ :reclamation_from_date => 10,
71
+ :reclamation_to_date => 10,
72
+ :is_income_variable => 1,
73
+ :is_third_party_claim => 1,
74
+ :is_real_estate => 1,
75
+ :execution_amount => 15,
76
+ :income => 15,
77
+ :quote => 15,
78
+ :living_wage => 15,
79
+ :execution_type => 32,
80
+ :enforcement_group => 32,
81
+ :third_party_claim => 64,
82
+ :real_estate => 64,
83
+ :reclamation_objects => 240,
84
+ :unpaid_debts_certificate_date => 10,
85
+ :is_continuable_after_6months => 1,
86
+ :unpaid_debts_amount => 15,
87
+ :gain => 15,
88
+ :loss => 15,
89
+ :unpaid_debts_type => 32,
90
+ :gain_dropdown => 32,
91
+ :unpaid_debts_certificate_no => 32,
92
+ :claim_petition_date => 10,
93
+ :opening_of_bankruptcy_date => 10,
94
+ :opening_of_bankruptcy_process => 32,
95
+ :opening_of_bankruptcy_process_no => 32,
96
+ :directive_date => 10,
97
+ :decision_date => 10,
98
+ :judicial_vitiation_date => 10,
99
+ :legal_effect_date => 10,
100
+ :case_no_directive => 32,
101
+ :case_no_decision => 32,
102
+ :cip_dossier_no => 9,
103
+ :unpaid_debts_certificate_transfer_application_date => 10
104
+ }, with_line_terminator
105
+ )
106
+ end
107
+
108
+ end
109
109
  end
@@ -1,42 +1,42 @@
1
- module CiPower
2
- class Record
3
- attr_accessor :record_type,
4
- :group_no,
5
- :address_identification_debtee,
6
- :address_identification_debtor
7
- {}
8
- def cip_default_data
9
- _fill_up(:record_type => 2, :group_no => 7, :address_identification_debtee => 25, :address_identification_debtor => 25)
10
- end
11
-
12
- def fill_up(data, with_line_terminator = true)
13
- _fill_up(data) + (with_line_terminator ? line_terminator : '')
14
- end
15
-
16
- def line_terminator
17
- "\n"
18
- end
19
-
20
- private
21
- def _fill_up(data)
22
- line = ""
23
- if data.is_a? Hash
24
- data.each do |method_name, length|
25
- field = method(method_name).call
26
- field = field.to_s unless field.is_a? String
27
- # Workaround for special characters problem
28
- if field.scan(/./mu).size < field.size
29
- length = adjust_length(field, length)
30
- end
31
- line << field.ljust(length)
32
- end
33
- end
34
- line
35
- end
36
-
37
- def adjust_length(string, length)
38
- difference = string.size - string.scan(/./mu).size
39
- length += difference
40
- end
41
- end
1
+ module CiPower
2
+ class Record
3
+ attr_accessor :record_type,
4
+ :group_no,
5
+ :address_identification_debtee,
6
+ :address_identification_debtor
7
+ {}
8
+ def cip_default_data
9
+ _fill_up(:record_type => 2, :group_no => 7, :address_identification_debtee => 25, :address_identification_debtor => 25)
10
+ end
11
+
12
+ def fill_up(data, with_line_terminator = true)
13
+ _fill_up(data) + (with_line_terminator ? line_terminator : '')
14
+ end
15
+
16
+ def line_terminator
17
+ "\n"
18
+ end
19
+
20
+ private
21
+ def _fill_up(data)
22
+ line = ""
23
+ if data.is_a? Hash
24
+ data.each do |method_name, length|
25
+ field = method(method_name).call
26
+ field = field.to_s unless field.is_a? String
27
+ # Workaround for special characters problem
28
+ if field.scan(/./mu).size < field.size
29
+ length = adjust_length(field, length)
30
+ end
31
+ line << field.ljust(length)
32
+ end
33
+ end
34
+ line
35
+ end
36
+
37
+ def adjust_length(string, length)
38
+ difference = string.size - string.scan(/./mu).size
39
+ length += difference
40
+ end
41
+ end
42
42
  end
@@ -1,3 +1,3 @@
1
- module CiPower
2
- VERSION = "0.0.26"
3
- end
1
+ module CiPower
2
+ VERSION = "0.0.27"
3
+ end
data/lib/ci_power.rb CHANGED
@@ -1,13 +1,14 @@
1
- require "ci_power/version"
2
-
3
- require "ci_power/export"
4
-
5
- require "ci_power/record"
6
- require "ci_power/dossier_data"
7
- require "ci_power/address"
8
- require "ci_power/communication"
9
- require "ci_power/debt_claim"
10
- require "ci_power/action"
11
- require "ci_power/open_appointment"
12
- require "ci_power/debtor_data"
13
- require "ci_power/installment_plan"
1
+ require "ci_power/version"
2
+
3
+ require "ci_power/export"
4
+
5
+ require "ci_power/record"
6
+ require "ci_power/dossier_data"
7
+ require "ci_power/address"
8
+ require "ci_power/communication"
9
+ require "ci_power/debt_claim"
10
+ require "ci_power/action"
11
+ require "ci_power/open_appointment"
12
+ require "ci_power/debtor_data"
13
+ require "ci_power/installment_plan"
14
+ require "ci_power/process_data"
@@ -1,12 +1,12 @@
1
- module CiPower
2
- module Generators
3
- class CiPowerGenerator < Rails::Generators::Base
4
- source_root File.expand_path('../templates', __FILE__)
5
-
6
- desc "This generator creates a model file at app/models"
7
- def generate_cip_export
8
- copy_file "cip_export.rb", "app/models/cip_export.rb"
9
- end
10
- end
11
- end
1
+ module CiPower
2
+ module Generators
3
+ class CiPowerGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ desc "This generator creates a model file at app/models"
7
+ def generate_cip_export
8
+ copy_file "cip_export.rb", "app/models/cip_export.rb"
9
+ end
10
+ end
11
+ end
12
12
  end
@@ -1,13 +1,13 @@
1
- class CipExport
2
- include CiPower::Export
3
-
4
- def initialize(output)
5
- # Define mapping for CI-Power export here. For example:
6
- #
7
- # Add dossier_data
8
- # output << dossier_data(:reference_1 => '99999', :interest_rate => '15')
9
- #
10
- # Add communication
11
- # output << communication(:type => 'T1', :text => '0812502850')
12
- end
1
+ class CipExport
2
+ include CiPower::Export
3
+
4
+ def initialize(output)
5
+ # Define mapping for CI-Power export here. For example:
6
+ #
7
+ # Add dossier_data
8
+ # output << dossier_data(:reference_1 => '99999', :interest_rate => '15')
9
+ #
10
+ # Add communication
11
+ # output << communication(:type => 'T1', :text => '0812502850')
12
+ end
13
13
  end
@@ -1,24 +1,24 @@
1
- namespace :ci_power do
2
- OUTPUT_FILE = 'tmp/ci_power_export.txt'
3
-
4
- desc 'Extract data from application'
5
- task :extract_data => :environment do
6
- @content = CipExport.new.output.sort_by { |a| [a.group_no, a.record_type] }
7
- end
8
-
9
- desc 'Export data into output file'
10
- task :export => :extract_data do
11
- File.open(OUTPUT_FILE, "w+") do |file|
12
- @content.each do |line|
13
- file.puts line.to_cip
14
- end
15
- end
16
- end
17
-
18
- desc 'Removes output file'
19
- task :clean do
20
- rm OUTPUT_FILE
21
- end
22
-
23
- task :default => "ci_power:export"
1
+ namespace :ci_power do
2
+ OUTPUT_FILE = 'tmp/ci_power_export.txt'
3
+
4
+ desc 'Extract data from application'
5
+ task :extract_data => :environment do
6
+ @content = CipExport.new.output.sort_by { |a| [a.group_no, a.record_type] }
7
+ end
8
+
9
+ desc 'Export data into output file'
10
+ task :export => :extract_data do
11
+ File.open(OUTPUT_FILE, "w+") do |file|
12
+ @content.each do |line|
13
+ file.puts line.to_cip
14
+ end
15
+ end
16
+ end
17
+
18
+ desc 'Removes output file'
19
+ task :clean do
20
+ rm OUTPUT_FILE
21
+ end
22
+
23
+ task :default => "ci_power:export"
24
24
  end