receitaws_client 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fd6dbe3044a30479ea673693793faff945910e409940feff89cabdf5ee0f1286
4
+ data.tar.gz: c91212031ffda78ea5e5068635b46824bd85795305eedf7aa426f5bed3689f7b
5
+ SHA512:
6
+ metadata.gz: 486277527023241e746bd85b891d060762a26e1926ff90971f2cb4b0cc7cd47988d6546e7cc7e052186e07b03b988ae377026f3565d46a7e9834ea8aaf35bdb4
7
+ data.tar.gz: e46dc5d656effd878825b3844625fe99566d438ed9bfc06d926a5157a4874e9aaf33bb88a9309865b22b4f1ef9dabc9e46ed4ed188f903df60cc6424b2c0b42c
data/.gitignore ADDED
@@ -0,0 +1,52 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ .to_do
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 QW3 - Software, Marketing e Consultoria
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,199 @@
1
+ Acesso a documentação de desenvolvimento da [https://receitaws.com.br/](https://receitaws.com.br/api)
2
+
3
+ ## Instalando
4
+
5
+ ### Gemfile
6
+
7
+ Adicione esta linha ao Gemfile do seu aplicativo:
8
+
9
+ ```ruby
10
+ gem 'receitaws_client'
11
+ ```
12
+
13
+ - Execute o comando `bundle install`.
14
+
15
+ ### Instalação direta
16
+
17
+ ```ruby
18
+ gem install receitaws_client
19
+ ```
20
+
21
+ ## Configuração
22
+
23
+ Para fazer a autenticação, você precisará configurar as credenciais da ReceitaWSClient. Crie o arquivo `config/initializers/receitaws_client.rb` com o conteúdo abaixo.
24
+
25
+ ```ruby
26
+ Receitaws.configure do |config|
27
+
28
+ #
29
+ # Cadastrar token fornecido no cadastro na ReceitaWS
30
+ config.token = 'sustitual pelo seu token'
31
+
32
+ #
33
+ # Opções de ambiente
34
+ # Quantidade máxima de dias com relação à última consulta na Receita Federal deste CNPJ
35
+ config.days = 365
36
+
37
+ #
38
+ # Tempo de espera pela resposta do WeService em segundos
39
+ config.timeout = 10
40
+
41
+ #
42
+ # plano - comenrcial ou gratis
43
+ config.plano = 'gratis'
44
+
45
+ end
46
+ ```
47
+
48
+ ## Consultar CNPJ
49
+
50
+ Nesse endpoint é realizado a consulta de um CNPJ.
51
+
52
+ > Enviar somente os números do CNPJ, sem pontos e traços.
53
+
54
+ Será retornado um objeto do tipo **ReceitawsClient::Cnpj** descrito abaixo.
55
+
56
+
57
+ ```ruby
58
+ cnpj = ReceitawsClient::ConsultarCnpj.executar 20254766000100
59
+ ```
60
+
61
+ Verificar se se a consulta foi realizada com sucesso.
62
+
63
+ ```ruby
64
+ #
65
+ # Caso tenha ocorrido algum erro na consulta
66
+ cnpj.status == :error
67
+
68
+ #
69
+ # Mensagem explicativa indicando erro.
70
+ cnpj.message
71
+ # Possíveis mensagens de retorno:
72
+ # "Timeout"
73
+ # "CNPJ inválido"
74
+ # "CNPJ rejeitado pela Receita Federal"
75
+
76
+ #
77
+ # Consulta realizada com sucesso
78
+ cnpj.status == :ok
79
+
80
+ #
81
+ # LIsta de atributos disponíveis
82
+
83
+ # CNPJ no formato 00.000.000/0000-00.
84
+ cnpj.cnpj
85
+
86
+ # Data de abertura no formato dd/mm/aaaa.
87
+ cnpj.abertura
88
+
89
+ # Razão social.
90
+ cnpj.nome
91
+
92
+ # Nome fantasia.
93
+ cnpj.fantasia
94
+
95
+ # Logradouro.
96
+ cnpj.logradouro
97
+
98
+ # Número.
99
+ cnpj.numero
100
+
101
+ # Complemento.
102
+ cnpj.complemento
103
+
104
+ # CEP no formato 00.000-000.
105
+ cnpj.cep
106
+
107
+ # Bairro.
108
+ cnpj.bairro
109
+
110
+ # Município.
111
+ cnpj.municipio
112
+
113
+ # Sigla da Unidade da Federação.
114
+ cnpj.uf
115
+
116
+ # Email.
117
+ cnpj.email
118
+
119
+ # Telefone.
120
+ cnpj.telefone
121
+
122
+ # Situação.
123
+ cnpj.situacao
124
+
125
+ # Data da situação no formato dd/mm/aaaa.
126
+ cnpj.data_situacao
127
+
128
+ # Lista (Array de Hash) completa de todos os CNAE do CNPJ
129
+ # O primeiro da lista será sempre o CNAE Principal
130
+ cnpj.atividades
131
+
132
+ # Descrição da atividade.
133
+ cnpj.atividades[0][:text]
134
+
135
+ # Código CNAE da atividade no formato 00.00-0-00.
136
+ cnpj.atividades[0][:code]
137
+
138
+ # Lista (Array) completa de todos os CNAE do CNPJ
139
+ # Somente os números dos CNAES sem pontos e traços
140
+ cnpj.cnaes
141
+
142
+ ```
143
+ ## Mock para Testes
144
+
145
+ Esses metodos respondem sem consumir a api com dados fakes
146
+
147
+ ```ruby
148
+ cnpj = ReceitawsClient::Mock::ConsultarCnpj.executar 20254766000100
149
+ ```
150
+
151
+ Verificar se se a consulta foi realizada com sucesso.
152
+
153
+ ```ruby
154
+
155
+
156
+ ---
157
+
158
+
159
+ ## Contributing
160
+
161
+ - Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
162
+ - Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
163
+ - Fork the project.
164
+ - Start a feature/bugfix branch.
165
+ - Commit and push until you are happy with your contribution.
166
+ - Don't forget to rebase with branch master in main project before submit the pull request.
167
+ - Please don't change the gemspec file, Rakefile, version, or history.
168
+
169
+ ## Autor
170
+ - Este projeto é um fork do projeto original de
171
+ - [Leandro Falcão](https://github.com/lsfalcao)
172
+ - Contribuição e melhorias realizadas por
173
+ - [Isaac Guerra](http://github.com/isaacguerra)
174
+ ## Copyright
175
+
176
+ - [Leandro Falcão](https://github.com/lsfalcao)
177
+ - [Isaac Guerra](http://github.com/isaacguerra)
178
+
179
+ The MIT License (MIT)
180
+
181
+ Copyright (c) 2019 QW3
182
+
183
+ Permission is hereby granted, free of charge, to any person obtaining a copy
184
+ of this software and associated documentation files (the "Software"), to deal
185
+ in the Software without restriction, including without limitation the rights
186
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
187
+ copies of the Software, and to permit persons to whom the Software is
188
+ furnished to do so, subject to the following conditions:
189
+
190
+ The above copyright notice and this permission notice shall be included in all
191
+ copies or substantial portions of the Software.
192
+
193
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
194
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
195
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
196
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
197
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
198
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
199
+ SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ task default: :spec
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ReceitawsClient
4
+ class Base
5
+ require 'uri'
6
+ require 'net/http'
7
+ require 'timeout'
8
+
9
+ def self.build_request(endpoint, metodo, body = nil)
10
+ url = URI("#{ReceitawsClient.base_uri}/#{endpoint}")
11
+
12
+ http = Net::HTTP.new(url.host, url.port)
13
+ http.use_ssl = true
14
+
15
+ case metodo
16
+ when 'delete'
17
+ request = Net::HTTP::Delete.new(url)
18
+ when 'get'
19
+ request = Net::HTTP::Get.new(url)
20
+ when 'put'
21
+ request = Net::HTTP::Put.new(url)
22
+ when 'post'
23
+ request = Net::HTTP::Post.new(url)
24
+ end
25
+ request = ReceitawsClient::Base.default_headers request
26
+
27
+ request.body = body.to_json unless body.nil?
28
+
29
+ begin
30
+ status = Timeout.timeout(ReceitawsClient.timeout.to_i) do
31
+ return http.request(request)
32
+ end
33
+ rescue Timeout::Error
34
+ puts 'That took too long, exiting...'
35
+ nil
36
+ end
37
+ end
38
+
39
+ def self.default_headers(request)
40
+ request['authorization'] = "Bearer #{ReceitawsClient.token}"
41
+ request['Content-Type'] = 'application/json'
42
+ request
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ReceitawsClient
4
+ class Cnpj
5
+ attr_reader :status, :message, :nome, :uf, :telefone, :email, :fantasia, :cnpj, :bairro, :logradouro, :numero,
6
+ :cep, :municipio, :abertura, :data_situacao, :complemento, :atividades, :cnaes, :situacao
7
+
8
+ def initialize(result = nil)
9
+ if result.nil?
10
+ @status = :error
11
+ @message = 'Timeout'
12
+ return self
13
+ end
14
+
15
+ if result['status'] == 'ERROR'
16
+ @status = :error
17
+ @message = result['message']
18
+ return self
19
+ end
20
+
21
+ @status = :ok
22
+ @nome = result['nome']
23
+ @uf = result['uf']
24
+ @telefone = result['telefone']
25
+ @email = result['email']
26
+ @fantasia = result['fantasia']
27
+ @cnpj = result['cnpj']
28
+ @bairro = result['bairro']
29
+ @logradouro = result['logradouro']
30
+ @numero = result['numero']
31
+ @cep = result['cep']
32
+ @municipio = result['municipio']
33
+ @abertura = result['abertura']
34
+ @data_situacao = result['data_situacao']
35
+ @situacao = result['situacao']
36
+ @complemento = result['complemento']
37
+ @atividades = []
38
+ result['atividade_principal'].each do |atividade|
39
+ @atividades << { code: atividade['code'], text: atividade['text'] }
40
+ end
41
+ result['atividades_secundarias'].each do |atividade|
42
+ @atividades << { code: atividade['code'], text: atividade['text'] }
43
+ end
44
+ @cnaes = @atividades.collect { |a| a[:code].to_s.gsub(/[^0-9A-Za-z]/, '') }
45
+
46
+ self
47
+ end
48
+
49
+ def self.valida_digito_cnpj(cnpj)
50
+ return false if cnpj.nil? || cnpj.blank?
51
+ nulos = %w[11111111111111 22222222222222 33333333333333 44444444444444 55555555555555 66666666666666
52
+ 77777777777777 88888888888888 99999999999999 00000000000000]
53
+ valor = cnpj.scan(/[0-9]/)
54
+ if valor.length == 14 && !nulos.member?(valor.join)
55
+ valor = valor.collect(&:to_i)
56
+ soma = valor[0] * 5 + valor[1] * 4 + valor[2] * 3 + valor[3] * 2 + valor[4] * 9 + valor[5] * 8 + valor[6] * 7 + valor[7] * 6 + valor[8] * 5 + valor[9] * 4 + valor[10] * 3 + valor[11] * 2
57
+ soma -= (11 * (soma / 11))
58
+ resultado1 = [0, 1].include?(soma) ? 0 : 11 - soma
59
+ if resultado1 == valor[12]
60
+ soma = valor[0] * 6 + valor[1] * 5 + valor[2] * 4 + valor[3] * 3 + valor[4] * 2 + valor[5] * 9 + valor[6] * 8 + valor[7] * 7 + valor[8] * 6 + valor[9] * 5 + valor[10] * 4 + valor[11] * 3 + valor[12] * 2
61
+ soma -= (11 * (soma / 11))
62
+ resultado2 = [0, 1].include?(soma) ? 0 : 11 - soma
63
+ return true if resultado2 == valor[13] # CNPJ válido
64
+ end
65
+ end
66
+ false # CNPJ inválido
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,83 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ReceitawsClient
4
+ module Configure
5
+ # Endereço do WeService
6
+ URL_RECEITAWS = 'https://www.receitaws.com.br'
7
+
8
+ # Parâmetros iniciais
9
+ API_VERSION = 'v1'
10
+
11
+ # Parâmetros iniciais
12
+ TOKEN = ''
13
+
14
+ # Parâmetros iniciais
15
+ DAYS = 365
16
+
17
+ # Parâmetros iniciais
18
+ TIMEOUT = 10
19
+
20
+ # Parâmetros iniciais
21
+ PLANO = 'gratis'
22
+
23
+ # Endereço do WeService
24
+ attr_writer :url
25
+
26
+ # Enviado pela ReceitaWS
27
+ attr_writer :api_version
28
+
29
+ # Enviado pela ReceitaWS
30
+ attr_writer :token
31
+
32
+ # Obrigatório, numérico, quantidade máxima de dias com relação à última consulta na Receita Federal deste CNPJ
33
+ attr_writer :days
34
+
35
+ # Obrigatório, numérico, Tempo de espera pela resposta do WeService em segundos
36
+ attr_writer :timeout
37
+
38
+ # Obrigatório, numérico, Tempo de espera pela resposta do WeService em segundos
39
+ attr_writer :plano
40
+
41
+ # Comando que recebe as configurações
42
+ def configure
43
+ yield self if block_given?
44
+ end
45
+
46
+ # Definir url_receitaws
47
+ def url_receitaws
48
+ @url_receitaws ||= URL_RECEITAWS
49
+ end
50
+
51
+ # Definir api_version
52
+ def api_version
53
+ @api_version ||= API_VERSION
54
+ end
55
+
56
+ # Definir token
57
+ def token
58
+ @token ||= TOKEN
59
+ end
60
+
61
+ # Definir days
62
+ # Obrigatório, numérico, quantidade máxima de dias com relação à última consulta na Receita Federal deste CNPJ
63
+ def days
64
+ @days ||= DAYS
65
+ end
66
+
67
+ # Definir timeout em segundos
68
+ # Tempo de espera pela resposta do WeService em segundos
69
+ def timeout
70
+ @timeout ||= TIMEOUT
71
+ end
72
+
73
+ # Definir plano
74
+ def plano
75
+ @plano ||= PLANO
76
+ end
77
+
78
+ # Definir url que será utilizado
79
+ def base_uri
80
+ "#{url_receitaws}/#{api_version}"
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ReceitawsClient
4
+ class ConsultarCnpj < Base
5
+ # Metodo para consultar um CNPJ
6
+ # cnpj: obrigatório, numérico, o CNPJ a ser pesquisado
7
+ # Retonar um obejto do tipo Receitaws::Cnpj
8
+ def self.executar(cnpj)
9
+ Rails.logger.tagged 'ReceitawsClient' do
10
+ cnpj = cnpj.to_s.gsub(/[^0-9A-Za-z]/, '')
11
+ unless ReceitawsClient::Cnpj.valida_digito_cnpj(cnpj)
12
+ Rails.logger.info 'CNPJ INVALIDO'
13
+ result = { 'status' => 'ERROR', 'message' => 'CNPJ INVALIDO' }
14
+ return ReceitawsClient::Cnpj.new(result)
15
+ end
16
+ response = build_request endpoint(cnpj), 'get'
17
+ begin
18
+ result = JSON.parse(response.read_body) unless response.nil?
19
+ Rails.logger.info 'Busca de CNPJ OK'
20
+ return ReceitawsClient::Cnpj.new(result)
21
+ rescue StandardError
22
+ Rails.logger.info 'ERROR - Serviço ReceitaWS não retornou a solicitação!'
23
+ result = { 'status' => 'error', 'message' => 'ERROR - Serviço ReceitaWS não retornou a solicitação!' }
24
+ return ReceitawsClient::Cnpj.new(result)
25
+ end
26
+ end
27
+ end
28
+
29
+ def self.endpoint(cnpj)
30
+ return "cnpj/#{cnpj}" if ReceitawsClient.plano == 'gratis'
31
+ "cnpj/#{cnpj}/days/#{ReceitawsClient.days}"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,55 @@
1
+ module ReceitawsClient
2
+ module Mock
3
+ class ConsultarCnpj
4
+ def self.executar(cnpj)
5
+ cnpj = cnpj.to_s.gsub(/[^0-9A-Za-z]/, '')
6
+ unless ReceitawsClient::Cnpj.valida_digito_cnpj(cnpj)
7
+ result = { 'status' => 'ERROR', 'message' => 'CNPJ INVALIDO' }
8
+ return ReceitawsClient::Cnpj.new(result)
9
+ end
10
+ result = {'status' => 'ok',
11
+ 'uf' => "MG",
12
+ 'telefone' => "(99) 9999-9999",
13
+ 'email' => "contatomacrocont.com.br",
14
+ 'fantasia' => "UMBRELLA",
15
+ 'nome' => "UMBRELLA INC",
16
+ 'cnpj' => 'cnpj',
17
+ 'bairro' => "CENTRO",
18
+ 'logradouro' => "R DOS GOITACAZES",
19
+ 'numero' => "15",
20
+ 'cep' => "30.190-050",
21
+ 'municipio' => "BELO HORIZONTE",
22
+ 'abertura' => "15/05/2014",
23
+ 'data_situacao' => "15/05/2014",
24
+ 'situacao' => "ATIVA",
25
+ 'complemento' => "ANDAR 6 SALA 2",
26
+ 'atividade_principal' => [{:code => "62.03-1-00", :text => "Desenvolvimento e licenciamento de programas de computador não-customizáveis"}],
27
+ 'atividades_secundarias' => [
28
+ {:code => "58.11-5-00", :text => "Edição de livros"},
29
+ {:code => "62.02-3-00", :text => "Desenvolvimento e licenciamento de programas de computador customizáveis"},
30
+ {:code => "62.09-1-00", :text => "Suporte técnico, manutenção e outros serviços em tecnologia da informação"},
31
+ {:code => "63.11-9-00", :text => "Tratamento de dados, provedores de serviços de aplicação e serviços de hospedagem na internet"},
32
+ {:code => "63.19-4-00", :text => "Portais, provedores de conteúdo e outros serviços de informação na internet"},
33
+ {:code => "70.20-4-00", :text => "Atividades de consultoria em gestão empresarial, exceto consultoria técnica específica"},
34
+ {:code => "72.20-7-00", :text => "Pesquisa e desenvolvimento experimental em ciências sociais e humanas"},
35
+ {:code => "73.11-4-00", :text => "Agências de publicidade"},
36
+ {:code => "74.10-2-99", :text => "atividades de design não especificadas anteriormente"},
37
+ {:code => "74.90-1-04", :text => "Atividades de intermediação e agenciamento de serviços e negócios em geral, exceto imobiliários"},
38
+ {:code => "82.30-0-01", :text => "Serviços de organização de feiras, congressos, exposições e festas"},
39
+ {:code => "82.99-7-05", :text => "Serviços de levantamento de fundos sob contrato"},
40
+ {:code => "85.50-3-02", :text => "Atividades de apoio à educação, exceto caixas escolares"},
41
+ {:code => "85.92-9-99", :text => "Ensino de arte e cultura não especificado anteriormente"},
42
+ {:code => "85.99-6-03", :text => "Treinamento em informática"},
43
+ {:code => "85.99-6-04", :text => "Treinamento em desenvolvimento profissional e gerencial"},
44
+ {:code => "85.99-6-99", :text => "Outras atividades de ensino não especificadas anteriormente"},
45
+ {:code => "90.01-9-01", :text => "Produção teatral"}, {:code => "90.01-9-02", :text => "Produção musical"},
46
+ {:code => "90.01-9-03", :text => "Produção de espetáculos de dança"},
47
+ {:code => "90.01-9-04", :text => "Produção de espetáculos circenses, de marionetes e similares"},
48
+ {:code => "90.01-9-99", :text => "Artes cênicas, espetáculos e atividades complementares não especificadas anteriormente"}],
49
+ 'cnaes' => ["6203100", "5811500", "6202300", "6209100", "6311900", "6319400", "7020400", "7220700", "7311400", "7410299", "7490104",
50
+ "8230001", "8299705", "8550302", "8592999", "8599603", "8599604", "8599699", "9001901", "9001902", "9001903", "9001904", "9001999"]}
51
+ return ReceitawsClient::Cnpj.new(result)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ReceitawsClient
4
+ module Version
5
+ MAJOR = 0
6
+ MINOR = 0
7
+ PATCH = 8
8
+ STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubygems'
4
+ require 'active_model'
5
+
6
+ require 'receitaws_client/version'
7
+ require 'receitaws_client/configure'
8
+ require 'receitaws_client/base'
9
+ require 'receitaws_client/consultar_cnpj'
10
+ require 'receitaws_client/cnpj'
11
+ require 'receitaws_client/mock'
12
+
13
+ module ReceitawsClient
14
+ extend ReceitawsClient::Configure
15
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'receitaws_client/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'receitaws_client'
9
+ spec.version = ReceitawsClient::Version::STRING
10
+ spec.platform = Gem::Platform::RUBY
11
+ spec.authors = ['Isaac Guerra']
12
+ spec.email = ['guerra.isaac@gmail.com']
13
+ spec.summary = 'Gem ReceitaWSClient API COM PLANO - Consulta de Dados de CNPJ'
14
+ spec.description = 'Client Rails não oficial do Webservice da ReceitaWS - https://receitaws.com.br/'
15
+ spec.homepage = 'https://github.com/isaacguerra/receitaws_client'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = ['.gitignore', 'Gemfile', 'LICENSE', 'README.md', 'Rakefile',
19
+ 'lib/receitaws_client.rb', 'lib/receitaws_client/base.rb',
20
+ 'lib/receitaws_client/cnpj.rb', 'lib/receitaws_client/configure.rb',
21
+ 'lib/receitaws_client/consultar_cnpj.rb', 'lib/receitaws_client/version.rb',
22
+ 'lib/receitaws_client/mock.rb', 'receitaws_client.gemspec']
23
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
25
+
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.required_ruby_version = Gem::Requirement.new('>= 1.9')
29
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: receitaws_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
5
+ platform: ruby
6
+ authors:
7
+ - Isaac Guerra
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-11-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Client Rails não oficial do Webservice da ReceitaWS - https://receitaws.com.br/
14
+ email:
15
+ - guerra.isaac@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - LICENSE
23
+ - README.md
24
+ - Rakefile
25
+ - lib/receitaws_client.rb
26
+ - lib/receitaws_client/base.rb
27
+ - lib/receitaws_client/cnpj.rb
28
+ - lib/receitaws_client/configure.rb
29
+ - lib/receitaws_client/consultar_cnpj.rb
30
+ - lib/receitaws_client/mock.rb
31
+ - lib/receitaws_client/version.rb
32
+ - receitaws_client.gemspec
33
+ homepage: https://github.com/isaacguerra/receitaws_client
34
+ licenses:
35
+ - MIT
36
+ metadata: {}
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '1.9'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubygems_version: 3.0.3
53
+ signing_key:
54
+ specification_version: 4
55
+ summary: Gem ReceitaWSClient API COM PLANO - Consulta de Dados de CNPJ
56
+ test_files: []