Class: NuvemfiscalSdkRuby::DistribuicaoNfe

Inherits:
Object
  • Object
show all
Defined in:
lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DistribuicaoNfe

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 148

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `NuvemfiscalSdkRuby::DistribuicaoNfe` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `NuvemfiscalSdkRuby::DistribuicaoNfe`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#ambienteObject

Identificação do Ambiente.



28
29
30
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 28

def ambiente
  @ambiente
end

#codigo_statusObject

Código do status de processamento da requisição.



45
46
47
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 45

def codigo_status
  @codigo_status
end

#cons_chaveObject

Consulta de NF-e por chave de acesso informada. *Obrigatório quando ‘tipo_consulta` for `consChNFe`.*



42
43
44
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 42

def cons_chave
  @cons_chave
end

#cons_nsuObject

Consulta DF-e vinculado ao NSU informado. *Obrigatório quando ‘tipo_consulta` for `consNSU`.*



39
40
41
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 39

def cons_nsu
  @cons_nsu
end

#created_atObject

Data/hora em que o pedido foi criado na Nuvem Fiscal. Representado no formato <a href="en.wikipedia.org/wiki/ISO_8601" target="blank">‘ISO 8601`</a>.



22
23
24
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 22

def created_at
  @created_at
end

#data_hora_respostaObject

Data e Hora de processamento da requisição.



51
52
53
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 51

def data_hora_resposta
  @data_hora_resposta
end

#dist_nsuObject

Distribuição de conjunto de DF-e a partir do NSU informado. *Obrigatório quando ‘tipo_consulta` for `distNSU`.*



36
37
38
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 36

def dist_nsu
  @dist_nsu
end

#documentosObject

Conjunto de informações resumidas e documentos fiscais eletrônicos de interesse da pessoa ou empresa.



60
61
62
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 60

def documentos
  @documentos
end

#idObject

ID único gerado pela Nuvem Fiscal para o pedido de distribuição.



19
20
21
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 19

def id
  @id
end

#max_nsuObject

Maior NSU existente no Ambiente Nacional para o CNPJ/CPF informado.



57
58
59
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 57

def max_nsu
  @max_nsu
end

#motivo_statusObject

Descrição do status de processamento da requisição.



48
49
50
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 48

def motivo_status
  @motivo_status
end

#statusObject

Indica o status da distribuição.



25
26
27
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 25

def status
  @status
end

#tipo_consultaObject

Returns the value of attribute tipo_consulta.



33
34
35
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 33

def tipo_consulta
  @tipo_consulta
end

#uf_autorObject

Sigla da UF do autor.



31
32
33
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 31

def uf_autor
  @uf_autor
end

#ultimo_nsuObject

Último NSU pesquisado no Ambiente Nacional. Se for o caso, o solicitante pode continuar a consulta a partir deste NSU para obter novos resultados.



54
55
56
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 54

def ultimo_nsu
  @ultimo_nsu
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 391

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = NuvemfiscalSdkRuby.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



106
107
108
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 106

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 85

def self.attribute_map
  {
    :'id' => :'id',
    :'created_at' => :'created_at',
    :'status' => :'status',
    :'ambiente' => :'ambiente',
    :'uf_autor' => :'uf_autor',
    :'tipo_consulta' => :'tipo_consulta',
    :'dist_nsu' => :'dist_nsu',
    :'cons_nsu' => :'cons_nsu',
    :'cons_chave' => :'cons_chave',
    :'codigo_status' => :'codigo_status',
    :'motivo_status' => :'motivo_status',
    :'data_hora_resposta' => :'data_hora_resposta',
    :'ultimo_nsu' => :'ultimo_nsu',
    :'max_nsu' => :'max_nsu',
    :'documentos' => :'documentos'
  }
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



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 367

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



132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 132

def self.openapi_nullable
  Set.new([
    :'uf_autor',
    :'dist_nsu',
    :'cons_nsu',
    :'cons_chave',
    :'codigo_status',
    :'motivo_status',
    :'data_hora_resposta',
    :'ultimo_nsu',
    :'max_nsu',
  ])
end

.openapi_typesObject

Attribute type mapping.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 111

def self.openapi_types
  {
    :'id' => :'String',
    :'created_at' => :'Time',
    :'status' => :'String',
    :'ambiente' => :'String',
    :'uf_autor' => :'String',
    :'tipo_consulta' => :'String',
    :'dist_nsu' => :'Integer',
    :'cons_nsu' => :'Integer',
    :'cons_chave' => :'String',
    :'codigo_status' => :'Integer',
    :'motivo_status' => :'String',
    :'data_hora_resposta' => :'Time',
    :'ultimo_nsu' => :'Integer',
    :'max_nsu' => :'Integer',
    :'documentos' => :'Array<DistribuicaoNfeDocumento>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 332

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      created_at == o.created_at &&
      status == o.status &&
      ambiente == o.ambiente &&
      uf_autor == o.uf_autor &&
      tipo_consulta == o.tipo_consulta &&
      dist_nsu == o.dist_nsu &&
      cons_nsu == o.cons_nsu &&
      cons_chave == o.cons_chave &&
      codigo_status == o.codigo_status &&
      motivo_status == o.motivo_status &&
      data_hora_resposta == o.data_hora_resposta &&
      ultimo_nsu == o.ultimo_nsu &&
      max_nsu == o.max_nsu &&
      documentos == o.documentos
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 462

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


354
355
356
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 354

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



360
361
362
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 360

def hash
  [id, created_at, status, ambiente, uf_autor, tipo_consulta, dist_nsu, cons_nsu, cons_chave, codigo_status, motivo_status, data_hora_resposta, ultimo_nsu, max_nsu, documentos].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 242

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

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

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

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

  if !@documentos.nil? && @documentos.length > 50
    invalid_properties.push('invalid value for "documentos", number of items must be less than or equal to 50.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



438
439
440
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 438

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



444
445
446
447
448
449
450
451
452
453
454
455
456
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 444

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



432
433
434
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 432

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/nuvemfiscal_sdk_ruby/models/distribuicao_nfe.rb', line 270

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["processando", "concluido", "erro"])
  return false unless status_validator.valid?(@status)
  return false if @ambiente.nil?
  ambiente_validator = EnumAttributeValidator.new('String', ["homologacao", "producao"])
  return false unless ambiente_validator.valid?(@ambiente)
  return false if @tipo_consulta.nil?
  tipo_consulta_validator = EnumAttributeValidator.new('String', ["dist-nsu", "cons-nsu", "cons-chave"])
  return false unless tipo_consulta_validator.valid?(@tipo_consulta)
  return false if !@documentos.nil? && @documentos.length > 50
  true
end