Class: NuvemfiscalSdkRuby::NfeSefazComb

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

Overview

Informar apenas para operações com combustíveis líquidos.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ NfeSefazComb

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 116

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#c_prod_anpObject

Código de produto da ANP. codificação de produtos do SIMP (www.anp.gov.br).



20
21
22
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 20

def c_prod_anp
  @c_prod_anp
end

#cideObject

Returns the value of attribute cide.



46
47
48
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 46

def cide
  @cide
end

#codifObject

Código de autorização / registro do CODIF. Informar apenas quando a UF utilizar o CODIF (Sistema de Controle do Diferimento do Imposto nas Operações com AEAC - Álcool Etílico Anidro Combustível).



38
39
40
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 38

def codif
  @codif
end

#desc_anpObject

Descrição do Produto conforme ANP. Utilizar a descrição de produtos do Sistema de Informações de Movimentação de Produtos - SIMP (www.anp.gov.br/simp/).



23
24
25
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 23

def desc_anp
  @desc_anp
end

#encerranteObject

Returns the value of attribute encerrante.



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

def encerrante
  @encerrante
end

#orig_combObject

Returns the value of attribute orig_comb.



53
54
55
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 53

def orig_comb
  @orig_comb
end

#p_bioObject

Percentual do índice de mistura do Biodiesel (B100) no Óleo Diesel B instituído pelo órgão regulamentador.



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

def p_bio
  @p_bio
end

#p_glpObject

Percentual do GLP derivado do petróleo no produto GLP (cProdANP=210203001). Informar em número decimal o percentual do GLP derivado de petróleo no produto GLP. Valores 0 a 100.



26
27
28
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 26

def p_glp
  @p_glp
end

#p_gniObject

Percentual de gás natural importado GLGNi para o produto GLP (cProdANP=210203001). Informar em número deciaml o percentual do Gás Natural Importado - GLGNi para o produto GLP. Valores de 0 a 100.



32
33
34
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 32

def p_gni
  @p_gni
end

#p_gnnObject

Percentual de gás natural nacional - GLGNn para o produto GLP (cProdANP=210203001). Informar em número decimal o percentual do Gás Natural Nacional - GLGNn para o produto GLP. Valores de 0 a 100.



29
30
31
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 29

def p_gnn
  @p_gnn
end

#q_tempObject

Quantidade de combustível faturada à temperatura ambiente. Informar quando a quantidade faturada informada no campo qCom (I10) tiver sido ajustada para uma temperatura diferente da ambiente.



41
42
43
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 41

def q_temp
  @q_temp
end

#uf_consObject

Sigla da UF de Consumo.



44
45
46
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 44

def uf_cons
  @uf_cons
end

#v_partObject

Valor de partida (cProdANP=210203001). Deve ser informado neste campo o valor por quilograma sem ICMS.



35
36
37
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 35

def v_part
  @v_part
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



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 457

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



75
76
77
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 75

def self.acceptable_attributes
  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
67
68
69
70
71
72
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 56

def self.attribute_map
  {
    :'c_prod_anp' => :'cProdANP',
    :'desc_anp' => :'descANP',
    :'p_glp' => :'pGLP',
    :'p_gnn' => :'pGNn',
    :'p_gni' => :'pGNi',
    :'v_part' => :'vPart',
    :'codif' => :'CODIF',
    :'q_temp' => :'qTemp',
    :'uf_cons' => :'UFCons',
    :'cide' => :'CIDE',
    :'encerrante' => :'encerrante',
    :'p_bio' => :'pBio',
    :'orig_comb' => :'origComb'
  }
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



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 433

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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 99

def self.openapi_nullable
  Set.new([
    :'c_prod_anp',
    :'desc_anp',
    :'p_glp',
    :'p_gnn',
    :'p_gni',
    :'v_part',
    :'codif',
    :'q_temp',
    :'uf_cons',
    :'p_bio',
  ])
end

.openapi_typesObject

Attribute type mapping.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 80

def self.openapi_types
  {
    :'c_prod_anp' => :'Integer',
    :'desc_anp' => :'String',
    :'p_glp' => :'Float',
    :'p_gnn' => :'Float',
    :'p_gni' => :'Float',
    :'v_part' => :'Float',
    :'codif' => :'String',
    :'q_temp' => :'Float',
    :'uf_cons' => :'String',
    :'cide' => :'NfeSefazCIDE',
    :'encerrante' => :'NfeSefazEncerrante',
    :'p_bio' => :'Float',
    :'orig_comb' => :'Array<NfeSefazOrigComb>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 400

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      c_prod_anp == o.c_prod_anp &&
      desc_anp == o.desc_anp &&
      p_glp == o.p_glp &&
      p_gnn == o.p_gnn &&
      p_gni == o.p_gni &&
      v_part == o.v_part &&
      codif == o.codif &&
      q_temp == o.q_temp &&
      uf_cons == o.uf_cons &&
      cide == o.cide &&
      encerrante == o.encerrante &&
      p_bio == o.p_bio &&
      orig_comb == o.orig_comb
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



528
529
530
531
532
533
534
535
536
537
538
539
540
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 528

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


420
421
422
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 420

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



426
427
428
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 426

def hash
  [c_prod_anp, desc_anp, p_glp, p_gnn, p_gni, v_part, codif, q_temp, uf_cons, cide, encerrante, p_bio, orig_comb].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 192

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @c_prod_anp > 999999999
    invalid_properties.push('invalid value for "c_prod_anp", must be smaller than or equal to 999999999.')
  end

  if @c_prod_anp < 0
    invalid_properties.push('invalid value for "c_prod_anp", must be greater than or equal to 0.')
  end

  if @desc_anp.to_s.length > 95
    invalid_properties.push('invalid value for "desc_anp", the character length must be smaller than or equal to 95.')
  end

  if @desc_anp.to_s.length < 2
    invalid_properties.push('invalid value for "desc_anp", the character length must be great than or equal to 2.')
  end

  if !@p_glp.nil? && @p_glp > 1E+2
    invalid_properties.push('invalid value for "p_glp", must be smaller than or equal to 1E+2.')
  end

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

  if !@p_gnn.nil? && @p_gnn > 1E+2
    invalid_properties.push('invalid value for "p_gnn", must be smaller than or equal to 1E+2.')
  end

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

  if !@p_gni.nil? && @p_gni > 1E+2
    invalid_properties.push('invalid value for "p_gni", must be smaller than or equal to 1E+2.')
  end

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

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

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

  if !@p_bio.nil? && @p_bio > 1E+2
    invalid_properties.push('invalid value for "p_bio", must be smaller than or equal to 1E+2.')
  end

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

  if !@orig_comb.nil? && @orig_comb.length > 30
    invalid_properties.push('invalid value for "orig_comb", number of items must be less than or equal to 30.')
  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



504
505
506
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 504

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



510
511
512
513
514
515
516
517
518
519
520
521
522
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 510

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



498
499
500
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 498

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



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/nuvemfiscal_sdk_ruby/models/nfe_sefaz_comb.rb', line 260

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @c_prod_anp > 999999999
  return false if @c_prod_anp < 0
  return false if @desc_anp.to_s.length > 95
  return false if @desc_anp.to_s.length < 2
  return false if !@p_glp.nil? && @p_glp > 1E+2
  return false if !@p_glp.nil? && @p_glp < 0
  return false if !@p_gnn.nil? && @p_gnn > 1E+2
  return false if !@p_gnn.nil? && @p_gnn < 0
  return false if !@p_gni.nil? && @p_gni > 1E+2
  return false if !@p_gni.nil? && @p_gni < 0
  return false if !@v_part.nil? && @v_part < 0
  return false if !@q_temp.nil? && @q_temp < 0
  return false if !@p_bio.nil? && @p_bio > 1E+2
  return false if !@p_bio.nil? && @p_bio <= 0
  return false if !@orig_comb.nil? && @orig_comb.length > 30
  true
end