receitaws_client 0.0.8 → 0.0.9
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 +4 -4
- data/README.md +5 -0
- data/lib/receitaws_client/configure.rb +23 -1
- data/lib/receitaws_client/consultar_cnpj.rb +4 -0
- data/lib/receitaws_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4faab0d0565ebfab3cb2efb385e9646041476607ee560050876ab807fe8fe68
|
|
4
|
+
data.tar.gz: 71a20fc8092f1a8871da86676186d6cfa0afd5a85adb5d8c981e86cad9b8862c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f92d6816f181f5af063190e67e76c4669d8765c5f5e428bc0c6aee78bc9b950e635a99238ac238c1c5c0604b20b060923bd01795906436f2f95a1534e38735b5
|
|
7
|
+
data.tar.gz: f9640e1af0a266e9d5c8471826cd2f31226f7de8067aa86490b49eaff79eb638f37c82094786d4a343be32ffebe235b436e51360717bc66e2c7e0f22701311f7
|
data/README.md
CHANGED
|
@@ -20,6 +20,12 @@ module ReceitawsClient
|
|
|
20
20
|
# Parâmetros iniciais
|
|
21
21
|
PLANO = 'gratis'
|
|
22
22
|
|
|
23
|
+
# Mockar durante os desenvolvimento
|
|
24
|
+
MOCK_DEVELOPMENT = false
|
|
25
|
+
|
|
26
|
+
# Mockar durante os testes
|
|
27
|
+
MOCK_TEST = false
|
|
28
|
+
|
|
23
29
|
# Endereço do WeService
|
|
24
30
|
attr_writer :url
|
|
25
31
|
|
|
@@ -35,9 +41,15 @@ module ReceitawsClient
|
|
|
35
41
|
# Obrigatório, numérico, Tempo de espera pela resposta do WeService em segundos
|
|
36
42
|
attr_writer :timeout
|
|
37
43
|
|
|
38
|
-
#
|
|
44
|
+
# define o plano contratado
|
|
39
45
|
attr_writer :plano
|
|
40
46
|
|
|
47
|
+
# mockar durenate o desenvolvimento
|
|
48
|
+
attr_writer :mock_development
|
|
49
|
+
|
|
50
|
+
# mockar durenate os teste
|
|
51
|
+
attr_writer :mock_test
|
|
52
|
+
|
|
41
53
|
# Comando que recebe as configurações
|
|
42
54
|
def configure
|
|
43
55
|
yield self if block_given?
|
|
@@ -75,6 +87,16 @@ module ReceitawsClient
|
|
|
75
87
|
@plano ||= PLANO
|
|
76
88
|
end
|
|
77
89
|
|
|
90
|
+
# Definir mock
|
|
91
|
+
def mock_development
|
|
92
|
+
@mock_development ||= MOCK_DEVELOPMENT
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Definir mock
|
|
96
|
+
def mock_test
|
|
97
|
+
@mock_test ||= MOCK_TEST
|
|
98
|
+
end
|
|
99
|
+
|
|
78
100
|
# Definir url que será utilizado
|
|
79
101
|
def base_uri
|
|
80
102
|
"#{url_receitaws}/#{api_version}"
|
|
@@ -6,6 +6,10 @@ module ReceitawsClient
|
|
|
6
6
|
# cnpj: obrigatório, numérico, o CNPJ a ser pesquisado
|
|
7
7
|
# Retonar um obejto do tipo Receitaws::Cnpj
|
|
8
8
|
def self.executar(cnpj)
|
|
9
|
+
if (Rails.env.development? && ReceitawsClient.mock_development) || (Rails.env.test? && ReceitawsClient.mock_test)
|
|
10
|
+
return ReceitawsClient::Mock::ConsultarCnpj.executar cnpj
|
|
11
|
+
end
|
|
12
|
+
|
|
9
13
|
Rails.logger.tagged 'ReceitawsClient' do
|
|
10
14
|
cnpj = cnpj.to_s.gsub(/[^0-9A-Za-z]/, '')
|
|
11
15
|
unless ReceitawsClient::Cnpj.valida_digito_cnpj(cnpj)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: receitaws_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Isaac Guerra
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-11-
|
|
11
|
+
date: 2021-11-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Client Rails não oficial do Webservice da ReceitaWS - https://receitaws.com.br/
|
|
14
14
|
email:
|