Class: FactPulse::FactureFacturX

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

Overview

Modèle de données pour une facture destinée à être convertie en Factur-X.

Defined Under Namespace

Classes: EnumAttributeValidator

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#beneficiaireObject

Returns the value of attribute beneficiaire.



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

def beneficiaire
  @beneficiaire
end

#cadre_de_facturationObject

Returns the value of attribute cadre_de_facturation.



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

def cadre_de_facturation
  @cadre_de_facturation
end

#commentaireObject

Returns the value of attribute commentaire.



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

def commentaire
  @commentaire
end

#date_echeance_paiementObject

Returns the value of attribute date_echeance_paiement.



21
22
23
# File 'lib/factpulse/models/facture_factur_x.rb', line 21

def date_echeance_paiement
  @date_echeance_paiement
end

#date_factureObject

Returns the value of attribute date_facture.



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

def date_facture
  @date_facture
end

#destinataireObject

Returns the value of attribute destinataire.



27
28
29
# File 'lib/factpulse/models/facture_factur_x.rb', line 27

def destinataire
  @destinataire
end

#fournisseurObject

Returns the value of attribute fournisseur.



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

def fournisseur
  @fournisseur
end

#id_utilisateur_courantObject

Returns the value of attribute id_utilisateur_courant.



45
46
47
# File 'lib/factpulse/models/facture_factur_x.rb', line 45

def id_utilisateur_courant
  @id_utilisateur_courant
end

#lignes_de_posteObject

Returns the value of attribute lignes_de_poste.



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

def lignes_de_poste
  @lignes_de_poste
end

#lignes_de_tvaObject

Returns the value of attribute lignes_de_tva.



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

def lignes_de_tva
  @lignes_de_tva
end

#mode_depotObject

Returns the value of attribute mode_depot.



25
26
27
# File 'lib/factpulse/models/facture_factur_x.rb', line 25

def mode_depot
  @mode_depot
end

#montant_totalObject

Returns the value of attribute montant_total.



35
36
37
# File 'lib/factpulse/models/facture_factur_x.rb', line 35

def montant_total
  @montant_total
end

#notesObject

Returns the value of attribute notes.



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

def notes
  @notes
end

#numero_factureObject

Returns the value of attribute numero_facture.



19
20
21
# File 'lib/factpulse/models/facture_factur_x.rb', line 19

def numero_facture
  @numero_facture
end

#pieces_jointes_complementairesObject

Returns the value of attribute pieces_jointes_complementaires.



47
48
49
# File 'lib/factpulse/models/facture_factur_x.rb', line 47

def pieces_jointes_complementaires
  @pieces_jointes_complementaires
end

#referencesObject

Returns the value of attribute references.



33
34
35
# File 'lib/factpulse/models/facture_factur_x.rb', line 33

def references
  @references
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



96
97
98
# File 'lib/factpulse/models/facture_factur_x.rb', line 96

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



101
102
103
# File 'lib/factpulse/models/facture_factur_x.rb', line 101

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/factpulse/models/facture_factur_x.rb', line 74

def self.attribute_map
  {
    :'numero_facture' => :'numeroFacture',
    :'date_echeance_paiement' => :'dateEcheancePaiement',
    :'date_facture' => :'dateFacture',
    :'mode_depot' => :'modeDepot',
    :'destinataire' => :'destinataire',
    :'fournisseur' => :'fournisseur',
    :'cadre_de_facturation' => :'cadreDeFacturation',
    :'references' => :'references',
    :'montant_total' => :'montantTotal',
    :'lignes_de_poste' => :'lignesDePoste',
    :'lignes_de_tva' => :'lignesDeTva',
    :'notes' => :'notes',
    :'commentaire' => :'commentaire',
    :'id_utilisateur_courant' => :'idUtilisateurCourant',
    :'pieces_jointes_complementaires' => :'piecesJointesComplementaires',
    :'beneficiaire' => :'beneficiaire'
  }
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



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/factpulse/models/facture_factur_x.rb', line 415

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



128
129
130
131
132
133
134
135
# File 'lib/factpulse/models/facture_factur_x.rb', line 128

def self.openapi_nullable
  Set.new([
    :'commentaire',
    :'id_utilisateur_courant',
    :'pieces_jointes_complementaires',
    :'beneficiaire'
  ])
end

.openapi_typesObject

Attribute type mapping.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/factpulse/models/facture_factur_x.rb', line 106

def self.openapi_types
  {
    :'numero_facture' => :'String',
    :'date_echeance_paiement' => :'String',
    :'date_facture' => :'String',
    :'mode_depot' => :'ModeDepot',
    :'destinataire' => :'Destinataire',
    :'fournisseur' => :'Fournisseur',
    :'cadre_de_facturation' => :'CadreDeFacturation',
    :'references' => :'References',
    :'montant_total' => :'MontantTotal',
    :'lignes_de_poste' => :'Array<LigneDePoste>',
    :'lignes_de_tva' => :'Array<LigneDeTVA>',
    :'notes' => :'Array<Note>',
    :'commentaire' => :'String',
    :'id_utilisateur_courant' => :'Integer',
    :'pieces_jointes_complementaires' => :'Array<PieceJointeComplementaire>',
    :'beneficiaire' => :'Beneficiaire'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/factpulse/models/facture_factur_x.rb', line 379

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      numero_facture == o.numero_facture &&
      date_echeance_paiement == o.date_echeance_paiement &&
      date_facture == o.date_facture &&
      mode_depot == o.mode_depot &&
      destinataire == o.destinataire &&
      fournisseur == o.fournisseur &&
      cadre_de_facturation == o.cadre_de_facturation &&
      references == o.references &&
      montant_total == o.montant_total &&
      lignes_de_poste == o.lignes_de_poste &&
      lignes_de_tva == o.lignes_de_tva &&
      notes == o.notes &&
      commentaire == o.commentaire &&
      id_utilisateur_courant == o.id_utilisateur_courant &&
      pieces_jointes_complementaires == o.pieces_jointes_complementaires &&
      beneficiaire == o.beneficiaire
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


402
403
404
# File 'lib/factpulse/models/facture_factur_x.rb', line 402

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



408
409
410
# File 'lib/factpulse/models/facture_factur_x.rb', line 408

def hash
  [numero_facture, date_echeance_paiement, date_facture, mode_depot, destinataire, fournisseur, cadre_de_facturation, references, montant_total, lignes_de_poste, lignes_de_tva, notes, commentaire, id_utilisateur_courant, pieces_jointes_complementaires, beneficiaire].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

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

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

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

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

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

  if @montant_total.nil?
    invalid_properties.push('invalid value for "montant_total", montant_total 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



437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/factpulse/models/facture_factur_x.rb', line 437

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



284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/factpulse/models/facture_factur_x.rb', line 284

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @numero_facture.nil?
  return false if @date_echeance_paiement.nil?
  return false if @mode_depot.nil?
  return false if @destinataire.nil?
  return false if @fournisseur.nil?
  return false if @cadre_de_facturation.nil?
  return false if @references.nil?
  return false if @montant_total.nil?
  true
end