Class: FactPulse::LigneDePoste

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

Overview

Représente une ligne de détail dans une facture.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#categorie_tvaObject

Returns the value of attribute categorie_tva.



42
43
44
# File 'lib/factpulse/models/ligne_de_poste.rb', line 42

def categorie_tva
  @categorie_tva
end

#code_raison_reductionObject

Returns the value of attribute code_raison_reduction.



48
49
50
# File 'lib/factpulse/models/ligne_de_poste.rb', line 48

def code_raison_reduction
  @code_raison_reduction
end

#date_debut_periodeObject

Returns the value of attribute date_debut_periode.



44
45
46
# File 'lib/factpulse/models/ligne_de_poste.rb', line 44

def date_debut_periode
  @date_debut_periode
end

#date_fin_periodeObject

Returns the value of attribute date_fin_periode.



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

def date_fin_periode
  @date_fin_periode
end

#denominationObject

Returns the value of attribute denomination.



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

def denomination
  @denomination
end

#montant_remise_htObject

Montant de la remise HT.



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

def montant_remise_ht
  @montant_remise_ht
end

#montant_total_ligne_htObject

Montant total HT de la ligne (quantité × prix unitaire - remise).



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

def montant_total_ligne_ht
  @montant_total_ligne_ht
end

#montant_unitaire_htObject

Returns the value of attribute montant_unitaire_ht.



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

def montant_unitaire_ht
  @montant_unitaire_ht
end

#numeroObject

Returns the value of attribute numero.



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

def numero
  @numero
end

#quantiteObject

Returns the value of attribute quantite.



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

def quantite
  @quantite
end

#raison_reductionObject

Returns the value of attribute raison_reduction.



50
51
52
# File 'lib/factpulse/models/ligne_de_poste.rb', line 50

def raison_reduction
  @raison_reduction
end

#referenceObject

Returns the value of attribute reference.



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

def reference
  @reference
end

#taux_tvaObject

Returns the value of attribute taux_tva.



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

def taux_tva
  @taux_tva
end

#taux_tva_manuelObject

Taux de TVA avec valeur manuelle.



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

def taux_tva_manuel
  @taux_tva_manuel
end

#uniteObject

Returns the value of attribute unite.



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

def unite
  @unite
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



96
97
98
# File 'lib/factpulse/models/ligne_de_poste.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/ligne_de_poste.rb', line 101

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'numero' => :'numero',
    :'reference' => :'reference',
    :'denomination' => :'denomination',
    :'quantite' => :'quantite',
    :'unite' => :'unite',
    :'montant_unitaire_ht' => :'montantUnitaireHt',
    :'montant_remise_ht' => :'montantRemiseHt',
    :'montant_total_ligne_ht' => :'montantTotalLigneHt',
    :'taux_tva' => :'tauxTva',
    :'taux_tva_manuel' => :'tauxTvaManuel',
    :'categorie_tva' => :'categorieTva',
    :'date_debut_periode' => :'dateDebutPeriode',
    :'date_fin_periode' => :'dateFinPeriode',
    :'code_raison_reduction' => :'codeRaisonReduction',
    :'raison_reduction' => :'raisonReduction'
  }
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



410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/factpulse/models/ligne_de_poste.rb', line 410

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



127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/factpulse/models/ligne_de_poste.rb', line 127

def self.openapi_nullable
  Set.new([
    :'reference',
    :'montant_remise_ht',
    :'taux_tva',
    :'taux_tva_manuel',
    :'categorie_tva',
    :'date_debut_periode',
    :'date_fin_periode',
    :'code_raison_reduction',
    :'raison_reduction'
  ])
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
# File 'lib/factpulse/models/ligne_de_poste.rb', line 106

def self.openapi_types
  {
    :'numero' => :'Integer',
    :'reference' => :'String',
    :'denomination' => :'String',
    :'quantite' => :'Quantite',
    :'unite' => :'Unite',
    :'montant_unitaire_ht' => :'MontantUnitaireHt',
    :'montant_remise_ht' => :'Float',
    :'montant_total_ligne_ht' => :'Float',
    :'taux_tva' => :'String',
    :'taux_tva_manuel' => :'Float',
    :'categorie_tva' => :'CategorieTVA',
    :'date_debut_periode' => :'String',
    :'date_fin_periode' => :'String',
    :'code_raison_reduction' => :'CodeRaisonReduction',
    :'raison_reduction' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/factpulse/models/ligne_de_poste.rb', line 375

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      numero == o.numero &&
      reference == o.reference &&
      denomination == o.denomination &&
      quantite == o.quantite &&
      unite == o.unite &&
      montant_unitaire_ht == o.montant_unitaire_ht &&
      montant_remise_ht == o.montant_remise_ht &&
      montant_total_ligne_ht == o.montant_total_ligne_ht &&
      taux_tva == o.taux_tva &&
      taux_tva_manuel == o.taux_tva_manuel &&
      categorie_tva == o.categorie_tva &&
      date_debut_periode == o.date_debut_periode &&
      date_fin_periode == o.date_fin_periode &&
      code_raison_reduction == o.code_raison_reduction &&
      raison_reduction == o.raison_reduction
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


397
398
399
# File 'lib/factpulse/models/ligne_de_poste.rb', line 397

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



403
404
405
# File 'lib/factpulse/models/ligne_de_poste.rb', line 403

def hash
  [numero, reference, denomination, quantite, unite, montant_unitaire_ht, montant_remise_ht, montant_total_ligne_ht, taux_tva, taux_tva_manuel, categorie_tva, date_debut_periode, date_fin_periode, code_raison_reduction, raison_reduction].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

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

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

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

  pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*(?:\d{0,8}|(?=[\d.]{1,13}0*$)\d{0,8}\.\d{0,4}0*$)/)
  if !@montant_remise_ht.nil? && @montant_remise_ht !~ pattern
    invalid_properties.push("invalid value for \"montant_remise_ht\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*(?:\d{0,10}|(?=[\d.]{1,13}0*$)\d{0,10}\.\d{0,2}0*$)/)
  if !@montant_total_ligne_ht.nil? && @montant_total_ligne_ht !~ pattern
    invalid_properties.push("invalid value for \"montant_total_ligne_ht\", must conform to the pattern #{pattern}.")
  end

  pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*(?:\d{0,8}|(?=[\d.]{1,13}0*$)\d{0,8}\.\d{0,4}0*$)/)
  if !@taux_tva_manuel.nil? && @taux_tva_manuel !~ pattern
    invalid_properties.push("invalid value for \"taux_tva_manuel\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/factpulse/models/ligne_de_poste.rb', line 432

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



273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/factpulse/models/ligne_de_poste.rb', line 273

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @numero.nil?
  return false if @denomination.nil?
  return false if @quantite.nil?
  return false if @unite.nil?
  return false if @montant_unitaire_ht.nil?
  return false if !@montant_remise_ht.nil? && @montant_remise_ht !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*(?:\d{0,8}|(?=[\d.]{1,13}0*$)\d{0,8}\.\d{0,4}0*$)/)
  return false if !@montant_total_ligne_ht.nil? && @montant_total_ligne_ht !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*(?:\d{0,10}|(?=[\d.]{1,13}0*$)\d{0,10}\.\d{0,2}0*$)/)
  return false if !@taux_tva_manuel.nil? && @taux_tva_manuel !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*(?:\d{0,8}|(?=[\d.]{1,13}0*$)\d{0,8}\.\d{0,4}0*$)/)
  true
end