bancos_brasileiros 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a94008e2224172585906defd9ea32701115421c4ed642c2f83544c9fa45400c0
4
- data.tar.gz: 361a1b62a8226f51bbcb4856a83bcec30d9e3f9856c2ca60f190ad91751a33b8
3
+ metadata.gz: 96be3635b8df0b4c066e06deee0364c36d6fb61580e3fd0c76a3ecd256a76efe
4
+ data.tar.gz: bb26b0c533c5e983ad3885c8da9764ce2be0892c5fe1c7b4b8b6c2dca87a2f26
5
5
  SHA512:
6
- metadata.gz: 8adec4a93cce14226e8c0b7520ec6ac106bdb9ffa8cfd2b3af729527924371db1fa2940de1c1dcba0b15f1e9dd7537ae6dc1194f68e29e88b149ac7a39282cdb
7
- data.tar.gz: 91e18688b8e73762fb3fc07489da7a57ce0d21981f8aea5e995b335ff7ba704dd2712bf506396a19ae0784793c100ddea70aa865bb8a9eb0d9fb4ddcc77174f6
6
+ metadata.gz: f00d5d58211f72a7c39214ee712e190a1ae952f4f24ae414dc8547ae3c7700bfcafaacade678918de3597533a1ff0fb59e78d41d032178d53b64042a11e17e5d
7
+ data.tar.gz: 61c64b8a61db2714e0692b8c89c7f7b82438b556b4b3110a77d115bc08fbcf6197d410202e8e7bc80232f9f9992e896b4683ec0d63588500dd57a344404729fd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.2
2
+
3
+ - Change README
4
+
1
5
  ## 0.1.1
2
6
 
3
7
  - Add json with all banks (updated until Jul 13, 2024)
data/README.md CHANGED
@@ -11,6 +11,69 @@ gem 'bancos_brasileiros'
11
11
  ```
12
12
  and run **bundle install**
13
13
 
14
+ ## Usage
15
+
16
+ Example of how to use the `bancos_brasileiros` in a rails project:
17
+
18
+ Create a controller:
19
+
20
+ ```ruby
21
+ # app/controllers/banks_controller.rb
22
+ class BanksController < ApplicationController
23
+ def index
24
+ render json: BancosBrasileiros.all_banks
25
+ end
26
+
27
+ def show
28
+ bank = BancosBrasileiros.find_bank_by_compe(params[:id])
29
+ if bank
30
+ render json: bank
31
+ else
32
+ render json: { error: 'Bank not found.' }, status: :not_found
33
+ end
34
+ end
35
+
36
+ def by_ispb
37
+ bank = BancosBrasileiros.find_bank_by_ispb(params[:ispb])
38
+ if bank
39
+ render json: bank
40
+ else
41
+ render json: { error: 'Bank not found.' }, status: :not_found
42
+ end
43
+ end
44
+
45
+ def by_network
46
+ banks = BancosBrasileiros.find_banks_by_network(params[:network])
47
+ render json: bancos
48
+ end
49
+
50
+ def by_type
51
+ banks = BancosBrasileiros.find_banks_by_type(params[:type])
52
+ render json: banks
53
+ end
54
+
55
+ def by_pix_type
56
+ banks = BancosBrasileiros.find_banks_by_pix_type(params[:pix_type])
57
+ render json: banks
58
+ end
59
+ end
60
+ ```
61
+ Create routes:
62
+
63
+ ```ruby
64
+ # config/routes.rb
65
+ Rails.application.routes.draw do
66
+ resources :banks, only: [:index, :show] do
67
+ collection do
68
+ get 'by_ispb/:ispb', to: 'banks#by_ispb'
69
+ get 'by_network/:network', to: 'banks#by_network'
70
+ get 'by_type/:type', to: 'banks#by_type'
71
+ get 'by_pix_type/:pix_type', to: 'banks#by_pix_type'
72
+ end
73
+ end
74
+ end
75
+ ```
76
+
14
77
  ## Requirements
15
78
 
16
79
  - Ruby >= 2.6.0 (recommended 2.7+)
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BancosBrasileiros
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bancos_brasileiros
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elton Santos
@@ -23,6 +23,7 @@ files:
23
23
  - README.md
24
24
  - Rakefile
25
25
  - bancos_brasileiros-0.1.0.gem
26
+ - bancos_brasileiros-0.1.1.gem
26
27
  - bancos_brasileiros.gemspec
27
28
  - data/bancos.json
28
29
  - lib/bancos_brasileiros.rb