bancos_brasileiros 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +72 -19
- data/bancos_brasileiros-0.1.0.gem +0 -0
- data/bancos_brasileiros-0.1.1.gem +0 -0
- data/data/bancos.json +10151 -0
- data/lib/bancos_brasileiros/version.rb +1 -1
- data/lib/bancos_brasileiros.rb +31 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96be3635b8df0b4c066e06deee0364c36d6fb61580e3fd0c76a3ecd256a76efe
|
4
|
+
data.tar.gz: bb26b0c533c5e983ad3885c8da9764ce2be0892c5fe1c7b4b8b6c2dca87a2f26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f00d5d58211f72a7c39214ee712e190a1ae952f4f24ae414dc8547ae3c7700bfcafaacade678918de3597533a1ff0fb59e78d41d032178d53b64042a11e17e5d
|
7
|
+
data.tar.gz: 61c64b8a61db2714e0692b8c89c7f7b82438b556b4b3110a77d115bc08fbcf6197d410202e8e7bc80232f9f9992e896b4683ec0d63588500dd57a344404729fd
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,30 +1,83 @@
|
|
1
|
-
#
|
1
|
+
# Bancos Brasileiros
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bancos_brasileiros`. To experiment with that code, run `bin/console` for an interactive prompt.
|
3
|
+
🇧🇷 🏦 📋 Brazilian commercial banks list
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
12
|
-
|
13
|
-
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
14
|
-
|
15
|
-
If bundler is not being used to manage dependencies, install the gem by executing:
|
7
|
+
Add gem in your Gemfile:
|
16
8
|
|
17
|
-
|
9
|
+
```ruby
|
10
|
+
gem 'bancos_brasileiros'
|
11
|
+
```
|
12
|
+
and run **bundle install**
|
18
13
|
|
19
14
|
## Usage
|
20
15
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
+
|
77
|
+
## Requirements
|
78
|
+
|
79
|
+
- Ruby >= 2.6.0 (recommended 2.7+)
|
80
|
+
- Rails >= 6.0 (compatible up to Rails 7)
|
28
81
|
|
29
82
|
## Contributing to Bancos Brasileiros
|
30
83
|
|
Binary file
|
Binary file
|