Class: FactPulse::PDFValidationResultAPI

Inherits:
ApiModelBase show all
Defined in:
lib/factpulse/models/pdf_validation_result_api.rb

Overview

Complete result of a Factur-X PDF validation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ PDFValidationResultAPI

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 164

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::PDFValidationResultAPI` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::PDFValidationResultAPI`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'is_compliant')
    self.is_compliant = attributes[:'is_compliant']
  else
    self.is_compliant = nil
  end

  if attributes.key?(:'xml_present')
    self.xml_present = attributes[:'xml_present']
  else
    self.xml_present = nil
  end

  if attributes.key?(:'xml_compliant')
    self.xml_compliant = attributes[:'xml_compliant']
  else
    self.xml_compliant = nil
  end

  if attributes.key?(:'detected_profile')
    self.detected_profile = attributes[:'detected_profile']
  end

  if attributes.key?(:'xml_errors')
    if (value = attributes[:'xml_errors']).is_a?(Array)
      self.xml_errors = value
    end
  end

  if attributes.key?(:'pdfa_compliant')
    self.pdfa_compliant = attributes[:'pdfa_compliant']
  else
    self.pdfa_compliant = nil
  end

  if attributes.key?(:'pdfa_version')
    self.pdfa_version = attributes[:'pdfa_version']
  end

  if attributes.key?(:'pdfa_validation_method')
    self.pdfa_validation_method = attributes[:'pdfa_validation_method']
  else
    self.pdfa_validation_method = 'metadata'
  end

  if attributes.key?(:'validated_rules')
    self.validated_rules = attributes[:'validated_rules']
  end

  if attributes.key?(:'failed_rules')
    self.failed_rules = attributes[:'failed_rules']
  end

  if attributes.key?(:'pdfa_errors')
    if (value = attributes[:'pdfa_errors']).is_a?(Array)
      self.pdfa_errors = value
    end
  end

  if attributes.key?(:'pdfa_warnings')
    if (value = attributes[:'pdfa_warnings']).is_a?(Array)
      self.pdfa_warnings = value
    end
  end

  if attributes.key?(:'xmp_present')
    self.xmp_present = attributes[:'xmp_present']
  else
    self.xmp_present = nil
  end

  if attributes.key?(:'xmp_facturx_compliant')
    self.xmp_facturx_compliant = attributes[:'xmp_facturx_compliant']
  else
    self.xmp_facturx_compliant = nil
  end

  if attributes.key?(:'xmp_profile')
    self.xmp_profile = attributes[:'xmp_profile']
  end

  if attributes.key?(:'xmp_version')
    self.xmp_version = attributes[:'xmp_version']
  end

  if attributes.key?(:'xmp_errors')
    if (value = attributes[:'xmp_errors']).is_a?(Array)
      self.xmp_errors = value
    end
  end

  if attributes.key?(:'xmp_metadata')
    if (value = attributes[:'xmp_metadata']).is_a?(Hash)
      self. = value
    end
  end

  if attributes.key?(:'is_signed')
    self.is_signed = attributes[:'is_signed']
  else
    self.is_signed = nil
  end

  if attributes.key?(:'signature_count')
    self.signature_count = attributes[:'signature_count']
  else
    self.signature_count = 0
  end

  if attributes.key?(:'signatures')
    if (value = attributes[:'signatures']).is_a?(Array)
      self.signatures = value
    end
  end

  if attributes.key?(:'signature_errors')
    if (value = attributes[:'signature_errors']).is_a?(Array)
      self.signature_errors = value
    end
  end

  if attributes.key?(:'summary_message')
    self.summary_message = attributes[:'summary_message']
  else
    self.summary_message = nil
  end
end

Instance Attribute Details

#detected_profileObject

Returns the value of attribute detected_profile.



28
29
30
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 28

def detected_profile
  @detected_profile
end

#failed_rulesObject

Returns the value of attribute failed_rules.



43
44
45
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 43

def failed_rules
  @failed_rules
end

#is_compliantObject

True if PDF complies with all criteria (XML, PDF/A, XMP)



20
21
22
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 20

def is_compliant
  @is_compliant
end

#is_signedObject

True if PDF contains at least one signature



68
69
70
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 68

def is_signed
  @is_signed
end

#pdfa_compliantObject

True if PDF is PDF/A compliant



34
35
36
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 34

def pdfa_compliant
  @pdfa_compliant
end

#pdfa_errorsObject

List of PDF/A compliance errors



46
47
48
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 46

def pdfa_errors
  @pdfa_errors
end

#pdfa_validation_methodObject

Method used for PDF/A validation (metadata or verapdf)



39
40
41
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 39

def pdfa_validation_method
  @pdfa_validation_method
end

#pdfa_versionObject

Returns the value of attribute pdfa_version.



36
37
38
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 36

def pdfa_version
  @pdfa_version
end

#pdfa_warningsObject

List of PDF/A warnings



49
50
51
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 49

def pdfa_warnings
  @pdfa_warnings
end

#signature_countObject

Number of electronic signatures found



71
72
73
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 71

def signature_count
  @signature_count
end

#signature_errorsObject

List of errors during signature analysis



77
78
79
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 77

def signature_errors
  @signature_errors
end

#signaturesObject

List of found signatures with their information



74
75
76
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 74

def signatures
  @signatures
end

#summary_messageObject

Message summarizing the validation result



80
81
82
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 80

def summary_message
  @summary_message
end

#validated_rulesObject

Returns the value of attribute validated_rules.



41
42
43
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 41

def validated_rules
  @validated_rules
end

#xml_compliantObject

True if Factur-X XML complies with Schematron rules



26
27
28
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 26

def xml_compliant
  @xml_compliant
end

#xml_errorsObject

List of XML validation errors



31
32
33
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 31

def xml_errors
  @xml_errors
end

#xml_presentObject

True if a Factur-X XML is embedded in the PDF



23
24
25
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 23

def xml_present
  @xml_present
end

#xmp_errorsObject

List of XMP metadata errors



62
63
64
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 62

def xmp_errors
  @xmp_errors
end

#xmp_facturx_compliantObject

True if XMP metadata contains Factur-X information



55
56
57
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 55

def xmp_facturx_compliant
  @xmp_facturx_compliant
end

#xmp_metadataObject

XMP metadata extracted from PDF



65
66
67
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 65

def 
  
end

#xmp_presentObject

True if XMP metadata is present



52
53
54
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 52

def xmp_present
  @xmp_present
end

#xmp_profileObject

Returns the value of attribute xmp_profile.



57
58
59
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 57

def xmp_profile
  @xmp_profile
end

#xmp_versionObject

Returns the value of attribute xmp_version.



59
60
61
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 59

def xmp_version
  @xmp_version
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



112
113
114
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 112

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



117
118
119
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 117

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 83

def self.attribute_map
  {
    :'is_compliant' => :'isCompliant',
    :'xml_present' => :'xmlPresent',
    :'xml_compliant' => :'xmlCompliant',
    :'detected_profile' => :'detectedProfile',
    :'xml_errors' => :'xmlErrors',
    :'pdfa_compliant' => :'pdfaCompliant',
    :'pdfa_version' => :'pdfaVersion',
    :'pdfa_validation_method' => :'pdfaValidationMethod',
    :'validated_rules' => :'validatedRules',
    :'failed_rules' => :'failedRules',
    :'pdfa_errors' => :'pdfaErrors',
    :'pdfa_warnings' => :'pdfaWarnings',
    :'xmp_present' => :'xmpPresent',
    :'xmp_facturx_compliant' => :'xmpFacturxCompliant',
    :'xmp_profile' => :'xmpProfile',
    :'xmp_version' => :'xmpVersion',
    :'xmp_errors' => :'xmpErrors',
    :'xmp_metadata' => :'xmpMetadata',
    :'is_signed' => :'isSigned',
    :'signature_count' => :'signatureCount',
    :'signatures' => :'signatures',
    :'signature_errors' => :'signatureErrors',
    :'summary_message' => :'summaryMessage'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 485

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



151
152
153
154
155
156
157
158
159
160
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 151

def self.openapi_nullable
  Set.new([
    :'detected_profile',
    :'pdfa_version',
    :'validated_rules',
    :'failed_rules',
    :'xmp_profile',
    :'xmp_version',
  ])
end

.openapi_typesObject

Attribute type mapping.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 122

def self.openapi_types
  {
    :'is_compliant' => :'Boolean',
    :'xml_present' => :'Boolean',
    :'xml_compliant' => :'Boolean',
    :'detected_profile' => :'String',
    :'xml_errors' => :'Array<String>',
    :'pdfa_compliant' => :'Boolean',
    :'pdfa_version' => :'String',
    :'pdfa_validation_method' => :'String',
    :'validated_rules' => :'Integer',
    :'failed_rules' => :'Integer',
    :'pdfa_errors' => :'Array<String>',
    :'pdfa_warnings' => :'Array<String>',
    :'xmp_present' => :'Boolean',
    :'xmp_facturx_compliant' => :'Boolean',
    :'xmp_profile' => :'String',
    :'xmp_version' => :'String',
    :'xmp_errors' => :'Array<String>',
    :'xmp_metadata' => :'Hash<String, Object>',
    :'is_signed' => :'Boolean',
    :'signature_count' => :'Integer',
    :'signatures' => :'Array<SignatureInfoAPI>',
    :'signature_errors' => :'Array<String>',
    :'summary_message' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 442

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      is_compliant == o.is_compliant &&
      xml_present == o.xml_present &&
      xml_compliant == o.xml_compliant &&
      detected_profile == o.detected_profile &&
      xml_errors == o.xml_errors &&
      pdfa_compliant == o.pdfa_compliant &&
      pdfa_version == o.pdfa_version &&
      pdfa_validation_method == o.pdfa_validation_method &&
      validated_rules == o.validated_rules &&
      failed_rules == o.failed_rules &&
      pdfa_errors == o.pdfa_errors &&
      pdfa_warnings == o.pdfa_warnings &&
      xmp_present == o.xmp_present &&
      xmp_facturx_compliant == o.xmp_facturx_compliant &&
      xmp_profile == o.xmp_profile &&
      xmp_version == o.xmp_version &&
      xmp_errors == o.xmp_errors &&
       == o. &&
      is_signed == o.is_signed &&
      signature_count == o.signature_count &&
      signatures == o.signatures &&
      signature_errors == o.signature_errors &&
      summary_message == o.summary_message
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


472
473
474
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 472

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



478
479
480
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 478

def hash
  [is_compliant, xml_present, xml_compliant, detected_profile, xml_errors, pdfa_compliant, pdfa_version, pdfa_validation_method, validated_rules, failed_rules, pdfa_errors, pdfa_warnings, xmp_present, xmp_facturx_compliant, xmp_profile, xmp_version, xmp_errors, , is_signed, signature_count, signatures, signature_errors, summary_message].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 307

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @is_compliant.nil?
    invalid_properties.push('invalid value for "is_compliant", is_compliant cannot be nil.')
  end

  if @xml_present.nil?
    invalid_properties.push('invalid value for "xml_present", xml_present cannot be nil.')
  end

  if @xml_compliant.nil?
    invalid_properties.push('invalid value for "xml_compliant", xml_compliant cannot be nil.')
  end

  if @pdfa_compliant.nil?
    invalid_properties.push('invalid value for "pdfa_compliant", pdfa_compliant cannot be nil.')
  end

  if @xmp_present.nil?
    invalid_properties.push('invalid value for "xmp_present", xmp_present cannot be nil.')
  end

  if @xmp_facturx_compliant.nil?
    invalid_properties.push('invalid value for "xmp_facturx_compliant", xmp_facturx_compliant cannot be nil.')
  end

  if @is_signed.nil?
    invalid_properties.push('invalid value for "is_signed", is_signed cannot be nil.')
  end

  if @summary_message.nil?
    invalid_properties.push('invalid value for "summary_message", summary_message cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 507

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/factpulse/models/pdf_validation_result_api.rb', line 347

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @is_compliant.nil?
  return false if @xml_present.nil?
  return false if @xml_compliant.nil?
  return false if @pdfa_compliant.nil?
  return false if @xmp_present.nil?
  return false if @xmp_facturx_compliant.nil?
  return false if @is_signed.nil?
  return false if @summary_message.nil?
  true
end