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



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

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.



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

def categorie_tva
  @categorie_tva
end

#code_raison_reductionObject

Returns the value of attribute code_raison_reduction.



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

def code_raison_reduction
  @code_raison_reduction
end

#date_debut_periodeObject

Returns the value of attribute date_debut_periode.



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

def date_debut_periode
  @date_debut_periode
end

#date_fin_periodeObject

Returns the value of attribute date_fin_periode.



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

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

Returns the value of attribute montant_remise_ht.



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

def montant_remise_ht
  @montant_remise_ht
end

#montant_total_ligne_htObject

Returns the value of attribute montant_total_ligne_ht.



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

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.



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

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.



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

def taux_tva
  @taux_tva
end

#taux_tva_manuelObject

Returns the value of attribute taux_tva_manuel.



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

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



93
94
95
# File 'lib/factpulse/models/ligne_de_poste.rb', line 93

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



98
99
100
# File 'lib/factpulse/models/ligne_de_poste.rb', line 98

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

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



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/factpulse/models/ligne_de_poste.rb', line 352

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



124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/factpulse/models/ligne_de_poste.rb', line 124

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.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/factpulse/models/ligne_de_poste.rb', line 103

def self.openapi_types
  {
    :'numero' => :'Integer',
    :'reference' => :'String',
    :'denomination' => :'String',
    :'quantite' => :'Quantite',
    :'unite' => :'Unite',
    :'montant_unitaire_ht' => :'MontantUnitaireHt',
    :'montant_remise_ht' => :'LigneDePosteMontantRemiseHt',
    :'montant_total_ligne_ht' => :'MontantTotalLigneHt',
    :'taux_tva' => :'String',
    :'taux_tva_manuel' => :'LigneDePosteTauxTvaManuel',
    :'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



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/factpulse/models/ligne_de_poste.rb', line 317

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


339
340
341
# File 'lib/factpulse/models/ligne_de_poste.rb', line 339

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



345
346
347
# File 'lib/factpulse/models/ligne_de_poste.rb', line 345

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



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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/factpulse/models/ligne_de_poste.rb', line 374

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



255
256
257
258
259
260
261
262
263
# File 'lib/factpulse/models/ligne_de_poste.rb', line 255

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?
  true
end