brasilapi 0.1.1 → 0.2.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: faf147eab485ce3d22b3eb5494a2c535bd5c69d9313fa5814b73ac71e4edea2c
4
- data.tar.gz: 43f91d2407ca7642fa10952960171cf7a1bba515391d7f4fce07d3dfda846e54
3
+ metadata.gz: ef15edf76d0e1f026aaabd778ec39818a15e997665ce7cc69f141721e5821d7a
4
+ data.tar.gz: 87589410fb6001bc5ac7f812093aa06eb05630b76b3740942292db4b9e8f925e
5
5
  SHA512:
6
- metadata.gz: 01f8951df122e6eb7aaa8852e0da80d96642c5a07c2be724b1207fae7933e7f0beb43af2ad140a61099ec1b6cae197b4ede61158e56dcf1542d5b77af0e09278
7
- data.tar.gz: c7a842fbf31b410ca0968f22691ef3eeb4bfdc11c6567d05bd0f885868f41bd8ac742f78c8d5e31088ebd738c5336c65a5e76adcdfa08724068909d0f19973c5
6
+ metadata.gz: cfb2dc5073d80d5ccd9d15feddd0db36c5d35f94ce1fabd535886ea77cf483a4bbd5762d32008bad52c57dad3230755733061862cc1909f1cc53108e24c1aa70
7
+ data.tar.gz: e3ead0c46fb342e224be7a4b488583fa8c2f571c739f4fe445da299a9f13eebc9d282ccadd7e5a0d642c3f3d54e2b0b07defcfea8cc19490e3affa4a7b60fa75
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2023-10-24
4
+
5
+ - Integração da API de CEP's
6
+
3
7
  ## [0.1.1] - 2023-10-23
8
+
4
9
  - Corrigindo versão publicada no RubyGems
5
10
 
6
11
  ## [0.1.0] - 2023-10-23
@@ -8,4 +13,4 @@
8
13
  - Configuração do Projeto
9
14
  - Integração da API de Bancos
10
15
  - Integração da API de CNPJ's
11
- - Atualizar README com informações de instalação e sobre a BrasilAPI
16
+ - Atualizar README com informações de instalação e sobre a BrasilAPI
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brasilapi (0.1.0)
4
+ brasilapi (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -7,7 +7,7 @@ Dependency-less Brasil API lookup gem for brazilian data with an easy-to-use API
7
7
 
8
8
  ## Features
9
9
  - [x] **Bank**
10
- - [ ] **CEP (Zip code)**
10
+ - [x] **CEP (Zip code)**
11
11
  - [x] **CNPJ**
12
12
  - [ ] **Corretoras**
13
13
  - [ ] **CPTEC**
@@ -55,6 +55,18 @@ BrasilAPI::Company.find_by_cnpj("60316817000103")
55
55
  "qsa"=>
56
56
  [{"pais"=>"ESTADOS UNIDOS",
57
57
  ...}
58
+
59
+ # find address by zip_code
60
+ BrasilAPI::Address.find_by_zip_code('64001100')
61
+ => {"cep"=>"64001100", "state"=>"PI", "city"=>"Teresina", "neighborhood"=>"Centro", "street"=>"Praça Pedro II", "service"=>"correios"}
62
+
63
+ # find address with location by zip_code
64
+ BrasilAPI::Address.find_by_zip_code('80060000', location: true)
65
+ =>
66
+ {"cep"=>"80060000",
67
+ "state"=>"PR",
68
+ ...
69
+ "location"=>{"type"=>"Point", "coordinates"=>{"longitude"=>"-49.2614791", "latitude"=>"-25.427253"}}}
58
70
  ```
59
71
 
60
72
  # License
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrasilAPI
4
+ class Address < Base
5
+ class << self
6
+ def find_by_zip_code(zip_code, location: false)
7
+ return get("/cep/v2/#{zip_code}") if location
8
+
9
+ get("/cep/v1/#{zip_code}")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrasilAPI
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/brasil_api.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "brasil_api/version"
4
4
  require_relative "brasil_api/base"
5
+ require_relative "brasil_api/address"
5
6
  require_relative "brasil_api/bank"
6
7
  require_relative "brasil_api/company"
7
8
 
data/lib/brasilapi.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "brasil_api"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brasilapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dayvid Emerson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-23 00:00:00.000000000 Z
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Acesso programático de informações é algo fundamental na comunicação
14
14
  entre sistemas, mas, para nossa surpresa, uma informação tão útil e pública quanto
@@ -36,10 +36,12 @@ files:
36
36
  - Rakefile
37
37
  - brasilapi.gemspec
38
38
  - lib/brasil_api.rb
39
+ - lib/brasil_api/address.rb
39
40
  - lib/brasil_api/bank.rb
40
41
  - lib/brasil_api/base.rb
41
42
  - lib/brasil_api/company.rb
42
43
  - lib/brasil_api/version.rb
44
+ - lib/brasilapi.rb
43
45
  homepage: https://brasilapi.com.br
44
46
  licenses:
45
47
  - MIT