pki_express 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +2 -2
  3. data/.github/workflows/test.yml +22 -0
  4. data/.gitignore +27 -27
  5. data/.rspec +1 -0
  6. data/CHANGELOG.md +19 -12
  7. data/Gemfile +9 -4
  8. data/README.md +24 -24
  9. data/Rakefile +7 -1
  10. data/lib/pki_express/auth_complete_result.rb +21 -21
  11. data/lib/pki_express/auth_start_result.rb +76 -76
  12. data/lib/pki_express/authentication.rb +284 -284
  13. data/lib/pki_express/base_signer.rb +54 -54
  14. data/lib/pki_express/cades_signature.rb +89 -89
  15. data/lib/pki_express/cades_signature_starter.rb +242 -242
  16. data/lib/pki_express/check_service_result.rb +15 -15
  17. data/lib/pki_express/command_error.rb +13 -13
  18. data/lib/pki_express/commands.rb +24 -24
  19. data/lib/pki_express/digest_algorithm.rb +118 -118
  20. data/lib/pki_express/digest_algorithm_and_value.rb +30 -30
  21. data/lib/pki_express/discovery_service_result.rb +25 -25
  22. data/lib/pki_express/enum.rb +9 -9
  23. data/lib/pki_express/error_codes.rb +46 -46
  24. data/lib/pki_express/installation_not_found_error.rb +8 -8
  25. data/lib/pki_express/name.rb +47 -47
  26. data/lib/pki_express/oids.rb +30 -30
  27. data/lib/pki_express/pades_certification_level.rb +7 -7
  28. data/lib/pki_express/pades_horizontal_align.rb +9 -9
  29. data/lib/pki_express/pades_measurement_units.rb +8 -8
  30. data/lib/pki_express/pades_page_optimization.rb +50 -50
  31. data/lib/pki_express/pades_page_orientation.rb +9 -9
  32. data/lib/pki_express/pades_paper_size.rb +21 -21
  33. data/lib/pki_express/pades_signature.rb +16 -16
  34. data/lib/pki_express/pades_signature_explorer.rb +30 -30
  35. data/lib/pki_express/pades_signature_starter.rb +251 -251
  36. data/lib/pki_express/pades_signer.rb +274 -274
  37. data/lib/pki_express/pades_signer_info.rb +9 -9
  38. data/lib/pki_express/pades_size.rb +17 -17
  39. data/lib/pki_express/pades_text_horizontal_align.rb +8 -8
  40. data/lib/pki_express/pades_vertical_align.rb +9 -9
  41. data/lib/pki_express/pades_visual_auto_positioning.rb +21 -21
  42. data/lib/pki_express/pades_visual_image.rb +51 -51
  43. data/lib/pki_express/pades_visual_manual_positioning.rb +16 -16
  44. data/lib/pki_express/pades_visual_positioning.rb +27 -27
  45. data/lib/pki_express/pades_visual_rectangle.rb +74 -74
  46. data/lib/pki_express/pades_visual_representation.rb +22 -22
  47. data/lib/pki_express/pades_visual_text.rb +35 -35
  48. data/lib/pki_express/pk_algorithms.rb +157 -157
  49. data/lib/pki_express/pk_certificate.rb +61 -61
  50. data/lib/pki_express/pki_brazil_certificate_fields.rb +57 -57
  51. data/lib/pki_express/pki_brazil_certificate_types.rb +19 -19
  52. data/lib/pki_express/pki_express_config.rb +39 -26
  53. data/lib/pki_express/pki_express_operator.rb +240 -234
  54. data/lib/pki_express/pki_italy_certificate_fields.rb +15 -15
  55. data/lib/pki_express/pki_italy_certificate_types.rb +11 -11
  56. data/lib/pki_express/signature_algorithm_and_value.rb +34 -34
  57. data/lib/pki_express/signature_explorer.rb +74 -74
  58. data/lib/pki_express/signature_finisher.rb +314 -314
  59. data/lib/pki_express/signature_policy_identifier.rb +20 -20
  60. data/lib/pki_express/signature_start_result.rb +12 -12
  61. data/lib/pki_express/signature_starter.rb +116 -116
  62. data/lib/pki_express/signer.rb +151 -151
  63. data/lib/pki_express/standard_signature_policies.rb +58 -58
  64. data/lib/pki_express/timestamp_authority.rb +50 -50
  65. data/lib/pki_express/trust_service_auth_parameters.rb +20 -20
  66. data/lib/pki_express/trust_service_info.rb +37 -37
  67. data/lib/pki_express/trust_service_manager.rb +258 -258
  68. data/lib/pki_express/trust_service_session_result.rb +29 -29
  69. data/lib/pki_express/trust_service_session_types.rb +7 -7
  70. data/lib/pki_express/tsa_authentication_type.rb +14 -14
  71. data/lib/pki_express/validation_error.rb +8 -8
  72. data/lib/pki_express/validation_item.rb +43 -43
  73. data/lib/pki_express/validation_item_types.rb +103 -103
  74. data/lib/pki_express/validation_results.rb +120 -120
  75. data/lib/pki_express/version.rb +3 -3
  76. data/lib/pki_express/version_manager.rb +20 -20
  77. data/lib/pki_express.rb +69 -69
  78. data/pki_express.gemspec +26 -26
  79. data/spec/pki_express/pki_express_config_spec.rb +73 -0
  80. data/spec/pki_express/pki_express_operator_spec.rb +31 -0
  81. data/spec/spec_helper.rb +13 -0
  82. metadata +17 -9
@@ -1,275 +1,275 @@
1
- module PkiExpress
2
-
3
- class PadesSigner < Signer
4
- attr_accessor :suppress_default_visual_representation, :overwrite_original_file
5
- attr_accessor :custom_signature_field_name, :certification_level, :reason
6
-
7
- def initialize(config=PkiExpressConfig.new)
8
- super(config)
9
- @pdf_to_sign_path = nil
10
- @vr_json_path = nil
11
- @overwrite_original_file = false
12
- @version_manager = VersionManager.new
13
- @custom_signature_field_name = nil
14
- @certification_level = nil
15
- @reason = nil
16
- @suppress_default_visual_representation = false
17
- end
18
-
19
- # region set_visual_representation
20
-
21
- def visual_representation_content_raw
22
- _get_visual_representation_content_raw
23
- end
24
-
25
- def _get_visual_representation_content_raw
26
- unless @vr_json_path
27
- return nil
28
- end
29
-
30
- File.read(@vr_json_path)
31
- end
32
- private :_get_visual_representation_content_raw
33
-
34
- def visual_representation_content_raw=(content_raw)
35
- _set_visual_representation_content_raw(content_raw)
36
- end
37
-
38
- def _set_visual_representation_content_raw(content_raw)
39
- unless content_raw
40
- raise 'The provided "visual_representation" is not valid'
41
- end
42
-
43
- temp_file_path = self.create_temp_file
44
- File.open(temp_file_path, 'wb') do |f|
45
- f.write(content_raw)
46
- end
47
- @vr_json_path = temp_file_path
48
- end
49
- private :_set_visual_representation_content_raw
50
-
51
- def visual_representation_path
52
- _get_visual_representation_path
53
- end
54
-
55
- def _get_visual_representation_path
56
- @vr_json_path
57
- end
58
- private :_get_visual_representation_path
59
-
60
- def visual_representation_path=(path)
61
- _set_visual_representation_path(path)
62
- end
63
-
64
- def _set_visual_representation_path(path)
65
- unless path
66
- raise 'The provided "visual_representation_path" is not valid'
67
- end
68
- unless File.exists?(path)
69
- raise 'The provided "visual_representation_path" does not exist'
70
- end
71
- @vr_json_path = path
72
- end
73
- private :_set_visual_representation_path
74
-
75
- def visual_representation
76
- _get_visual_representation
77
- end
78
-
79
- def _get_visual_representation
80
- unless @vr_json_path
81
- return nil
82
- end
83
-
84
- content = File.read(@vr_json_path)
85
- JSON.parse(content)
86
- end
87
- private :_get_visual_representation
88
-
89
-
90
- def visual_representation=(vr)
91
- _set_visual_representation(vr)
92
- end
93
-
94
- def _set_visual_representation(vr)
95
- temp_file_path = self.create_temp_file
96
- json = JSON.pretty_generate(vr.to_model)
97
- File.open(temp_file_path, 'w') do |f|
98
- f.write(json)
99
- end
100
- @vr_json_path = temp_file_path
101
- end
102
- private :_set_visual_representation
103
-
104
- # endregion
105
-
106
- # region The "pdf_to_sign" accessors
107
-
108
- def pdf_to_sign
109
- _get_pdf_to_sign
110
- end
111
-
112
- def _get_pdf_to_sign
113
- unless @pdf_to_sign_path
114
- return nil
115
- end
116
-
117
- File.read(@pdf_to_sign_path)
118
- end
119
- private :_get_pdf_to_sign
120
-
121
- def pdf_to_sign=(content_raw)
122
- _set_pdf_to_sign(content_raw)
123
- end
124
-
125
- def _set_pdf_to_sign(content_raw)
126
- unless content_raw
127
- raise 'The provided "pdf_to_sign" is not valid'
128
- end
129
-
130
- temp_file_path = self.create_temp_file
131
- File.open(temp_file_path, 'wb') do |f|
132
- f.write(content_raw)
133
- end
134
- @pdf_to_sign_path = temp_file_path
135
- end
136
- private :_set_pdf_to_sign
137
-
138
- def pdf_to_sign_base64
139
- _get_pdf_to_sign_base64
140
- end
141
-
142
- def _get_pdf_to_sign_base64
143
- unless @pdf_to_sign_path
144
- return nil
145
- end
146
-
147
- content = File.read(@pdf_to_sign_path)
148
- Base64.encode64(content)
149
- end
150
- private :_get_pdf_to_sign_base64
151
-
152
- def pdf_to_sign_base64=(content_base64)
153
- _set_pdf_to_sign_base64(content_base64)
154
- end
155
-
156
- def _set_pdf_to_sign_base64(content_base64)
157
- unless content_base64
158
- raise 'The provided "pdf_to_sign_base64" is not valid'
159
- end
160
-
161
- begin
162
- content_raw = Base64.decode64(content_base64)
163
- rescue Error
164
- raise 'The provided "pdf_to_sign_base64" is not Base64-encoded'
165
- end
166
-
167
- _set_pdf_to_sign(content_raw)
168
- end
169
- private :_set_pdf_to_sign_base64
170
-
171
- def pdf_to_sign_path
172
- _get_pdf_to_sign_path
173
- end
174
-
175
- def _get_pdf_to_sign_path
176
- @pdf_to_sign_path
177
- end
178
- private :_get_pdf_to_sign_path
179
-
180
- def pdf_to_sign_path=(path)
181
- _set_pdf_to_sign_path(path)
182
- end
183
-
184
- def _set_pdf_to_sign_path(path)
185
- unless path
186
- raise 'The provided "pdf_to_sign_path" is not valid'
187
- end
188
- unless File.exists?(path)
189
- raise 'The provided "pdf_to_sign_path" does not exist'
190
- end
191
- @pdf_to_sign_path = path
192
- end
193
- private :_set_pdf_to_sign_path
194
-
195
- # endregion
196
-
197
- def sign(get_cert=false)
198
- unless @pdf_to_sign_path
199
- raise 'The PDF to be signed was not set'
200
- end
201
-
202
- unless @overwrite_original_file || @output_file_path
203
- raise 'The output destination was not set'
204
- end
205
-
206
- args = [
207
- @pdf_to_sign_path,
208
- ]
209
-
210
- # Logic to overwrite original file or use the output file
211
- if @overwrite_original_file
212
- args.append('--overwrite')
213
- else
214
- args.append(@output_file_path)
215
- end
216
-
217
- # Verify and add common options between signers.
218
- verify_and_add_common_options(args)
219
-
220
- if @vr_json_path
221
- args.append('--visual-rep')
222
- args.append(@vr_json_path)
223
- end
224
-
225
- if @custom_signature_field_name
226
- args.append('--custom-signature-field-name')
227
- args.append(@custom_signature_field_name)
228
- # This option can only be used on versions greater than 1.15.0 of the
229
- # PKI Express.
230
- @version_manager.require_version('1.15')
231
- end
232
-
233
- if @certification_level
234
- args.append('--certification-level')
235
- args.append(@certification_level)
236
- # This option can only be used on versions greater than 1.16.0 of the
237
- # PKI Express.
238
- @version_manager.require_version('1.16')
239
- end
240
-
241
- if @suppress_default_visual_representation
242
- args.append('--suppress-default-visual-rep')
243
- # This option can only be used on versions greater than 1.13.1 of the
244
- # PKI Express.
245
- @version_manager.require_version('1.13.1')
246
- end
247
-
248
- if @reason
249
- args.append('--reason')
250
- args.append(@reason)
251
- # This option can only be used on versions greater than 1.13 of the
252
- # PKI Express.
253
- @version_manager.require_version('1.13')
254
- end
255
-
256
- if get_cert
257
- # This option can only be used on versions greater than 1.8.0 of the
258
- # PKI Express.
259
- @version_manager.require_version('1.8')
260
-
261
- # Invoke command.
262
- result = invoke(Commands::SIGN_PADES, args)
263
-
264
- # Parse output and return result.
265
- model = parse_output(result)
266
- return PKCertificate.new(model.fetch(:signer))
267
- else
268
- # Invoke command with plain text output (to support PKI Express < 1.3)
269
- result = invoke_plain(Commands::SIGN_PADES, args)
270
- end
271
-
272
- end
273
-
274
- end
1
+ module PkiExpress
2
+
3
+ class PadesSigner < Signer
4
+ attr_accessor :suppress_default_visual_representation, :overwrite_original_file
5
+ attr_accessor :custom_signature_field_name, :certification_level, :reason
6
+
7
+ def initialize(config=PkiExpressConfig.new)
8
+ super(config)
9
+ @pdf_to_sign_path = nil
10
+ @vr_json_path = nil
11
+ @overwrite_original_file = false
12
+ @version_manager = VersionManager.new
13
+ @custom_signature_field_name = nil
14
+ @certification_level = nil
15
+ @reason = nil
16
+ @suppress_default_visual_representation = false
17
+ end
18
+
19
+ # region set_visual_representation
20
+
21
+ def visual_representation_content_raw
22
+ _get_visual_representation_content_raw
23
+ end
24
+
25
+ def _get_visual_representation_content_raw
26
+ unless @vr_json_path
27
+ return nil
28
+ end
29
+
30
+ File.read(@vr_json_path)
31
+ end
32
+ private :_get_visual_representation_content_raw
33
+
34
+ def visual_representation_content_raw=(content_raw)
35
+ _set_visual_representation_content_raw(content_raw)
36
+ end
37
+
38
+ def _set_visual_representation_content_raw(content_raw)
39
+ unless content_raw
40
+ raise 'The provided "visual_representation" is not valid'
41
+ end
42
+
43
+ temp_file_path = self.create_temp_file
44
+ File.open(temp_file_path, 'wb') do |f|
45
+ f.write(content_raw)
46
+ end
47
+ @vr_json_path = temp_file_path
48
+ end
49
+ private :_set_visual_representation_content_raw
50
+
51
+ def visual_representation_path
52
+ _get_visual_representation_path
53
+ end
54
+
55
+ def _get_visual_representation_path
56
+ @vr_json_path
57
+ end
58
+ private :_get_visual_representation_path
59
+
60
+ def visual_representation_path=(path)
61
+ _set_visual_representation_path(path)
62
+ end
63
+
64
+ def _set_visual_representation_path(path)
65
+ unless path
66
+ raise 'The provided "visual_representation_path" is not valid'
67
+ end
68
+ unless File.exists?(path)
69
+ raise 'The provided "visual_representation_path" does not exist'
70
+ end
71
+ @vr_json_path = path
72
+ end
73
+ private :_set_visual_representation_path
74
+
75
+ def visual_representation
76
+ _get_visual_representation
77
+ end
78
+
79
+ def _get_visual_representation
80
+ unless @vr_json_path
81
+ return nil
82
+ end
83
+
84
+ content = File.read(@vr_json_path)
85
+ JSON.parse(content)
86
+ end
87
+ private :_get_visual_representation
88
+
89
+
90
+ def visual_representation=(vr)
91
+ _set_visual_representation(vr)
92
+ end
93
+
94
+ def _set_visual_representation(vr)
95
+ temp_file_path = self.create_temp_file
96
+ json = JSON.pretty_generate(vr.to_model)
97
+ File.open(temp_file_path, 'w') do |f|
98
+ f.write(json)
99
+ end
100
+ @vr_json_path = temp_file_path
101
+ end
102
+ private :_set_visual_representation
103
+
104
+ # endregion
105
+
106
+ # region The "pdf_to_sign" accessors
107
+
108
+ def pdf_to_sign
109
+ _get_pdf_to_sign
110
+ end
111
+
112
+ def _get_pdf_to_sign
113
+ unless @pdf_to_sign_path
114
+ return nil
115
+ end
116
+
117
+ File.read(@pdf_to_sign_path)
118
+ end
119
+ private :_get_pdf_to_sign
120
+
121
+ def pdf_to_sign=(content_raw)
122
+ _set_pdf_to_sign(content_raw)
123
+ end
124
+
125
+ def _set_pdf_to_sign(content_raw)
126
+ unless content_raw
127
+ raise 'The provided "pdf_to_sign" is not valid'
128
+ end
129
+
130
+ temp_file_path = self.create_temp_file
131
+ File.open(temp_file_path, 'wb') do |f|
132
+ f.write(content_raw)
133
+ end
134
+ @pdf_to_sign_path = temp_file_path
135
+ end
136
+ private :_set_pdf_to_sign
137
+
138
+ def pdf_to_sign_base64
139
+ _get_pdf_to_sign_base64
140
+ end
141
+
142
+ def _get_pdf_to_sign_base64
143
+ unless @pdf_to_sign_path
144
+ return nil
145
+ end
146
+
147
+ content = File.read(@pdf_to_sign_path)
148
+ Base64.encode64(content)
149
+ end
150
+ private :_get_pdf_to_sign_base64
151
+
152
+ def pdf_to_sign_base64=(content_base64)
153
+ _set_pdf_to_sign_base64(content_base64)
154
+ end
155
+
156
+ def _set_pdf_to_sign_base64(content_base64)
157
+ unless content_base64
158
+ raise 'The provided "pdf_to_sign_base64" is not valid'
159
+ end
160
+
161
+ begin
162
+ content_raw = Base64.decode64(content_base64)
163
+ rescue Error
164
+ raise 'The provided "pdf_to_sign_base64" is not Base64-encoded'
165
+ end
166
+
167
+ _set_pdf_to_sign(content_raw)
168
+ end
169
+ private :_set_pdf_to_sign_base64
170
+
171
+ def pdf_to_sign_path
172
+ _get_pdf_to_sign_path
173
+ end
174
+
175
+ def _get_pdf_to_sign_path
176
+ @pdf_to_sign_path
177
+ end
178
+ private :_get_pdf_to_sign_path
179
+
180
+ def pdf_to_sign_path=(path)
181
+ _set_pdf_to_sign_path(path)
182
+ end
183
+
184
+ def _set_pdf_to_sign_path(path)
185
+ unless path
186
+ raise 'The provided "pdf_to_sign_path" is not valid'
187
+ end
188
+ unless File.exists?(path)
189
+ raise 'The provided "pdf_to_sign_path" does not exist'
190
+ end
191
+ @pdf_to_sign_path = path
192
+ end
193
+ private :_set_pdf_to_sign_path
194
+
195
+ # endregion
196
+
197
+ def sign(get_cert=false)
198
+ unless @pdf_to_sign_path
199
+ raise 'The PDF to be signed was not set'
200
+ end
201
+
202
+ unless @overwrite_original_file || @output_file_path
203
+ raise 'The output destination was not set'
204
+ end
205
+
206
+ args = [
207
+ @pdf_to_sign_path,
208
+ ]
209
+
210
+ # Logic to overwrite original file or use the output file
211
+ if @overwrite_original_file
212
+ args.append('--overwrite')
213
+ else
214
+ args.append(@output_file_path)
215
+ end
216
+
217
+ # Verify and add common options between signers.
218
+ verify_and_add_common_options(args)
219
+
220
+ if @vr_json_path
221
+ args.append('--visual-rep')
222
+ args.append(@vr_json_path)
223
+ end
224
+
225
+ if @custom_signature_field_name
226
+ args.append('--custom-signature-field-name')
227
+ args.append(@custom_signature_field_name)
228
+ # This option can only be used on versions greater than 1.15.0 of the
229
+ # PKI Express.
230
+ @version_manager.require_version('1.15')
231
+ end
232
+
233
+ if @certification_level
234
+ args.append('--certification-level')
235
+ args.append(@certification_level)
236
+ # This option can only be used on versions greater than 1.16.0 of the
237
+ # PKI Express.
238
+ @version_manager.require_version('1.16')
239
+ end
240
+
241
+ if @suppress_default_visual_representation
242
+ args.append('--suppress-default-visual-rep')
243
+ # This option can only be used on versions greater than 1.13.1 of the
244
+ # PKI Express.
245
+ @version_manager.require_version('1.13.1')
246
+ end
247
+
248
+ if @reason
249
+ args.append('--reason')
250
+ args.append(@reason)
251
+ # This option can only be used on versions greater than 1.13 of the
252
+ # PKI Express.
253
+ @version_manager.require_version('1.13')
254
+ end
255
+
256
+ if get_cert
257
+ # This option can only be used on versions greater than 1.8.0 of the
258
+ # PKI Express.
259
+ @version_manager.require_version('1.8')
260
+
261
+ # Invoke command.
262
+ result = invoke(Commands::SIGN_PADES, args)
263
+
264
+ # Parse output and return result.
265
+ model = parse_output(result)
266
+ return PKCertificate.new(model.fetch(:signer))
267
+ else
268
+ # Invoke command with plain text output (to support PKI Express < 1.3)
269
+ result = invoke_plain(Commands::SIGN_PADES, args)
270
+ end
271
+
272
+ end
273
+
274
+ end
275
275
  end
@@ -1,10 +1,10 @@
1
- module PkiExpress
2
- class PadesSignerInfo < CadesSignerInfo
3
- attr_accessor :is_document_timestamp, :signature_file_name
4
- def initialize(model)
5
- super(model)
6
- @is_document_timestamp = model.fetch(:isDocumentTimestamp)
7
- @signature_field_name = model.fetch(:signatureFieldName)
8
- end
9
- end
1
+ module PkiExpress
2
+ class PadesSignerInfo < CadesSignerInfo
3
+ attr_accessor :is_document_timestamp, :signature_file_name
4
+ def initialize(model)
5
+ super(model)
6
+ @is_document_timestamp = model.fetch(:isDocumentTimestamp)
7
+ @signature_field_name = model.fetch(:signatureFieldName)
8
+ end
9
+ end
10
10
  end
@@ -1,17 +1,17 @@
1
- module PkiExpress
2
- class PadesSize
3
- attr_accessor :width, :height
4
-
5
- def initialize(width, height)
6
- @width = width
7
- @height = height
8
- end
9
-
10
- def to_model
11
- {
12
- width: @width,
13
- height: @height,
14
- }
15
- end
16
- end
17
- end
1
+ module PkiExpress
2
+ class PadesSize
3
+ attr_accessor :width, :height
4
+
5
+ def initialize(width, height)
6
+ @width = width
7
+ @height = height
8
+ end
9
+
10
+ def to_model
11
+ {
12
+ width: @width,
13
+ height: @height,
14
+ }
15
+ end
16
+ end
17
+ end
@@ -1,8 +1,8 @@
1
- module PkiExpress
2
- class PadesTextHorizontalAlign < Enum
3
- LEFT = 'Left'
4
- RIGHT = 'Right'
5
-
6
- VALUES = [ LEFT, RIGHT ]
7
- end
8
- end
1
+ module PkiExpress
2
+ class PadesTextHorizontalAlign < Enum
3
+ LEFT = 'Left'
4
+ RIGHT = 'Right'
5
+
6
+ VALUES = [ LEFT, RIGHT ]
7
+ end
8
+ end
@@ -1,9 +1,9 @@
1
- module PkiExpress
2
- class PadesVerticalAlign < Enum
3
- TOP = 'Top'
4
- CENTER = 'Center'
5
- BOTTOM = 'Bottom'
6
-
7
- VALUES = [ TOP, CENTER, BOTTOM ]
8
- end
9
- end
1
+ module PkiExpress
2
+ class PadesVerticalAlign < Enum
3
+ TOP = 'Top'
4
+ CENTER = 'Center'
5
+ BOTTOM = 'Bottom'
6
+
7
+ VALUES = [ TOP, CENTER, BOTTOM ]
8
+ end
9
+ end
@@ -1,22 +1,22 @@
1
- module PkiExpress
2
- class PadesVisualAutoPositioning < PadesVisualPositioning
3
- attr_accessor :container, :signature_rectangle_size, :row_spacing
4
-
5
- def initialize(page_number=nil, measurement_units=nil, container=nil, signature_rectangle_size=nil, row_spacing=nil)
6
- super(page_number, measurement_units)
7
- @container = container
8
- @signature_rectangle_size = signature_rectangle_size
9
- @row_spacing = row_spacing
10
- end
11
-
12
- def to_model
13
- model = super
14
- model['auto'] = {
15
- 'container': @container&.to_model,
16
- 'signatureRectangleSize': @signature_rectangle_size&.to_model,
17
- 'rowSpacing': @row_spacing,
18
- }
19
- model
20
- end
21
- end
1
+ module PkiExpress
2
+ class PadesVisualAutoPositioning < PadesVisualPositioning
3
+ attr_accessor :container, :signature_rectangle_size, :row_spacing
4
+
5
+ def initialize(page_number=nil, measurement_units=nil, container=nil, signature_rectangle_size=nil, row_spacing=nil)
6
+ super(page_number, measurement_units)
7
+ @container = container
8
+ @signature_rectangle_size = signature_rectangle_size
9
+ @row_spacing = row_spacing
10
+ end
11
+
12
+ def to_model
13
+ model = super
14
+ model['auto'] = {
15
+ 'container': @container&.to_model,
16
+ 'signatureRectangleSize': @signature_rectangle_size&.to_model,
17
+ 'rowSpacing': @row_spacing,
18
+ }
19
+ model
20
+ end
21
+ end
22
22
  end