brasilapi 0.6.0 → 0.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90984c3c65874f8182c32cf0117ecbec0b6c93595885323a7d8d23597788941f
4
- data.tar.gz: f708ddf656929596da3ff1c8c44a30abedd6cdff120222edd6b007b0b878ca40
3
+ metadata.gz: 67529435e017f1d14417130add2c21a99acc47126d6a0a15d8e7b308d3ede0e8
4
+ data.tar.gz: 3c83bc926f7873c8d973bb0433386b5ae937bca70b1ef5861322eab3e158a71b
5
5
  SHA512:
6
- metadata.gz: cb1831e4435f2a28c0b6e5df7b822c5c65a84f65866096231742a98c87696c31c0058f06837a7b6b7860eb50874f4cdfb8a0f900727d7f32844990c5b9e966cd
7
- data.tar.gz: 20193f1e912ca81e215760aa9bc7daaf5fefc9adbf82101da8889c21e6bca7365d79bd95f94d1b4aed8074902fa1b76363bb1a086935e1fd91eb26cd5991af5a
6
+ metadata.gz: 396e12a440bd9dfefd950016396c254c2816343a56ca5db4d34f8f433c8a99cae790f4620072270676cd128d774a36fd2adb7f76f6ccf851b92775a19d7b76b4
7
+ data.tar.gz: 721fe3a6d163b204cf5e065bd49c43116dc834ac8daa50a0e70909a038619f33cdfdf8770cfc1ae231f5c3ac3b7f4310a8bea3628b5099051b36e1080e12ccf2
data/.rubocop.yml CHANGED
@@ -1,8 +1,10 @@
1
- require: rubocop-rspec
1
+ plugins:
2
+ - rubocop-rspec
2
3
 
3
4
  AllCops:
4
5
  NewCops: enable
5
- TargetRubyVersion: 2.6
6
+ TargetRubyVersion: 3.3
7
+ SuggestExtensions: false
6
8
 
7
9
  Style/StringLiterals:
8
10
  Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.8.0] - 2026-10-20
4
+
5
+ - `BrasilAPI::NotFound` passa a herdar de `BrasilAPI::Error`, então `rescue BrasilAPI::Error` também captura 404
6
+ - Erros HTTP preservam status, corpo e os campos `message`/`type` da BrasilAPI; qualquer resposta 2xx é sucesso
7
+ - Novas subclasses `BadRequest` (400), `ServerError` (5xx) e `Timeout`, todas filhas de `BrasilAPI::Error`
8
+ - Timeout padrão de 10 segundos, configurável com `BrasilAPI.configure { |config| config.timeout = 30 }`
9
+ - Segmentos de URL são escapados com `URI.encode_uri_component`, sem `URI::Parser#escape` (obsoleto no Ruby 3.4+)
10
+ - FIPE deixa de enviar `tabela_referencia` vazio quando o parâmetro é nil
11
+ - CI dispara em push na `main` e em pull requests, nas Rubies suportadas 3.3, 3.4 e 4.0
12
+ - Ruby mínima sobe de 2.6 para 3.3, porque 2.6–3.2 estão fora de manutenção
13
+ - Publicação automática no RubyGems via Trusted Publishing (OIDC), sem API key
14
+ - Testes da API do CPTEC
15
+ - Metadado `github_repo` no gemspec
16
+ - Correção do texto "Dado aisso" na descrição do gemspec
17
+
18
+ ## [0.7.0] - 2025-04-21
19
+
20
+ - Integração da API do CPTEC
21
+ - Integração da API da Tabela FIPE
22
+ - Integração da API de ISBN
23
+ - Integração da API de NCM
24
+ - Integração da API de PIX
25
+ - Integração da API de Registros BR
26
+ - Integração da API de Taxas
27
+
3
28
  ## [0.6.0] - 2024-02-25
4
29
 
5
30
  - Integração da API do IBGE
data/Gemfile CHANGED
@@ -7,8 +7,8 @@ gemspec
7
7
  group :development do
8
8
  gem "rake", "~> 13.0"
9
9
  gem "rspec", "~> 3.0"
10
- gem "rubocop", "~> 1.21"
11
- gem "rubocop-rspec", "~> 2.24"
12
- gem "vcr", "~> 6.2"
13
- gem "webmock", "~> 3.19"
10
+ gem "rubocop", "~> 1.86"
11
+ gem "rubocop-rspec", "~> 3.0"
12
+ gem "vcr", "~> 6.3"
13
+ gem "webmock", "~> 3.25"
14
14
  end
data/Gemfile.lock CHANGED
@@ -1,85 +1,87 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brasilapi (0.6.0)
4
+ brasilapi (0.8.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- addressable (2.8.5)
10
- public_suffix (>= 2.0.2, < 6.0)
11
- ast (2.4.2)
12
- base64 (0.1.1)
13
- crack (0.4.5)
9
+ addressable (2.9.0)
10
+ public_suffix (>= 2.0.2, < 8.0)
11
+ ast (2.4.3)
12
+ bigdecimal (4.1.3)
13
+ crack (1.0.1)
14
+ bigdecimal
14
15
  rexml
15
- diff-lcs (1.5.0)
16
- hashdiff (1.0.1)
17
- json (2.6.3)
18
- language_server-protocol (3.17.0.3)
19
- parallel (1.23.0)
20
- parser (3.2.2.4)
16
+ diff-lcs (1.6.2)
17
+ hashdiff (1.2.1)
18
+ json (3.1.0)
19
+ language_server-protocol (3.17.0.6)
20
+ lint_roller (1.1.0)
21
+ parallel (2.3.0)
22
+ parser (3.3.12.0)
21
23
  ast (~> 2.4.1)
22
24
  racc
23
- public_suffix (5.0.3)
24
- racc (1.7.1)
25
+ prism (1.9.0)
26
+ public_suffix (7.0.5)
27
+ racc (1.8.1)
25
28
  rainbow (3.1.1)
26
- rake (13.0.6)
27
- regexp_parser (2.8.2)
28
- rexml (3.2.6)
29
- rspec (3.12.0)
30
- rspec-core (~> 3.12.0)
31
- rspec-expectations (~> 3.12.0)
32
- rspec-mocks (~> 3.12.0)
33
- rspec-core (3.12.2)
34
- rspec-support (~> 3.12.0)
35
- rspec-expectations (3.12.3)
29
+ rake (13.4.2)
30
+ regexp_parser (2.13.1)
31
+ rexml (3.4.4)
32
+ rspec (3.13.2)
33
+ rspec-core (~> 3.13.0)
34
+ rspec-expectations (~> 3.13.0)
35
+ rspec-mocks (~> 3.13.0)
36
+ rspec-core (3.13.6)
37
+ rspec-support (~> 3.13.0)
38
+ rspec-expectations (3.13.5)
36
39
  diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.12.0)
38
- rspec-mocks (3.12.6)
40
+ rspec-support (~> 3.13.0)
41
+ rspec-mocks (3.13.8)
39
42
  diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.12.0)
41
- rspec-support (3.12.1)
42
- rubocop (1.57.1)
43
- base64 (~> 0.1.1)
44
- json (~> 2.3)
45
- language_server-protocol (>= 3.17.0)
46
- parallel (~> 1.10)
47
- parser (>= 3.2.2.4)
43
+ rspec-support (~> 3.13.0)
44
+ rspec-support (3.13.7)
45
+ rubocop (1.92.0)
46
+ json (>= 2.3)
47
+ language_server-protocol (~> 3.17.0.2)
48
+ lint_roller (~> 1.1.0)
49
+ parallel (>= 1.10)
50
+ parser (>= 3.3.0.2)
48
51
  rainbow (>= 2.2.2, < 4.0)
49
- regexp_parser (>= 1.8, < 3.0)
50
- rexml (>= 3.2.5, < 4.0)
51
- rubocop-ast (>= 1.28.1, < 2.0)
52
+ regexp_parser (>= 2.11.3, < 3.0)
53
+ rubocop-ast (>= 1.49.0, < 2.0)
52
54
  ruby-progressbar (~> 1.7)
53
- unicode-display_width (>= 2.4.0, < 3.0)
54
- rubocop-ast (1.29.0)
55
- parser (>= 3.2.1.0)
56
- rubocop-capybara (2.19.0)
57
- rubocop (~> 1.41)
58
- rubocop-factory_bot (2.24.0)
59
- rubocop (~> 1.33)
60
- rubocop-rspec (2.24.1)
61
- rubocop (~> 1.33)
62
- rubocop-capybara (~> 2.17)
63
- rubocop-factory_bot (~> 2.22)
55
+ unicode-display_width (>= 2.4.0, < 4.0)
56
+ rubocop-ast (1.50.0)
57
+ parser (>= 3.3.7.2)
58
+ prism (~> 1.7)
59
+ rubocop-rspec (3.10.2)
60
+ lint_roller (~> 1.1)
61
+ regexp_parser (>= 2.0)
62
+ rubocop (~> 1.86, >= 1.86.2)
64
63
  ruby-progressbar (1.13.0)
65
- unicode-display_width (2.5.0)
66
- vcr (6.2.0)
67
- webmock (3.19.1)
64
+ unicode-display_width (3.3.0)
65
+ unicode-emoji (~> 4.3)
66
+ unicode-emoji (4.3.0)
67
+ vcr (6.4.0)
68
+ webmock (3.34.0)
68
69
  addressable (>= 2.8.0)
69
70
  crack (>= 0.3.2)
70
71
  hashdiff (>= 0.4.0, < 2.0.0)
71
72
 
72
73
  PLATFORMS
74
+ ruby
73
75
  x86_64-linux
74
76
 
75
77
  DEPENDENCIES
76
78
  brasilapi!
77
79
  rake (~> 13.0)
78
80
  rspec (~> 3.0)
79
- rubocop (~> 1.21)
80
- rubocop-rspec (~> 2.24)
81
- vcr (~> 6.2)
82
- webmock (~> 3.19)
81
+ rubocop (~> 1.86)
82
+ rubocop-rspec (~> 3.0)
83
+ vcr (~> 6.3)
84
+ webmock (~> 3.25)
83
85
 
84
86
  BUNDLED WITH
85
- 2.4.10
87
+ 4.0.23
data/README.md CHANGED
@@ -10,16 +10,16 @@ Dependency-less Brasil API lookup gem for brazilian data with an easy-to-use API
10
10
  - [x] **CEP (Zip code)**
11
11
  - [x] **CNPJ**
12
12
  - [x] **Corretoras**
13
- - [ ] **CPTEC**
13
+ - [x] **CPTEC**
14
14
  - [x] **DDD**
15
15
  - [x] **Feriados Nacionais**
16
- - [ ] **FIPE**
16
+ - [x] **FIPE**
17
17
  - [x] **IBGE**
18
- - [ ] **ISBN**
19
- - [ ] **NCM**
20
- - [ ] **PIX**
21
- - [ ] **Registros BR**
22
- - [ ] **Taxas**
18
+ - [x] **ISBN**
19
+ - [x] **NCM**
20
+ - [x] **PIX**
21
+ - [x] **Registros BR**
22
+ - [x] **Taxas**
23
23
 
24
24
  ## Installation
25
25
 
@@ -138,6 +138,30 @@ BrasilAPI::IBGE.cities_by_state('CE')
138
138
  ```
139
139
 
140
140
 
141
+ ## Configuration
142
+
143
+ Requests time out after 10 seconds (`open_timeout` and `read_timeout`). Override the default when a provider is slow:
144
+
145
+ ```ruby
146
+ BrasilAPI.configure do |config|
147
+ config.timeout = 30
148
+ end
149
+ ```
150
+
151
+ `Net::OpenTimeout` and `Net::ReadTimeout` are raised as `BrasilAPI::Timeout`. HTTP failures are `BrasilAPI::Error` (or a subclass such as `NotFound`, `BadRequest` and `ServerError`) and expose `status`, `message`, `type` and `body`.
152
+
153
+ ## Release
154
+
155
+ Publishing to RubyGems happens when a pull request that bumps the version is merged into `main`:
156
+
157
+ 1. Bump `BrasilAPI::VERSION` in `lib/brasil_api/version.rb`.
158
+ 2. Move the `[Unreleased]` section of `CHANGELOG.md` into that version, with the date.
159
+ 3. Open a pull request and merge it into `main`.
160
+
161
+ `.github/workflows/release.yml` runs the test suite, creates the `vX.Y.Z` tag, publishes a GitHub Release using that version's changelog notes, and pushes the gem with RubyGems Trusted Publishing (OIDC). If the version already has a `vX.Y.Z` tag, the workflow does nothing.
162
+
163
+ Before the first automated publish, register a trusted publisher on rubygems.org for `dayvidemerson/brasilapi-rb` and the workflow file `release.yml`, with no GitHub environment. The gemspec keeps `rubygems_mfa_required`.
164
+
141
165
  # License
142
166
  [MIT](./LICENSE)
143
167
 
@@ -2,40 +2,122 @@
2
2
 
3
3
  require "json"
4
4
  require "net/http"
5
+ require "uri"
5
6
 
6
7
  module BrasilAPI
7
8
  class Base
8
9
  BASE_URL = "https://brasilapi.com.br/api"
9
10
 
10
11
  class << self
11
- def get(path)
12
- uri = URI("#{BASE_URL}#{path}")
12
+ def get(path, params = {})
13
+ request_data(build_uri(path, params))
14
+ end
13
15
 
14
- response = Net::HTTP.get_response(uri)
16
+ protected
15
17
 
16
- case status_for(response)
17
- when 200
18
- parsed_body(response)
19
- when 404
20
- raise BrasilAPI::NotFound
21
- else
22
- raise BrasilAPI::Error
23
- end
18
+ def request_data(uri)
19
+ response = perform_request(uri)
20
+ return parsed_body(response) if response.is_a?(Net::HTTPSuccess)
21
+
22
+ raise_api_error(response)
23
+ rescue Net::OpenTimeout, Net::ReadTimeout => e
24
+ raise BrasilAPI::Timeout, e.message
24
25
  end
25
26
 
26
- protected
27
+ private
28
+
29
+ def build_uri(path, params)
30
+ uri = URI.parse("#{BASE_URL}#{encode_path(path)}")
31
+ query = params.compact
32
+ uri.query = URI.encode_www_form(query) unless query.empty?
33
+ uri
34
+ end
27
35
 
28
- def status_for(response)
29
- status = {
30
- Net::HTTPOK => 200,
31
- Net::HTTPNotFound => 404
32
- }
36
+ def encode_path(path)
37
+ path.split("/", -1).map { |segment| encode_segment(segment) }.join("/")
38
+ end
33
39
 
34
- status[response.class]
40
+ # Encode each segment on its own so "?", "#" and spaces stay inside the path.
41
+ # encode_uri_component keeps spaces as %20, matching the recorded cassettes.
42
+ def encode_segment(segment)
43
+ URI.encode_uri_component(segment)
44
+ end
45
+
46
+ def perform_request(uri)
47
+ Net::HTTP.start(
48
+ uri.hostname,
49
+ uri.port,
50
+ use_ssl: uri.scheme == "https",
51
+ open_timeout: BrasilAPI.config.timeout,
52
+ read_timeout: BrasilAPI.config.timeout
53
+ ) do |http|
54
+ http.request(Net::HTTP::Get.new(uri))
55
+ end
35
56
  end
36
57
 
37
58
  def parsed_body(response)
38
- JSON.parse(response.body) if response.body
59
+ body = utf8_body(response)
60
+ return if body.nil? || body.empty?
61
+
62
+ JSON.parse(body)
63
+ end
64
+
65
+ def raise_api_error(response)
66
+ parsed = parse_error_body(response)
67
+ raise error_class_for(response).new(
68
+ error_message(parsed, response),
69
+ status: response.code.to_i,
70
+ body: error_body(parsed, response),
71
+ type: error_type(parsed)
72
+ )
73
+ end
74
+
75
+ def parse_error_body(response)
76
+ body = utf8_body(response)
77
+ return if body.nil? || body.empty?
78
+
79
+ JSON.parse(body)
80
+ rescue JSON::ParserError
81
+ nil
82
+ end
83
+
84
+ def utf8_body(response)
85
+ body = response.body
86
+ return if body.nil?
87
+
88
+ body.dup.force_encoding(Encoding::UTF_8)
89
+ end
90
+
91
+ def error_message(parsed, response)
92
+ return parsed["message"] if parsed.is_a?(Hash) && parsed["message"]
93
+
94
+ body = utf8_body(response)
95
+ return body if body && !body.empty?
96
+
97
+ "HTTP #{response.code}"
98
+ end
99
+
100
+ def error_body(parsed, response)
101
+ return parsed unless parsed.nil?
102
+
103
+ utf8_body(response)
104
+ end
105
+
106
+ def error_type(parsed)
107
+ parsed["type"] if parsed.is_a?(Hash)
108
+ end
109
+
110
+ def error_class_for(response)
111
+ case response.code.to_i
112
+ when 400
113
+ BrasilAPI::BadRequest
114
+ when 404
115
+ BrasilAPI::NotFound
116
+ when 500..599
117
+ BrasilAPI::ServerError
118
+ else
119
+ BrasilAPI::Error
120
+ end
39
121
  end
40
122
  end
41
123
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrasilAPI
4
+ class Configuration
5
+ DEFAULT_TIMEOUT = 10
6
+
7
+ attr_accessor :timeout
8
+
9
+ def initialize
10
+ @timeout = DEFAULT_TIMEOUT
11
+ end
12
+ end
13
+
14
+ class << self
15
+ def configure
16
+ yield config
17
+ end
18
+
19
+ def config
20
+ @config ||= Configuration.new
21
+ end
22
+
23
+ def reset_config!
24
+ @config = Configuration.new
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrasilAPI
4
+ class CPTEC < Base
5
+ class << self
6
+ def all
7
+ get("/cptec/v1/cidade")
8
+ end
9
+
10
+ def search_location(city_name)
11
+ get("/cptec/v1/cidade/#{city_name}")
12
+ end
13
+
14
+ def capital_weather
15
+ get("/cptec/v1/clima/capital")
16
+ end
17
+
18
+ def airport_weather(code)
19
+ get("/cptec/v1/clima/aeroporto/#{code}")
20
+ end
21
+
22
+ def city_weather(city_code, days = nil)
23
+ if days
24
+ get("/cptec/v1/clima/previsao/#{city_code}/#{days}")
25
+ else
26
+ get("/cptec/v1/clima/previsao/#{city_code}")
27
+ end
28
+ end
29
+
30
+ def ocean_forecast(city_code, days = nil)
31
+ if days
32
+ get("/cptec/v1/ondas/#{city_code}/#{days}")
33
+ else
34
+ get("/cptec/v1/ondas/#{city_code}")
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrasilAPI
4
+ class Error < StandardError
5
+ attr_reader :status, :body, :type
6
+
7
+ def initialize(message = nil, status: nil, body: nil, type: nil)
8
+ @status = status
9
+ @body = body
10
+ @type = type
11
+ super(message)
12
+ end
13
+ end
14
+
15
+ class NotFound < Error; end
16
+
17
+ class BadRequest < Error; end
18
+
19
+ class ServerError < Error; end
20
+
21
+ class Timeout < Error; end
22
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrasilAPI
4
+ class FIPE < Base
5
+ class << self
6
+ # https://brasilapi.com.br/api/fipe/marcas/v1/{tipoVeiculo}
7
+ def vehicle_brands(vehicle_type, reference_table = nil)
8
+ get("/fipe/marcas/v1/#{vehicle_type}", { tabela_referencia: reference_table })
9
+ end
10
+
11
+ # https://brasilapi.com.br/api/fipe/preco/v1/{codigoFipe}
12
+ def vehicle_price(vehicle_code, reference_table = nil)
13
+ get("/fipe/preco/v1/#{vehicle_code}", { tabela_referencia: reference_table })
14
+ end
15
+
16
+ # https://brasilapi.com.br/api/fipe/tabelas/v1
17
+ def fipe_tables
18
+ get("/fipe/tabelas/v1")
19
+ end
20
+
21
+ # https://brasilapi.com.br/api/fipe/veiculos/v1/{tipoVeiculo}/{codigoMarca}
22
+ def list_vehicles(vehicle_type, brand_code, reference_table = nil)
23
+ get("/fipe/veiculos/v1/#{vehicle_type}/#{brand_code}", { tabela_referencia: reference_table })
24
+ end
25
+ end
26
+ end
27
+ end
@@ -14,8 +14,7 @@ module BrasilAPI
14
14
  def cities_by_state(state_abbr, providers: [])
15
15
  return get("/ibge/municipios/v1/#{state_abbr}") if providers.empty?
16
16
 
17
- providers_query = providers.join(",")
18
- get("/ibge/municipios/v1/#{state_abbr}?providers=#{providers_query}")
17
+ get("/ibge/municipios/v1/#{state_abbr}", providers: providers.join(","))
19
18
  end
20
19
  end
21
20
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrasilAPI
4
+ class ISBN < Base
5
+ class << self
6
+ def search(code, providers: [])
7
+ return get("/isbn/v1/#{code}") if providers.empty?
8
+
9
+ get("/isbn/v1/#{code}", providers: providers.join(","))
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrasilAPI
4
+ class NCM < Base
5
+ class << self
6
+ def all
7
+ get("/ncm/v1")
8
+ end
9
+
10
+ def search(code)
11
+ get("/ncm/v1", { search: code })
12
+ end
13
+
14
+ def find_by_code(code)
15
+ get("/ncm/v1/#{code}")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrasilAPI
4
+ class PIX < Base
5
+ class << self
6
+ def all
7
+ get("/pix/v1/participants")
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrasilAPI
4
+ class RegistroBR < Base
5
+ class << self
6
+ def whois(domain)
7
+ get("/registrobr/v1/#{domain}")
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrasilAPI
4
+ class Taxas < Base
5
+ class << self
6
+ def all
7
+ get("/taxas/v1")
8
+ end
9
+
10
+ def find_by_name(name)
11
+ get("/taxas/v1/#{name}")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrasilAPI
4
- VERSION = "0.6.0"
4
+ VERSION = "0.8.0"
5
5
  end
data/lib/brasil_api.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "brasil_api/version"
4
+ require_relative "brasil_api/configuration"
5
+ require_relative "brasil_api/error"
4
6
  require_relative "brasil_api/base"
5
7
  require_relative "brasil_api/address"
6
8
  require_relative "brasil_api/bank"
@@ -8,8 +10,10 @@ require_relative "brasil_api/company"
8
10
  require_relative "brasil_api/cvm"
9
11
  require_relative "brasil_api/holiday"
10
12
  require_relative "brasil_api/ibge"
11
-
12
- module BrasilAPI
13
- class Error < StandardError; end
14
- class NotFound < StandardError; end
15
- end
13
+ require_relative "brasil_api/cptec"
14
+ require_relative "brasil_api/fipe"
15
+ require_relative "brasil_api/isbn"
16
+ require_relative "brasil_api/ncm"
17
+ require_relative "brasil_api/pix"
18
+ require_relative "brasil_api/registrobr"
19
+ require_relative "brasil_api/taxas"
metadata CHANGED
@@ -1,20 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brasilapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dayvid Emerson
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-02-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: Acesso programático de informações é algo fundamental na comunicação
14
13
  entre sistemas, mas, para nossa surpresa, uma informação tão útil e pública quanto
15
14
  um CEP não consegue ser acessada diretamente por um navegador por conta da API dos
16
- Correios não possuir CORS habilitado. Dado aisso, este projeto experimental tem
17
- como objetivo centralizar e disponibilizar endpoints modernos com baixíssima latência
15
+ Correios não possuir CORS habilitado. Dado isso, este projeto experimental tem como
16
+ objetivo centralizar e disponibilizar endpoints modernos com baixíssima latência
18
17
  utilizando tecnologias como Vercel Smart CDN responsável por fazer o cache das informações
19
18
  em atualmente 23 regiões distribuídas ao longo do mundo (incluindo Brasil). Então
20
19
  não importa o quão devagar for a fonte dos dados, nós queremos disponibilizá-la
@@ -34,15 +33,23 @@ files:
34
33
  - LICENSE.txt
35
34
  - README.md
36
35
  - Rakefile
37
- - brasilapi.gemspec
38
36
  - lib/brasil_api.rb
39
37
  - lib/brasil_api/address.rb
40
38
  - lib/brasil_api/bank.rb
41
39
  - lib/brasil_api/base.rb
42
40
  - lib/brasil_api/company.rb
41
+ - lib/brasil_api/configuration.rb
42
+ - lib/brasil_api/cptec.rb
43
43
  - lib/brasil_api/cvm.rb
44
+ - lib/brasil_api/error.rb
45
+ - lib/brasil_api/fipe.rb
44
46
  - lib/brasil_api/holiday.rb
45
47
  - lib/brasil_api/ibge.rb
48
+ - lib/brasil_api/isbn.rb
49
+ - lib/brasil_api/ncm.rb
50
+ - lib/brasil_api/pix.rb
51
+ - lib/brasil_api/registrobr.rb
52
+ - lib/brasil_api/taxas.rb
46
53
  - lib/brasil_api/version.rb
47
54
  - lib/brasilapi.rb
48
55
  homepage: https://brasilapi.com.br
@@ -53,7 +60,7 @@ metadata:
53
60
  source_code_uri: https://github.com/dayvidemerson/brasilapi-rb
54
61
  changelog_uri: https://github.com/dayvidemerson/brasilapi-rb/blob/main/CHANGELOG.md
55
62
  rubygems_mfa_required: 'true'
56
- post_install_message:
63
+ github_repo: ssh://github.com/dayvidemerson/brasilapi-rb
57
64
  rdoc_options: []
58
65
  require_paths:
59
66
  - lib
@@ -61,15 +68,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
68
  requirements:
62
69
  - - ">="
63
70
  - !ruby/object:Gem::Version
64
- version: 2.6.0
71
+ version: 3.3.0
65
72
  required_rubygems_version: !ruby/object:Gem::Requirement
66
73
  requirements:
67
74
  - - ">="
68
75
  - !ruby/object:Gem::Version
69
76
  version: '0'
70
77
  requirements: []
71
- rubygems_version: 3.4.10
72
- signing_key:
78
+ rubygems_version: 3.6.9
73
79
  specification_version: 4
74
80
  summary: Cliente desenvolvido em Ruby para o consumo da Brasil API que permite buscar
75
81
  informações públicas referentes ao Brasil de modo eficiente e simplificado.
data/brasilapi.gemspec DELETED
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/brasil_api/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "brasilapi"
7
- spec.version = BrasilAPI::VERSION
8
- spec.authors = ["Dayvid Emerson"]
9
- spec.email = ["dayvidemerson96@gmail.com"]
10
-
11
- spec.summary = "Cliente desenvolvido em Ruby para o consumo da Brasil API que permite buscar informações públicas " \
12
- "referentes ao Brasil de modo eficiente e simplificado."
13
-
14
- spec.description = "Acesso programático de informações é algo fundamental na comunicação entre sistemas, mas, para " \
15
- "nossa surpresa, uma informação tão útil e pública quanto um CEP não consegue ser acessada " \
16
- "diretamente por um navegador por conta da API dos Correios não possuir CORS habilitado. Dado a" \
17
- "isso, este projeto experimental tem como objetivo centralizar e disponibilizar endpoints " \
18
- "modernos com baixíssima latência utilizando tecnologias como Vercel Smart CDN responsável por " \
19
- "fazer o cache das informações em atualmente 23 regiões distribuídas ao longo do mundo " \
20
- "(incluindo Brasil). Então não importa o quão devagar for a fonte dos dados, nós queremos " \
21
- "disponibilizá-la da forma mais rápida e moderna possível."
22
-
23
- spec.homepage = "https://brasilapi.com.br"
24
- spec.license = "MIT"
25
- spec.required_ruby_version = ">= 2.6.0"
26
-
27
- spec.metadata["homepage_uri"] = spec.homepage
28
- spec.metadata["source_code_uri"] = "https://github.com/dayvidemerson/brasilapi-rb"
29
- spec.metadata["changelog_uri"] = "https://github.com/dayvidemerson/brasilapi-rb/blob/main/CHANGELOG.md"
30
- spec.metadata["rubygems_mfa_required"] = "true"
31
-
32
- # Specify which files should be added to the gem when it is released.
33
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
34
- spec.files = Dir.chdir(__dir__) do
35
- `git ls-files -z`.split("\x0").reject do |f|
36
- (File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
37
- end
38
- end
39
- spec.bindir = "exe"
40
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
41
- spec.require_paths = ["lib"]
42
- end