Class: FactPulse::LigneDeTVA

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

Overview

Représente une ligne de totalisation par taux de TVA. Pour les exonérations (catégories E, AE, K, G, O), les champs ‘motif_exoneration` et `code_vatex` sont requis selon EN16931.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

Instance Attribute Details

#categorieObject

Returns the value of attribute categorie.



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

def categorie
  @categorie
end

#code_vatexObject

Returns the value of attribute code_vatex.



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

def code_vatex
  @code_vatex
end

#montant_base_htObject

Returns the value of attribute montant_base_ht.



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

def montant_base_ht
  @montant_base_ht
end

#montant_tvaObject

Returns the value of attribute montant_tva.



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

def montant_tva
  @montant_tva
end

#motif_exonerationObject

Returns the value of attribute motif_exoneration.



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

def motif_exoneration
  @motif_exoneration
end

#tauxObject

Returns the value of attribute taux.



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

def taux
  @taux
end

#taux_manuelObject

Returns the value of attribute taux_manuel.



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

def taux_manuel
  @taux_manuel
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



69
70
71
# File 'lib/factpulse/models/ligne_de_tva.rb', line 69

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/factpulse/models/ligne_de_tva.rb', line 56

def self.attribute_map
  {
    :'montant_base_ht' => :'montantBaseHt',
    :'montant_tva' => :'montantTva',
    :'taux' => :'taux',
    :'taux_manuel' => :'tauxManuel',
    :'categorie' => :'categorie',
    :'motif_exoneration' => :'motifExoneration',
    :'code_vatex' => :'codeVatex'
  }
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



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/factpulse/models/ligne_de_tva.rb', line 224

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



92
93
94
95
96
97
98
99
# File 'lib/factpulse/models/ligne_de_tva.rb', line 92

def self.openapi_nullable
  Set.new([
    :'taux',
    :'categorie',
    :'motif_exoneration',
    :'code_vatex'
  ])
end

.openapi_typesObject

Attribute type mapping.



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/factpulse/models/ligne_de_tva.rb', line 79

def self.openapi_types
  {
    :'montant_base_ht' => :'MontantBaseHt',
    :'montant_tva' => :'MontantTvaLigne',
    :'taux' => :'String',
    :'taux_manuel' => :'Tauxmanuel',
    :'categorie' => :'CategorieTVA',
    :'motif_exoneration' => :'String',
    :'code_vatex' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



197
198
199
200
201
202
203
204
205
206
207
# File 'lib/factpulse/models/ligne_de_tva.rb', line 197

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      montant_base_ht == o.montant_base_ht &&
      montant_tva == o.montant_tva &&
      taux == o.taux &&
      taux_manuel == o.taux_manuel &&
      categorie == o.categorie &&
      motif_exoneration == o.motif_exoneration &&
      code_vatex == o.code_vatex
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


211
212
213
# File 'lib/factpulse/models/ligne_de_tva.rb', line 211

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



217
218
219
# File 'lib/factpulse/models/ligne_de_tva.rb', line 217

def hash
  [montant_base_ht, montant_tva, taux, taux_manuel, categorie, motif_exoneration, code_vatex].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/factpulse/models/ligne_de_tva.rb', line 152

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

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



246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/factpulse/models/ligne_de_tva.rb', line 246

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



168
169
170
171
172
173
# File 'lib/factpulse/models/ligne_de_tva.rb', line 168

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @montant_base_ht.nil?
  return false if @montant_tva.nil?
  true
end