Class: NuvemfiscalSdkRuby::MdfeSefazVeicTracao
- Inherits:
-
Object
- Object
- NuvemfiscalSdkRuby::MdfeSefazVeicTracao
- Defined in:
- lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb
Overview
Dados do Veículo com a Tração.
Instance Attribute Summary collapse
-
#c_int ⇒ Object
Código interno do veículo.
-
#cap_kg ⇒ Object
Capacidade em KG.
-
#cap_m3 ⇒ Object
Capacidade em M3.
-
#condutor ⇒ Object
Returns the value of attribute condutor.
-
#placa ⇒ Object
Placa do veículo.
-
#prop ⇒ Object
Returns the value of attribute prop.
-
#renavam ⇒ Object
RENAVAM do veículo.
-
#tara ⇒ Object
Tara em KG.
-
#tp_car ⇒ Object
Tipo de Carroceria.
-
#tp_rod ⇒ Object
Tipo de Rodado.
-
#uf ⇒ Object
UF em que veículo está licenciado.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ MdfeSefazVeicTracao
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ MdfeSefazVeicTracao
Initializes the object
106 107 108 109 110 111 112 113 114 115 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 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 106 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `NuvemfiscalSdkRuby::MdfeSefazVeicTracao` 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::MdfeSefazVeicTracao`. 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_int') self.c_int = attributes[:'c_int'] end if attributes.key?(:'placa') self.placa = attributes[:'placa'] else self.placa = nil end if attributes.key?(:'renavam') self.renavam = attributes[:'renavam'] end if attributes.key?(:'tara') self.tara = attributes[:'tara'] else self.tara = nil end if attributes.key?(:'cap_kg') self.cap_kg = attributes[:'cap_kg'] end if attributes.key?(:'cap_m3') self.cap_m3 = attributes[:'cap_m3'] end if attributes.key?(:'prop') self.prop = attributes[:'prop'] end if attributes.key?(:'condutor') if (value = attributes[:'condutor']).is_a?(Array) self.condutor = value end else self.condutor = nil end if attributes.key?(:'tp_rod') self.tp_rod = attributes[:'tp_rod'] else self.tp_rod = nil end if attributes.key?(:'tp_car') self.tp_car = attributes[:'tp_car'] else self.tp_car = nil end if attributes.key?(:'uf') self.uf = attributes[:'uf'] end end |
Instance Attribute Details
#c_int ⇒ Object
Código interno do veículo.
20 21 22 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 20 def c_int @c_int end |
#cap_kg ⇒ Object
Capacidade em KG.
32 33 34 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 32 def cap_kg @cap_kg end |
#cap_m3 ⇒ Object
Capacidade em M3.
35 36 37 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 35 def cap_m3 @cap_m3 end |
#condutor ⇒ Object
Returns the value of attribute condutor.
39 40 41 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 39 def condutor @condutor end |
#placa ⇒ Object
Placa do veículo.
23 24 25 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 23 def placa @placa end |
#prop ⇒ Object
Returns the value of attribute prop.
37 38 39 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 37 def prop @prop end |
#renavam ⇒ Object
RENAVAM do veículo.
26 27 28 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 26 def renavam @renavam end |
#tara ⇒ Object
Tara em KG.
29 30 31 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 29 def tara @tara end |
#tp_car ⇒ Object
Tipo de Carroceria. Preencher com: * 00 - não aplicável * 01 - Aberta * 02 - Fechada/Baú * 03 - Granelera * 04 - Porta Container * 05 - Sider
45 46 47 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 45 def tp_car @tp_car end |
#tp_rod ⇒ Object
Tipo de Rodado. Preencher com: * 01 - Truck * 02 - Toco * 03 - Cavalo Mecânico * 04 - VAN * 05 - Utilitário * 06 - Outros
42 43 44 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 42 def tp_rod @tp_rod end |
#uf ⇒ Object
UF em que veículo está licenciado. Sigla da UF de licenciamento do veículo.
48 49 50 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 48 def uf @uf end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
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 429 430 431 432 433 434 435 436 437 438 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 401 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_attributes ⇒ Object
Returns all the JSON keys this model knows about
68 69 70 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 68 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 51 def self.attribute_map { :'c_int' => :'cInt', :'placa' => :'placa', :'renavam' => :'RENAVAM', :'tara' => :'tara', :'cap_kg' => :'capKG', :'cap_m3' => :'capM3', :'prop' => :'prop', :'condutor' => :'condutor', :'tp_rod' => :'tpRod', :'tp_car' => :'tpCar', :'uf' => :'UF' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 377 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_nullable ⇒ Object
List of attributes with nullable: true
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 90 def self.openapi_nullable Set.new([ :'c_int', :'placa', :'renavam', :'tara', :'cap_kg', :'cap_m3', :'tp_rod', :'tp_car', :'uf' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 73 def self.openapi_types { :'c_int' => :'String', :'placa' => :'String', :'renavam' => :'String', :'tara' => :'Integer', :'cap_kg' => :'Integer', :'cap_m3' => :'Integer', :'prop' => :'MdfeSefazProp', :'condutor' => :'Array<MdfeSefazCondutor>', :'tp_rod' => :'String', :'tp_car' => :'String', :'uf' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 346 def ==(o) return true if self.equal?(o) self.class == o.class && c_int == o.c_int && placa == o.placa && renavam == o.renavam && tara == o.tara && cap_kg == o.cap_kg && cap_m3 == o.cap_m3 && prop == o.prop && condutor == o.condutor && tp_rod == o.tp_rod && tp_car == o.tp_car && uf == o.uf end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
472 473 474 475 476 477 478 479 480 481 482 483 484 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 472 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
364 365 366 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 364 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
370 371 372 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 370 def hash [c_int, placa, renavam, tara, cap_kg, cap_m3, prop, condutor, tp_rod, tp_car, uf].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 178 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@c_int.nil? && @c_int.to_s.length > 10 invalid_properties.push('invalid value for "c_int", the character length must be smaller than or equal to 10.') end if !@c_int.nil? && @c_int.to_s.length < 1 invalid_properties.push('invalid value for "c_int", the character length must be great than or equal to 1.') end if !@renavam.nil? && @renavam.to_s.length > 11 invalid_properties.push('invalid value for "renavam", the character length must be smaller than or equal to 11.') end if !@renavam.nil? && @renavam.to_s.length < 9 invalid_properties.push('invalid value for "renavam", the character length must be great than or equal to 9.') end if @tara > 999999 invalid_properties.push('invalid value for "tara", must be smaller than or equal to 999999.') end if @tara < 0 invalid_properties.push('invalid value for "tara", must be greater than or equal to 0.') end if !@cap_kg.nil? && @cap_kg > 999999 invalid_properties.push('invalid value for "cap_kg", must be smaller than or equal to 999999.') end if !@cap_kg.nil? && @cap_kg < 0 invalid_properties.push('invalid value for "cap_kg", must be greater than or equal to 0.') end if !@cap_m3.nil? && @cap_m3 > 999 invalid_properties.push('invalid value for "cap_m3", must be smaller than or equal to 999.') end if !@cap_m3.nil? && @cap_m3 < 0 invalid_properties.push('invalid value for "cap_m3", must be greater than or equal to 0.') end if @condutor.nil? invalid_properties.push('invalid value for "condutor", condutor cannot be nil.') end if @condutor.length > 10 invalid_properties.push('invalid value for "condutor", number of items must be less than or equal to 10.') end if @condutor.length < 1 invalid_properties.push('invalid value for "condutor", number of items must be greater than or equal to 1.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
448 449 450 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 448 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 454 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_s ⇒ String
Returns the string representation of the object
442 443 444 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 442 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/nuvemfiscal_sdk_ruby/models/mdfe_sefaz_veic_tracao.rb', line 238 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@c_int.nil? && @c_int.to_s.length > 10 return false if !@c_int.nil? && @c_int.to_s.length < 1 return false if !@renavam.nil? && @renavam.to_s.length > 11 return false if !@renavam.nil? && @renavam.to_s.length < 9 return false if @tara > 999999 return false if @tara < 0 return false if !@cap_kg.nil? && @cap_kg > 999999 return false if !@cap_kg.nil? && @cap_kg < 0 return false if !@cap_m3.nil? && @cap_m3 > 999 return false if !@cap_m3.nil? && @cap_m3 < 0 return false if @condutor.nil? return false if @condutor.length > 10 return false if @condutor.length < 1 true end |