Class: NuvemfiscalSdkRuby::MdfeSefazAquav

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

Overview

Informações do modal Aquaviário.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MdfeSefazAquav

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 118

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#c_embarObject

Código da embarcação.



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

def c_embar
  @c_embar
end

#c_prt_destObject

Código do Porto de Destino. Preencher de acordo com Tabela de Portos definida no Ministério dos Transportes.



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

def c_prt_dest
  @c_prt_dest
end

#c_prt_embObject

Código do Porto de Embarque. Preencher de acordo com Tabela de Portos definida no Ministério dos Transportes.



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

def c_prt_emb
  @c_prt_emb
end

#inf_emb_combObject

Returns the value of attribute inf_emb_comb.



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

def inf_emb_comb
  @inf_emb_comb
end

#inf_term_carregObject

Returns the value of attribute inf_term_carreg.



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

def inf_term_carreg
  @inf_term_carreg
end

#inf_term_descarregObject

Returns the value of attribute inf_term_descarreg.



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

def inf_term_descarreg
  @inf_term_descarreg
end

#inf_unid_carga_vaziaObject

Returns the value of attribute inf_unid_carga_vazia.



52
53
54
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 52

def inf_unid_carga_vazia
  @inf_unid_carga_vazia
end

#inf_unid_transp_vaziaObject

Returns the value of attribute inf_unid_transp_vazia.



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

def inf_unid_transp_vazia
  @inf_unid_transp_vazia
end

#irinObject

Irin do navio sempre deverá ser informado.



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

def irin
  @irin
end

#n_viagObject

Número da Viagem.



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

def n_viag
  @n_viag
end

#prt_transObject

Porto de Transbordo.



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

def prt_trans
  @prt_trans
end

#tp_embObject

Código do tipo de embarcação. Preencher com código da Tabela de Tipo de Embarcação definida no Ministério dos Transportes.



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

def tp_emb
  @tp_emb
end

#tp_navObject

Tipo de Navegação. Preencher com: * 0 - Interior * 1 - Cabotagem



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

def tp_nav
  @tp_nav
end

#x_embarObject

Nome da embarcação.



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

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



488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 488

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



77
78
79
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 77

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 57

def self.attribute_map
  {
    :'irin' => :'irin',
    :'tp_emb' => :'tpEmb',
    :'c_embar' => :'cEmbar',
    :'x_embar' => :'xEmbar',
    :'n_viag' => :'nViag',
    :'c_prt_emb' => :'cPrtEmb',
    :'c_prt_dest' => :'cPrtDest',
    :'prt_trans' => :'prtTrans',
    :'tp_nav' => :'tpNav',
    :'inf_term_carreg' => :'infTermCarreg',
    :'inf_term_descarreg' => :'infTermDescarreg',
    :'inf_emb_comb' => :'infEmbComb',
    :'inf_unid_carga_vazia' => :'infUnidCargaVazia',
    :'inf_unid_transp_vazia' => :'infUnidTranspVazia'
  }
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



464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 464

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



102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 102

def self.openapi_nullable
  Set.new([
    :'irin',
    :'tp_emb',
    :'c_embar',
    :'x_embar',
    :'n_viag',
    :'c_prt_emb',
    :'c_prt_dest',
    :'prt_trans',
    :'tp_nav',
  ])
end

.openapi_typesObject

Attribute type mapping.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 82

def self.openapi_types
  {
    :'irin' => :'String',
    :'tp_emb' => :'String',
    :'c_embar' => :'String',
    :'x_embar' => :'String',
    :'n_viag' => :'String',
    :'c_prt_emb' => :'String',
    :'c_prt_dest' => :'String',
    :'prt_trans' => :'String',
    :'tp_nav' => :'Integer',
    :'inf_term_carreg' => :'Array<MdfeSefazInfTermCarreg>',
    :'inf_term_descarreg' => :'Array<MdfeSefazInfTermDescarreg>',
    :'inf_emb_comb' => :'Array<MdfeSefazInfEmbComb>',
    :'inf_unid_carga_vazia' => :'Array<MdfeSefazInfUnidCargaVazia>',
    :'inf_unid_transp_vazia' => :'Array<MdfeSefazInfUnidTranspVazia>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 430

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      irin == o.irin &&
      tp_emb == o.tp_emb &&
      c_embar == o.c_embar &&
      x_embar == o.x_embar &&
      n_viag == o.n_viag &&
      c_prt_emb == o.c_prt_emb &&
      c_prt_dest == o.c_prt_dest &&
      prt_trans == o.prt_trans &&
      tp_nav == o.tp_nav &&
      inf_term_carreg == o.inf_term_carreg &&
      inf_term_descarreg == o.inf_term_descarreg &&
      inf_emb_comb == o.inf_emb_comb &&
      inf_unid_carga_vazia == o.inf_unid_carga_vazia &&
      inf_unid_transp_vazia == o.inf_unid_transp_vazia
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



559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 559

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


451
452
453
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 451

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



457
458
459
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 457

def hash
  [irin, tp_emb, c_embar, x_embar, n_viag, c_prt_emb, c_prt_dest, prt_trans, tp_nav, inf_term_carreg, inf_term_descarreg, inf_emb_comb, inf_unid_carga_vazia, inf_unid_transp_vazia].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
259
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/mdfe_sefaz_aquav.rb', line 214

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if !@inf_emb_comb.nil? && @inf_emb_comb.length > 30
    invalid_properties.push('invalid value for "inf_emb_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



535
536
537
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 535

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



541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 541

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



529
530
531
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 529

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



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_aquav.rb', line 282

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @irin.to_s.length > 10
  return false if @irin.to_s.length < 1
  return false if @c_embar.to_s.length > 10
  return false if @c_embar.to_s.length < 1
  return false if @x_embar.to_s.length > 60
  return false if @x_embar.to_s.length < 1
  return false if @c_prt_emb.to_s.length > 5
  return false if @c_prt_emb.to_s.length < 1
  return false if @c_prt_dest.to_s.length > 5
  return false if @c_prt_dest.to_s.length < 1
  return false if !@prt_trans.nil? && @prt_trans.to_s.length > 60
  return false if !@prt_trans.nil? && @prt_trans.to_s.length < 1
  return false if !@inf_term_carreg.nil? && @inf_term_carreg.length > 5
  return false if !@inf_term_descarreg.nil? && @inf_term_descarreg.length > 5
  return false if !@inf_emb_comb.nil? && @inf_emb_comb.length > 30
  true
end