request-cnpj 0.1.0 → 0.1.1
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/.claude/settings.json +23 -1
- data/lib/request/cnpj/base_client.rb +4 -17
- data/lib/request/cnpj/client.rb +3 -3
- data/lib/request/cnpj/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f7046d31cec1b83a5860306f5a7aeade2e5608c07122dfa9cbfdae11861f952d
|
|
4
|
+
data.tar.gz: 2d641f7cf06adfbbbbf63c514ea476d5cf19a3e7e59473adfdf6ee54176f2f2b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d78586fcf8fab9cca497b145a6db81fa001327c16cbea675a2123cc6f34aacebcfb2914e698dd6b3d4c48b45d45c76f0f40b8dc99d36e68c630e1313fc0543ba
|
|
7
|
+
data.tar.gz: e01fddea0fa4b45ddead7a0e4a2bed1b2632c83ac7624003f538eadad2c9a2f70abd0042ad8dda1d19173f19e97678c5e76e89c3d64100ba488323ed695c82cb
|
data/.claude/settings.json
CHANGED
|
@@ -5,7 +5,29 @@
|
|
|
5
5
|
"Bash(curl -s -o /dev/null -w \"%{http_code}\\\\n\" --max-time 5 https://api.opencnpj.org/00000000000191)",
|
|
6
6
|
"Bash(curl -s --max-time 5 https://api.opencnpj.org/00000000000191)",
|
|
7
7
|
"Bash(curl -s -o /dev/null -w \"%{http_code}\\\\n\" --max-time 5 https://api.opencnpj.org/11111111111111)",
|
|
8
|
-
"Bash(gem build *)"
|
|
8
|
+
"Bash(gem build *)",
|
|
9
|
+
"Bash(curl -s https://rubygems.org/api/v1/gems/request-cnpj.json)",
|
|
10
|
+
"Bash(ls -la ~/.gem/credentials 2>/dev/null && echo \"arquivo existe\" || echo \"arquivo nao encontrado\")",
|
|
11
|
+
"Read(//Users/moisesribeiro/.gem/**)",
|
|
12
|
+
"Bash(gem list *)",
|
|
13
|
+
"Bash(gem which *)",
|
|
14
|
+
"Bash(gem env *)",
|
|
15
|
+
"Bash(find /Users/moisesribeiro -maxdepth 3 -iname \"Gemfile\" 2>/dev/null)",
|
|
16
|
+
"Read(//Users/moisesribeiro/**)",
|
|
17
|
+
"Bash(grep -l \"request-cnpj\\\\|request/cnpj\\\\|cnpj_client\" -r /Users/moisesribeiro/river /Users/moisesribeiro/rivers /Users/moisesribeiro/debanco 2>/dev/null | grep -v node_modules)",
|
|
18
|
+
"Read(//Users/moisesribeiro/river/**)",
|
|
19
|
+
"Read(//Users/moisesribeiro/debanco/app/models/**)",
|
|
20
|
+
"Read(//Users/moisesribeiro/debanco/**)",
|
|
21
|
+
"Bash(grep -n \"class CNPJ\\\\|module CNPJ\" \"/Users/moisesribeiro/.rbenv/versions/4.0.5/lib/ruby/gems/4.0.0/gems/cpf_cnpj-1.0.1/lib/cpf_cnpj.rb\")",
|
|
22
|
+
"Read(//Users/moisesribeiro/.rbenv/versions/4.0.5/lib/ruby/gems/4.0.0/gems/cpf_cnpj-1.0.1/lib/**)",
|
|
23
|
+
"Bash(grep -rn \"class CNPJ\\\\|module CNPJ\" \"/Users/moisesribeiro/.rbenv/versions/4.0.5/lib/ruby/gems/4.0.0/gems/cpf_cnpj-1.0.1/lib/\")",
|
|
24
|
+
"Bash(grep -n \"^gem \" /Users/moisesribeiro/debanco/Gemfile | head -20)",
|
|
25
|
+
"Bash(gem search *)",
|
|
26
|
+
"Bash(grep -E '\\\\.gem$|request-cnpj-0.1.0')",
|
|
27
|
+
"Bash(git rm *)"
|
|
28
|
+
],
|
|
29
|
+
"additionalDirectories": [
|
|
30
|
+
"/Users/moisesribeiro/debanco"
|
|
9
31
|
]
|
|
10
32
|
}
|
|
11
33
|
}
|
|
@@ -6,33 +6,20 @@ module Request
|
|
|
6
6
|
class BaseClient
|
|
7
7
|
protected
|
|
8
8
|
|
|
9
|
-
def get(path = nil, params: nil, headers:
|
|
9
|
+
def get(path = nil, params: nil, headers: { accept: 'application/json' }, url: url(path, **params.to_h), &)
|
|
10
10
|
execute(method: :get, url:, headers:, &)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def execute(**)
|
|
14
|
-
response =
|
|
14
|
+
response = rest_client.execute(**)
|
|
15
15
|
|
|
16
16
|
return yield response if block_given?
|
|
17
17
|
|
|
18
18
|
response.body
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
22
|
-
{
|
|
23
|
-
accept: 'application/json'
|
|
24
|
-
}
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def default_execute_options
|
|
28
|
-
{}
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def url_for(path, **params)
|
|
32
|
-
URI('https://api.opencnpj.org').tap do |uri|
|
|
33
|
-
uri.path += path
|
|
34
|
-
uri.query = params.to_query if params.any?
|
|
35
|
-
end.to_s
|
|
21
|
+
def url(path)
|
|
22
|
+
URI('https://api.opencnpj.org').tap { |uri| uri.path += path }.to_s
|
|
36
23
|
end
|
|
37
24
|
end
|
|
38
25
|
end
|
data/lib/request/cnpj/client.rb
CHANGED
|
@@ -4,11 +4,11 @@ module Request
|
|
|
4
4
|
module Cnpj
|
|
5
5
|
# Client for fetching CNPJ data from the OpenCNPJ API.
|
|
6
6
|
class Client < BaseClient
|
|
7
|
-
attr_reader :url, :
|
|
7
|
+
attr_reader :url, :rest_client
|
|
8
8
|
|
|
9
|
-
def initialize(
|
|
9
|
+
def initialize(rest_client: RestClient::Request)
|
|
10
10
|
super()
|
|
11
|
-
@
|
|
11
|
+
@rest_client = rest_client
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
# Method to request CNPJ to API
|
data/lib/request/cnpj/version.rb
CHANGED