Class: FactPulse::VerificationSuccessResponse

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/factpulse/models/verification_success_response.rb

Overview

Successful verification response with unified data.

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 = {}) ⇒ VerificationSuccessResponse

Initializes the object

Parameters:

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

    Model attributes in the form of hash



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/factpulse/models/verification_success_response.rb', line 99

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::VerificationSuccessResponse` 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::VerificationSuccessResponse`. 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?(:'compliance_score')
    self.compliance_score = attributes[:'compliance_score']
  else
    self.compliance_score = nil
  end

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

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

  if attributes.key?(:'is_facturx')
    self.is_facturx = attributes[:'is_facturx']
  else
    self.is_facturx = false
  end

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

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

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

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

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

Instance Attribute Details

#compliance_scoreObject

Compliance score (0-100%)



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

def compliance_score
  @compliance_score
end

#compliant_fields_countObject

Number of compliant fields



29
30
31
# File 'lib/factpulse/models/verification_success_response.rb', line 29

def compliant_fields_count
  @compliant_fields_count
end

#facturx_profileObject

Returns the value of attribute facturx_profile.



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

def facturx_profile
  @facturx_profile
end

#fieldsObject

List of verified fields with values, statuses and PDF coordinates



37
38
39
# File 'lib/factpulse/models/verification_success_response.rb', line 37

def fields
  @fields
end

#is_compliantObject

True if no critical discrepancy



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

def is_compliant
  @is_compliant
end

#is_facturxObject

True if PDF contains Factur-X XML



32
33
34
# File 'lib/factpulse/models/verification_success_response.rb', line 32

def is_facturx
  @is_facturx
end

#mandatory_notesObject

Mandatory notes (PMT, PMD, AAB) with PDF location



40
41
42
# File 'lib/factpulse/models/verification_success_response.rb', line 40

def mandatory_notes
  @mandatory_notes
end

#page_dimensionsObject

Dimensions of each PDF page (width, height)



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

def page_dimensions
  @page_dimensions
end

#verified_fields_countObject

Number of verified fields



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

def verified_fields_count
  @verified_fields_count
end

#warningsObject

Non-blocking warnings



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

def warnings
  @warnings
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



70
71
72
# File 'lib/factpulse/models/verification_success_response.rb', line 70

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/factpulse/models/verification_success_response.rb', line 49

def self.attribute_map
  {
    :'is_compliant' => :'isCompliant',
    :'compliance_score' => :'complianceScore',
    :'verified_fields_count' => :'verifiedFieldsCount',
    :'compliant_fields_count' => :'compliantFieldsCount',
    :'is_facturx' => :'isFacturx',
    :'facturx_profile' => :'facturxProfile',
    :'fields' => :'fields',
    :'mandatory_notes' => :'mandatoryNotes',
    :'page_dimensions' => :'pageDimensions',
    :'warnings' => :'warnings'
  }
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



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/factpulse/models/verification_success_response.rb', line 305

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



91
92
93
94
95
# File 'lib/factpulse/models/verification_success_response.rb', line 91

def self.openapi_nullable
  Set.new([
    :'facturx_profile',
  ])
end

.openapi_typesObject

Attribute type mapping.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/factpulse/models/verification_success_response.rb', line 75

def self.openapi_types
  {
    :'is_compliant' => :'Boolean',
    :'compliance_score' => :'Float',
    :'verified_fields_count' => :'Integer',
    :'compliant_fields_count' => :'Integer',
    :'is_facturx' => :'Boolean',
    :'facturx_profile' => :'String',
    :'fields' => :'Array<VerifiedFieldSchema>',
    :'mandatory_notes' => :'Array<MandatoryNoteSchema>',
    :'page_dimensions' => :'Array<PageDimensionsSchema>',
    :'warnings' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/factpulse/models/verification_success_response.rb', line 275

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      is_compliant == o.is_compliant &&
      compliance_score == o.compliance_score &&
      verified_fields_count == o.verified_fields_count &&
      compliant_fields_count == o.compliant_fields_count &&
      is_facturx == o.is_facturx &&
      facturx_profile == o.facturx_profile &&
      fields == o.fields &&
      mandatory_notes == o.mandatory_notes &&
      page_dimensions == o.page_dimensions &&
      warnings == o.warnings
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


292
293
294
# File 'lib/factpulse/models/verification_success_response.rb', line 292

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



298
299
300
# File 'lib/factpulse/models/verification_success_response.rb', line 298

def hash
  [is_compliant, compliance_score, verified_fields_count, compliant_fields_count, is_facturx, facturx_profile, fields, mandatory_notes, page_dimensions, warnings].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/factpulse/models/verification_success_response.rb', line 174

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 @compliance_score.nil?
    invalid_properties.push('invalid value for "compliance_score", compliance_score cannot be nil.')
  end

  if @compliance_score > 100.0
    invalid_properties.push('invalid value for "compliance_score", must be smaller than or equal to 100.0.')
  end

  if @compliance_score < 0.0
    invalid_properties.push('invalid value for "compliance_score", must be greater than or equal to 0.0.')
  end

  if !@verified_fields_count.nil? && @verified_fields_count < 0
    invalid_properties.push('invalid value for "verified_fields_count", must be greater than or equal to 0.')
  end

  if !@compliant_fields_count.nil? && @compliant_fields_count < 0
    invalid_properties.push('invalid value for "compliant_fields_count", must be greater than or equal to 0.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/factpulse/models/verification_success_response.rb', line 327

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



206
207
208
209
210
211
212
213
214
215
# File 'lib/factpulse/models/verification_success_response.rb', line 206

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @is_compliant.nil?
  return false if @compliance_score.nil?
  return false if @compliance_score > 100.0
  return false if @compliance_score < 0.0
  return false if !@verified_fields_count.nil? && @verified_fields_count < 0
  return false if !@compliant_fields_count.nil? && @compliant_fields_count < 0
  true
end