Class: NuvemfiscalSdkRuby::CnpjEmpresa

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CnpjEmpresa

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#atividade_principalObject

Returns the value of attribute atividade_principal.



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

def atividade_principal
  @atividade_principal
end

#atividades_secundariasObject

Returns the value of attribute atividades_secundarias.



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

def atividades_secundarias
  @atividades_secundarias
end

#capital_socialObject

Capital social da empresa.



36
37
38
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 36

def capital_social
  @capital_social
end

#cnpjObject

Número de inscrição do CNPJ.



19
20
21
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 19

def cnpj
  @cnpj
end

#data_inicio_atividadeObject

Data de início da atividade.



28
29
30
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 28

def data_inicio_atividade
  @data_inicio_atividade
end

#emailObject

E-mail do contribuinte.



61
62
63
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 61

def email
  @email
end

#enderecoObject

Returns the value of attribute endereco.



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

def endereco
  @endereco
end

#ente_federativo_responsavelObject

O ente federativo responsável é preenchido para os casos de órgãos e entidades do grupo de natureza jurídica 1XXX. Para as demais naturezas, este atributo fica em branco.



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

def ente_federativo_responsavel
  @ente_federativo_responsavel
end

#matrizObject

Indicador de matriz/filial: * ‘true` - É matriz * `false` - É filial



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

def matriz
  @matriz
end

#motivo_situacao_cadastralObject

Returns the value of attribute motivo_situacao_cadastral.



45
46
47
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 45

def motivo_situacao_cadastral
  @motivo_situacao_cadastral
end

#natureza_juridicaObject

Returns the value of attribute natureza_juridica.



33
34
35
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 33

def natureza_juridica
  @natureza_juridica
end

#nome_da_cidade_no_exteriorObject

Nome da cidade no exterior.



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

def nome_da_cidade_no_exterior
  @nome_da_cidade_no_exterior
end

#nome_fantasiaObject

Corresponde ao nome fantasia.



25
26
27
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 25

def nome_fantasia
  @nome_fantasia
end

#paisObject

Returns the value of attribute pais.



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

def pais
  @pais
end

#porteObject

Returns the value of attribute porte.



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

def porte
  @porte
end

#razao_socialObject

Nome empresarial da pessoa jurídica.



22
23
24
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 22

def razao_social
  @razao_social
end

#simeiObject

Returns the value of attribute simei.



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

def simei
  @simei
end

#simplesObject

Returns the value of attribute simples.



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

def simples
  @simples
end

#situacao_cadastralObject

Returns the value of attribute situacao_cadastral.



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

def situacao_cadastral
  @situacao_cadastral
end

#situacao_especialObject

Returns the value of attribute situacao_especial.



63
64
65
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 63

def situacao_especial
  @situacao_especial
end

#sociosObject

Returns the value of attribute socios.



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

def socios
  @socios
end

#telefonesObject

Returns the value of attribute telefones.



58
59
60
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 58

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



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 331

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



100
101
102
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 100

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
94
95
96
97
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 72

def self.attribute_map
  {
    :'cnpj' => :'cnpj',
    :'razao_social' => :'razao_social',
    :'nome_fantasia' => :'nome_fantasia',
    :'data_inicio_atividade' => :'data_inicio_atividade',
    :'matriz' => :'matriz',
    :'natureza_juridica' => :'natureza_juridica',
    :'capital_social' => :'capital_social',
    :'porte' => :'porte',
    :'ente_federativo_responsavel' => :'ente_federativo_responsavel',
    :'situacao_cadastral' => :'situacao_cadastral',
    :'motivo_situacao_cadastral' => :'motivo_situacao_cadastral',
    :'nome_da_cidade_no_exterior' => :'nome_da_cidade_no_exterior',
    :'pais' => :'pais',
    :'atividade_principal' => :'atividade_principal',
    :'atividades_secundarias' => :'atividades_secundarias',
    :'endereco' => :'endereco',
    :'telefones' => :'telefones',
    :'email' => :'email',
    :'situacao_especial' => :'situacao_especial',
    :'simples' => :'simples',
    :'simei' => :'simei',
    :'socios' => :'socios'
  }
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



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 307

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



133
134
135
136
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 133

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'cnpj' => :'String',
    :'razao_social' => :'String',
    :'nome_fantasia' => :'String',
    :'data_inicio_atividade' => :'Date',
    :'matriz' => :'Boolean',
    :'natureza_juridica' => :'CnpjNaturezaJuridica',
    :'capital_social' => :'Float',
    :'porte' => :'CnpjPorteEmpresa',
    :'ente_federativo_responsavel' => :'String',
    :'situacao_cadastral' => :'CnpjSituacaoCadastral',
    :'motivo_situacao_cadastral' => :'CnpjMotivoSituacaoCadastral',
    :'nome_da_cidade_no_exterior' => :'String',
    :'pais' => :'CnpjPais',
    :'atividade_principal' => :'CnpjCnae',
    :'atividades_secundarias' => :'Array<CnpjCnaeSecundario>',
    :'endereco' => :'CnpjEndereco',
    :'telefones' => :'Array<CnpjTelefone>',
    :'email' => :'String',
    :'situacao_especial' => :'CnpjSituacaoEspecial',
    :'simples' => :'CnpjOpcaoSimples',
    :'simei' => :'CnpjOpcaoSimei',
    :'socios' => :'Array<CnpjSocio>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      cnpj == o.cnpj &&
      razao_social == o.razao_social &&
      nome_fantasia == o.nome_fantasia &&
      data_inicio_atividade == o.data_inicio_atividade &&
      matriz == o.matriz &&
      natureza_juridica == o.natureza_juridica &&
      capital_social == o.capital_social &&
      porte == o.porte &&
      ente_federativo_responsavel == o.ente_federativo_responsavel &&
      situacao_cadastral == o.situacao_cadastral &&
      motivo_situacao_cadastral == o.motivo_situacao_cadastral &&
      nome_da_cidade_no_exterior == o.nome_da_cidade_no_exterior &&
      pais == o.pais &&
      atividade_principal == o.atividade_principal &&
      atividades_secundarias == o.atividades_secundarias &&
      endereco == o.endereco &&
      telefones == o.telefones &&
      email == o.email &&
      situacao_especial == o.situacao_especial &&
      simples == o.simples &&
      simei == o.simei &&
      socios == o.socios
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



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

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


294
295
296
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 294

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



300
301
302
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 300

def hash
  [cnpj, razao_social, nome_fantasia, data_inicio_atividade, matriz, natureza_juridica, capital_social, porte, ente_federativo_responsavel, situacao_cadastral, motivo_situacao_cadastral, nome_da_cidade_no_exterior, pais, atividade_principal, atividades_secundarias, endereco, telefones, email, situacao_especial, simples, simei, socios].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



250
251
252
253
254
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 250

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  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



378
379
380
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 378

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



384
385
386
387
388
389
390
391
392
393
394
395
396
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 384

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



372
373
374
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 372

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



258
259
260
261
# File 'lib/nuvemfiscal_sdk_ruby/models/cnpj_empresa.rb', line 258

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end