Class: FactPulse::DonneesFactureSimplifiees

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

Overview

Données simplifiées de la facture (format minimal pour auto-enrichissement).

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 94

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

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

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

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

  if attributes.key?(:'echeance_jours')
    self.echeance_jours = attributes[:'echeance_jours']
  else
    self.echeance_jours = 30
  end

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

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

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

Instance Attribute Details

#commentaireObject

Returns the value of attribute commentaire.



36
37
38
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 36

def commentaire
  @commentaire
end

#dateObject

Returns the value of attribute date.



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

def date
  @date
end

#destinataireObject

Informations sur le destinataire (siret, …)



26
27
28
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 26

def destinataire
  @destinataire
end

#echeance_joursObject

Échéance en jours (défaut: 30)



34
35
36
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 34

def echeance_jours
  @echeance_jours
end

#emetteurObject

Informations sur l’émetteur (siret, iban, …)



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

def emetteur
  @emetteur
end

#lignesObject

Lignes de la facture



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

def lignes
  @lignes
end

#numeroObject

Numéro de facture unique



20
21
22
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 20

def numero
  @numero
end

#numero_bon_commandeObject

Returns the value of attribute numero_bon_commande.



38
39
40
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 38

def numero_bon_commande
  @numero_bon_commande
end

#numero_marcheObject

Returns the value of attribute numero_marche.



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

def numero_marche
  @numero_marche
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



58
59
60
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 58

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



63
64
65
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 63

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 43

def self.attribute_map
  {
    :'numero' => :'numero',
    :'emetteur' => :'emetteur',
    :'destinataire' => :'destinataire',
    :'lignes' => :'lignes',
    :'date' => :'date',
    :'echeance_jours' => :'echeance_jours',
    :'commentaire' => :'commentaire',
    :'numero_bon_commande' => :'numero_bon_commande',
    :'numero_marche' => :'numero_marche'
  }
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



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 304

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



83
84
85
86
87
88
89
90
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 83

def self.openapi_nullable
  Set.new([
    :'date',
    :'commentaire',
    :'numero_bon_commande',
    :'numero_marche'
  ])
end

.openapi_typesObject

Attribute type mapping.



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 68

def self.openapi_types
  {
    :'numero' => :'String',
    :'emetteur' => :'Hash<String, Object>',
    :'destinataire' => :'Hash<String, Object>',
    :'lignes' => :'Array<Hash<String, Object>>',
    :'date' => :'String',
    :'echeance_jours' => :'Integer',
    :'commentaire' => :'String',
    :'numero_bon_commande' => :'String',
    :'numero_marche' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 275

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      numero == o.numero &&
      emetteur == o.emetteur &&
      destinataire == o.destinataire &&
      lignes == o.lignes &&
      date == o.date &&
      echeance_jours == o.echeance_jours &&
      commentaire == o.commentaire &&
      numero_bon_commande == o.numero_bon_commande &&
      numero_marche == o.numero_marche
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


291
292
293
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 291

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



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

def hash
  [numero, emetteur, destinataire, lignes, date, echeance_jours, commentaire, numero_bon_commande, numero_marche].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

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

  if @lignes.length < 1
    invalid_properties.push('invalid value for "lignes", number of items must be greater than or equal to 1.')
  end

  if !@echeance_jours.nil? && @echeance_jours > 365
    invalid_properties.push('invalid value for "echeance_jours", must be smaller than or equal to 365.')
  end

  if !@echeance_jours.nil? && @echeance_jours < 0
    invalid_properties.push('invalid value for "echeance_jours", must be greater than or equal to 0.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 326

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



199
200
201
202
203
204
205
206
207
208
209
# File 'lib/factpulse/models/donnees_facture_simplifiees.rb', line 199

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @numero.nil?
  return false if @emetteur.nil?
  return false if @destinataire.nil?
  return false if @lignes.nil?
  return false if @lignes.length < 1
  return false if !@echeance_jours.nil? && @echeance_jours > 365
  return false if !@echeance_jours.nil? && @echeance_jours < 0
  true
end