Class: FactPulse::FactureEnrichieInfo

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

Overview

Informations sur la facture enrichie.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 83

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

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

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

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

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

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

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

Instance Attribute Details

#id_destinataireObject

Returns the value of attribute id_destinataire.



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

def id_destinataire
  @id_destinataire
end

#id_emetteurObject

Returns the value of attribute id_emetteur.



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

def id_emetteur
  @id_emetteur
end

#montant_ht_totalObject

Returns the value of attribute montant_ht_total.



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

def montant_ht_total
  @montant_ht_total
end

#montant_ttc_totalObject

Returns the value of attribute montant_ttc_total.



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

def montant_ttc_total
  @montant_ttc_total
end

#montant_tvaObject

Returns the value of attribute montant_tva.



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

def montant_tva
  @montant_tva
end

#nom_destinataireObject

Returns the value of attribute nom_destinataire.



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

def nom_destinataire
  @nom_destinataire
end

#nom_emetteurObject

Returns the value of attribute nom_emetteur.



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

def nom_emetteur
  @nom_emetteur
end

#numero_factureObject

Returns the value of attribute numero_facture.



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

def numero_facture
  @numero_facture
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



55
56
57
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 55

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 36

def self.attribute_map
  {
    :'numero_facture' => :'numero_facture',
    :'id_emetteur' => :'id_emetteur',
    :'id_destinataire' => :'id_destinataire',
    :'nom_emetteur' => :'nom_emetteur',
    :'nom_destinataire' => :'nom_destinataire',
    :'montant_ht_total' => :'montant_ht_total',
    :'montant_tva' => :'montant_tva',
    :'montant_ttc_total' => :'montant_ttc_total'
  }
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



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 310

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



74
75
76
77
78
79
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 74

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

.openapi_typesObject

Attribute type mapping.



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 60

def self.openapi_types
  {
    :'numero_facture' => :'String',
    :'id_emetteur' => :'Integer',
    :'id_destinataire' => :'Integer',
    :'nom_emetteur' => :'String',
    :'nom_destinataire' => :'String',
    :'montant_ht_total' => :'String',
    :'montant_tva' => :'String',
    :'montant_ttc_total' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 282

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      numero_facture == o.numero_facture &&
      id_emetteur == o.id_emetteur &&
      id_destinataire == o.id_destinataire &&
      nom_emetteur == o.nom_emetteur &&
      nom_destinataire == o.nom_destinataire &&
      montant_ht_total == o.montant_ht_total &&
      montant_tva == o.montant_tva &&
      montant_ttc_total == o.montant_ttc_total
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


297
298
299
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 297

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



303
304
305
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 303

def hash
  [numero_facture, id_emetteur, id_destinataire, nom_emetteur, nom_destinataire, montant_ht_total, montant_tva, montant_ttc_total].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

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

  pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  if @montant_ht_total !~ pattern
    invalid_properties.push("invalid value for \"montant_ht_total\", must conform to the pattern #{pattern}.")
  end

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

  pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  if @montant_tva !~ pattern
    invalid_properties.push("invalid value for \"montant_tva\", must conform to the pattern #{pattern}.")
  end

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

  pattern = Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  if @montant_ttc_total !~ pattern
    invalid_properties.push("invalid value for \"montant_ttc_total\", 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



332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 332

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



191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/factpulse/models/facture_enrichie_info.rb', line 191

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @numero_facture.nil?
  return false if @nom_emetteur.nil?
  return false if @nom_destinataire.nil?
  return false if @montant_ht_total.nil?
  return false if @montant_ht_total !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  return false if @montant_tva.nil?
  return false if @montant_tva !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  return false if @montant_ttc_total.nil?
  return false if @montant_ttc_total !~ Regexp.new(/^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$/)
  true
end