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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +63 -0
- data/bancos_brasileiros-0.1.1.gem +0 -0
- data/lib/bancos_brasileiros/version.rb +1 -1
- metadata +2 -1
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
@@ -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
|
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.
|
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
|