Class: NuvemfiscalSdkRuby::CteSefazInfNF

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

Overview

Informações das NF. Este grupo deve ser informado quando o documento originário for NF.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CteSefazInfNF

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#d_emiObject

Data de Emissão. Formato AAAA-MM-DD.



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

def d_emi
  @d_emi
end

#d_prevObject

Data prevista de entrega. Formato AAAA-MM-DD.



65
66
67
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 65

def d_prev
  @d_prev
end

#inf_unid_cargaObject

Returns the value of attribute inf_unid_carga.



67
68
69
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 67

def inf_unid_carga
  @inf_unid_carga
end

#inf_unid_transpObject

Returns the value of attribute inf_unid_transp.



69
70
71
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 69

def inf_unid_transp
  @inf_unid_transp
end

#modObject

Modelo da Nota Fiscal. Preencher com: * 01 - NF Modelo 01/1A e Avulsa * 04 - NF de Produtor



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

def mod
  @mod
end

#n_cfopObject

CFOP Predominante. CFOP da NF ou, na existência de mais de um, predominância pelo critério de valor econômico.



56
57
58
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 56

def n_cfop
  @n_cfop
end

#n_docObject

Número.



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

def n_doc
  @n_doc
end

#n_pedObject

Número do Pedido da NF.



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

def n_ped
  @n_ped
end

#n_pesoObject

Peso total em Kg.



59
60
61
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 59

def n_peso
  @n_peso
end

#n_romaObject

Número do Romaneio da NF.



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

def n_roma
  @n_roma
end

#pinObject

PIN SUFRAMA. PIN atribuído pela SUFRAMA para a operação.



62
63
64
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 62

def pin
  @pin
end

#serieObject

Série.



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

def serie
  @serie
end

#v_bcObject

Valor da Base de Cálculo do ICMS.



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

def v_bc
  @v_bc
end

#v_bcstObject

Valor da Base de Cálculo do ICMS ST.



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

def v_bcst
  @v_bcst
end

#v_icmsObject

Valor Total do ICMS.



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

def v_icms
  @v_icms
end

#v_nfObject

Valor Total da NF.



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

def v_nf
  @v_nf
end

#v_prodObject

Valor Total dos Produtos.



50
51
52
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 50

def v_prod
  @v_prod
end

#v_stObject

Valor Total do ICMS ST.



47
48
49
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 47

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



564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 564

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



96
97
98
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 96

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 72

def self.attribute_map
  {
    :'n_roma' => :'nRoma',
    :'n_ped' => :'nPed',
    :'mod' => :'mod',
    :'serie' => :'serie',
    :'n_doc' => :'nDoc',
    :'d_emi' => :'dEmi',
    :'v_bc' => :'vBC',
    :'v_icms' => :'vICMS',
    :'v_bcst' => :'vBCST',
    :'v_st' => :'vST',
    :'v_prod' => :'vProd',
    :'v_nf' => :'vNF',
    :'n_cfop' => :'nCFOP',
    :'n_peso' => :'nPeso',
    :'pin' => :'PIN',
    :'d_prev' => :'dPrev',
    :'inf_unid_carga' => :'infUnidCarga',
    :'inf_unid_transp' => :'infUnidTransp'
  }
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



540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 540

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



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 125

def self.openapi_nullable
  Set.new([
    :'n_roma',
    :'n_ped',
    :'mod',
    :'serie',
    :'n_doc',
    :'d_emi',
    :'v_bc',
    :'v_icms',
    :'v_bcst',
    :'v_st',
    :'v_prod',
    :'v_nf',
    :'n_cfop',
    :'n_peso',
    :'pin',
    :'d_prev',
  ])
end

.openapi_typesObject

Attribute type mapping.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 101

def self.openapi_types
  {
    :'n_roma' => :'String',
    :'n_ped' => :'String',
    :'mod' => :'String',
    :'serie' => :'String',
    :'n_doc' => :'String',
    :'d_emi' => :'Date',
    :'v_bc' => :'Float',
    :'v_icms' => :'Float',
    :'v_bcst' => :'Float',
    :'v_st' => :'Float',
    :'v_prod' => :'Float',
    :'v_nf' => :'Float',
    :'n_cfop' => :'String',
    :'n_peso' => :'Float',
    :'pin' => :'String',
    :'d_prev' => :'Date',
    :'inf_unid_carga' => :'Array<CteSefazUnidCarga>',
    :'inf_unid_transp' => :'Array<CteSefazUnidadeTransp>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 502

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      n_roma == o.n_roma &&
      n_ped == o.n_ped &&
      mod == o.mod &&
      serie == o.serie &&
      n_doc == o.n_doc &&
      d_emi == o.d_emi &&
      v_bc == o.v_bc &&
      v_icms == o.v_icms &&
      v_bcst == o.v_bcst &&
      v_st == o.v_st &&
      v_prod == o.v_prod &&
      v_nf == o.v_nf &&
      n_cfop == o.n_cfop &&
      n_peso == o.n_peso &&
      pin == o.pin &&
      d_prev == o.d_prev &&
      inf_unid_carga == o.inf_unid_carga &&
      inf_unid_transp == o.inf_unid_transp
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



635
636
637
638
639
640
641
642
643
644
645
646
647
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 635

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


527
528
529
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 527

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



533
534
535
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 533

def hash
  [n_roma, n_ped, mod, serie, n_doc, d_emi, v_bc, v_icms, v_bcst, v_st, v_prod, v_nf, n_cfop, n_peso, pin, d_prev, inf_unid_carga, inf_unid_transp].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 262

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@n_roma.nil? && @n_roma.to_s.length > 20
    invalid_properties.push('invalid value for "n_roma", the character length must be smaller than or equal to 20.')
  end

  if !@n_roma.nil? && @n_roma.to_s.length < 1
    invalid_properties.push('invalid value for "n_roma", the character length must be great than or equal to 1.')
  end

  if !@n_ped.nil? && @n_ped.to_s.length > 20
    invalid_properties.push('invalid value for "n_ped", the character length must be smaller than or equal to 20.')
  end

  if !@n_ped.nil? && @n_ped.to_s.length < 1
    invalid_properties.push('invalid value for "n_ped", the character length must be great than or equal to 1.')
  end

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

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

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

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

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

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

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

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

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

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

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

  if !@pin.nil? && @pin.to_s.length > 9
    invalid_properties.push('invalid value for "pin", the character length must be smaller than or equal to 9.')
  end

  if !@pin.nil? && @pin.to_s.length < 2
    invalid_properties.push('invalid value for "pin", the character length must be great than or equal to 2.')
  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



611
612
613
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 611

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



617
618
619
620
621
622
623
624
625
626
627
628
629
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 617

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



605
606
607
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 605

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



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/nuvemfiscal_sdk_ruby/models/cte_sefaz_inf_nf.rb', line 338

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@n_roma.nil? && @n_roma.to_s.length > 20
  return false if !@n_roma.nil? && @n_roma.to_s.length < 1
  return false if !@n_ped.nil? && @n_ped.to_s.length > 20
  return false if !@n_ped.nil? && @n_ped.to_s.length < 1
  return false if @serie.to_s.length > 3
  return false if @serie.to_s.length < 1
  return false if @n_doc.to_s.length > 20
  return false if @n_doc.to_s.length < 1
  return false if @v_bc < 0
  return false if @v_icms < 0
  return false if @v_bcst < 0
  return false if @v_st < 0
  return false if @v_prod < 0
  return false if @v_nf < 0
  return false if !@n_peso.nil? && @n_peso <= 0
  return false if !@pin.nil? && @pin.to_s.length > 9
  return false if !@pin.nil? && @pin.to_s.length < 2
  true
end