Class: NuvemfiscalSdkRuby::MdfeSefazInfPag

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

Overview

Informações do Pagamento do Frete.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MdfeSefazInfPag

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
189
190
191
192
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 116

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#cnpjObject

Número do CNPJ do responsável pelo pgto. Informar os zeros não significativos.



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

def cnpj
  @cnpj
end

#compObject

Returns the value of attribute comp.



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

def comp
  @comp
end

#cpfObject

Número do CPF do responsável pelo pgto. Informar os zeros não significativos.



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

def cpf
  @cpf
end

#id_estrangeiroObject

Identificador do responsável pelo pgto em caso de ser estrangeiro.



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

def id_estrangeiro
  @id_estrangeiro
end

#ind_alto_desempObject

Indicador de operação de transporte de alto desempenho. Operação de transporte com utilização de veículos de frotas dedicadas ou fidelizadas. Preencher com “1” para indicar operação de transporte de alto desempenho, demais casos não informar a tag.



37
38
39
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 37

def ind_alto_desemp
  @ind_alto_desemp
end

#ind_antecipa_adiantObject

Indicador para declarar concordância em antecipar o adiantamento. Informar a tag somente se for autorizado antecipar o adiantamento.



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

def ind_antecipa_adiant
  @ind_antecipa_adiant
end

#ind_pagObject

Indicador da Forma de Pagamento:0-Pagamento à Vista * 1 - Pagamento à Prazo



40
41
42
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 40

def ind_pag
  @ind_pag
end

#inf_bancObject

Returns the value of attribute inf_banc.



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

def inf_banc
  @inf_banc
end

#inf_prazoObject

Returns the value of attribute inf_prazo.



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

def inf_prazo
  @inf_prazo
end

#tp_antecipObject

Tipo de Permissão em relação a antecipação das parcelas. * 0 - Não permite antecipar * 1 - Permite antecipar as parcelas * 2 - Permite antecipar as parcelas mediante confirmação



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

def tp_antecip
  @tp_antecip
end

#v_adiantObject

Valor do Adiantamento (usar apenas em pagamento à Prazo.



43
44
45
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 43

def v_adiant
  @v_adiant
end

#v_contratoObject

Valor Total do Contrato.



34
35
36
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 34

def v_contrato
  @v_contrato
end

#x_nomeObject

Razão social ou Nome do respnsável pelo pagamento.



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

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



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 375

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/mdfe_sefaz_inf_pag.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/mdfe_sefaz_inf_pag.rb', line 56

def self.attribute_map
  {
    :'x_nome' => :'xNome',
    :'cpf' => :'CPF',
    :'cnpj' => :'CNPJ',
    :'id_estrangeiro' => :'idEstrangeiro',
    :'comp' => :'Comp',
    :'v_contrato' => :'vContrato',
    :'ind_alto_desemp' => :'indAltoDesemp',
    :'ind_pag' => :'indPag',
    :'v_adiant' => :'vAdiant',
    :'ind_antecipa_adiant' => :'indAntecipaAdiant',
    :'inf_prazo' => :'infPrazo',
    :'tp_antecip' => :'tpAntecip',
    :'inf_banc' => :'infBanc'
  }
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



351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 351

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/mdfe_sefaz_inf_pag.rb', line 99

def self.openapi_nullable
  Set.new([
    :'x_nome',
    :'cpf',
    :'cnpj',
    :'id_estrangeiro',
    :'v_contrato',
    :'ind_alto_desemp',
    :'ind_pag',
    :'v_adiant',
    :'ind_antecipa_adiant',
    :'tp_antecip',
  ])
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/mdfe_sefaz_inf_pag.rb', line 80

def self.openapi_types
  {
    :'x_nome' => :'String',
    :'cpf' => :'String',
    :'cnpj' => :'String',
    :'id_estrangeiro' => :'String',
    :'comp' => :'Array<MdfeSefazComp>',
    :'v_contrato' => :'Float',
    :'ind_alto_desemp' => :'Integer',
    :'ind_pag' => :'Integer',
    :'v_adiant' => :'Float',
    :'ind_antecipa_adiant' => :'Integer',
    :'inf_prazo' => :'Array<MdfeSefazInfPrazo>',
    :'tp_antecip' => :'Integer',
    :'inf_banc' => :'MdfeSefazInfBanc'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 318

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      x_nome == o.x_nome &&
      cpf == o.cpf &&
      cnpj == o.cnpj &&
      id_estrangeiro == o.id_estrangeiro &&
      comp == o.comp &&
      v_contrato == o.v_contrato &&
      ind_alto_desemp == o.ind_alto_desemp &&
      ind_pag == o.ind_pag &&
      v_adiant == o.v_adiant &&
      ind_antecipa_adiant == o.ind_antecipa_adiant &&
      inf_prazo == o.inf_prazo &&
      tp_antecip == o.tp_antecip &&
      inf_banc == o.inf_banc
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



446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 446

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


338
339
340
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 338

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



344
345
346
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 344

def hash
  [x_nome, cpf, cnpj, id_estrangeiro, comp, v_contrato, ind_alto_desemp, ind_pag, v_adiant, ind_antecipa_adiant, inf_prazo, tp_antecip, inf_banc].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

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

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

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

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

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

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

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

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



422
423
424
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 422

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



428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 428

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



416
417
418
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 416

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



240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_inf_pag.rb', line 240

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@x_nome.nil? && @x_nome.to_s.length > 60
  return false if !@x_nome.nil? && @x_nome.to_s.length < 2
  return false if !@id_estrangeiro.nil? && @id_estrangeiro.to_s.length > 20
  return false if !@id_estrangeiro.nil? && @id_estrangeiro.to_s.length < 2
  return false if @comp.nil?
  return false if @comp.length < 1
  return false if @v_contrato < 0
  return false if !@v_adiant.nil? && @v_adiant < 0
  return false if @inf_banc.nil?
  true
end