Class: FactPulse::References

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

Overview

Contient les références diverses de la facture (devise, type, etc.).

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
160
# File 'lib/factpulse/models/references.rb', line 107

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

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

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

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

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

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

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

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

Instance Attribute Details

#devise_factureObject

Returns the value of attribute devise_facture.



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

def devise_facture
  @devise_facture
end

#mode_paiementObject

Returns the value of attribute mode_paiement.



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

def mode_paiement
  @mode_paiement
end

#motif_exoneration_tvaObject

Returns the value of attribute motif_exoneration_tva.



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

def motif_exoneration_tva
  @motif_exoneration_tva
end

#numero_bon_commandeObject

Returns the value of attribute numero_bon_commande.



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

def numero_bon_commande
  @numero_bon_commande
end

#numero_facture_origineObject

Returns the value of attribute numero_facture_origine.



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

def numero_facture_origine
  @numero_facture_origine
end

#numero_marcheObject

Returns the value of attribute numero_marche.



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

def numero_marche
  @numero_marche
end

#type_factureObject

Returns the value of attribute type_facture.



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

def type_facture
  @type_facture
end

#type_tvaObject

Returns the value of attribute type_tva.



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

def type_tva
  @type_tva
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



72
73
74
# File 'lib/factpulse/models/references.rb', line 72

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



77
78
79
# File 'lib/factpulse/models/references.rb', line 77

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/factpulse/models/references.rb', line 58

def self.attribute_map
  {
    :'devise_facture' => :'deviseFacture',
    :'mode_paiement' => :'modePaiement',
    :'type_facture' => :'typeFacture',
    :'type_tva' => :'typeTva',
    :'numero_marche' => :'numeroMarche',
    :'motif_exoneration_tva' => :'motifExonerationTva',
    :'numero_bon_commande' => :'numeroBonCommande',
    :'numero_facture_origine' => :'numeroFactureOrigine'
  }
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



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/factpulse/models/references.rb', line 252

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



96
97
98
99
100
101
102
103
# File 'lib/factpulse/models/references.rb', line 96

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

.openapi_typesObject

Attribute type mapping.



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/factpulse/models/references.rb', line 82

def self.openapi_types
  {
    :'devise_facture' => :'String',
    :'mode_paiement' => :'ModePaiement',
    :'type_facture' => :'TypeFacture',
    :'type_tva' => :'TypeTVA',
    :'numero_marche' => :'String',
    :'motif_exoneration_tva' => :'String',
    :'numero_bon_commande' => :'String',
    :'numero_facture_origine' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/factpulse/models/references.rb', line 224

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      devise_facture == o.devise_facture &&
      mode_paiement == o.mode_paiement &&
      type_facture == o.type_facture &&
      type_tva == o.type_tva &&
      numero_marche == o.numero_marche &&
      motif_exoneration_tva == o.motif_exoneration_tva &&
      numero_bon_commande == o.numero_bon_commande &&
      numero_facture_origine == o.numero_facture_origine
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


239
240
241
# File 'lib/factpulse/models/references.rb', line 239

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



245
246
247
# File 'lib/factpulse/models/references.rb', line 245

def hash
  [devise_facture, mode_paiement, type_facture, type_tva, numero_marche, motif_exoneration_tva, numero_bon_commande, numero_facture_origine].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/factpulse/models/references.rb', line 164

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

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

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



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

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



184
185
186
187
188
189
190
# File 'lib/factpulse/models/references.rb', line 184

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