bancos_brasileiros 0.1.2 → 0.1.3

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: 96be3635b8df0b4c066e06deee0364c36d6fb61580e3fd0c76a3ecd256a76efe
4
- data.tar.gz: bb26b0c533c5e983ad3885c8da9764ce2be0892c5fe1c7b4b8b6c2dca87a2f26
3
+ metadata.gz: 30339bda5226f9da5f97b9cd634a9ed180b48d71db984bdd6bd46ec0c622de94
4
+ data.tar.gz: 2a3b8d73de7b39b5b659df47ec2f233fe548943e074ef6e2759c27aca8d555e2
5
5
  SHA512:
6
- metadata.gz: f00d5d58211f72a7c39214ee712e190a1ae952f4f24ae414dc8547ae3c7700bfcafaacade678918de3597533a1ff0fb59e78d41d032178d53b64042a11e17e5d
7
- data.tar.gz: 61c64b8a61db2714e0692b8c89c7f7b82438b556b4b3110a77d115bc08fbcf6197d410202e8e7bc80232f9f9992e896b4683ec0d63588500dd57a344404729fd
6
+ metadata.gz: a67bdd5d7beb2442e97f674ac4dd80cf385dfd6d12d147dafdc4ced7b34dafe36ec97b5148ef80a79474dc36556b389d28bafc1ef34095e80266658d861ae863
7
+ data.tar.gz: 31123aa9e416a513544f672d2e65fa3ef7b3eacb4065cd5896fe74745c3544605082585d7577d7e50c23897ee582caa666325a811b73d43282b9c41b588cc3ea
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.1.3
2
+
3
+ - Change README
4
+ - Add view example
5
+
1
6
  ## 0.1.2
2
7
 
3
8
  - Change README
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Bancos Brasileiros
2
2
 
3
- 🇧🇷 🏦 📋 Brazilian commercial banks list
3
+ 🇧🇷 🏦 📋 Brazilian commercial banks list.
4
+
5
+ This gem was created to meet a need in the [Brazilian Banks Project](https://guibranco.github.io/BancosBrasileiros/), developed by [Guilherme Branco](https://github.com/guibranco). The project keeps an up-to-date list of banks in various programming languages, and I realized the need to provide support for Rails as well.
4
6
 
5
7
  ## Installation
6
8
 
@@ -20,41 +22,63 @@ Create a controller:
20
22
  ```ruby
21
23
  # app/controllers/banks_controller.rb
22
24
  class BanksController < ApplicationController
25
+
23
26
  def index
24
- render json: BancosBrasileiros.all_banks
27
+ @banks = BancosBrasileiros.all_banks
28
+ respond_to do |format|
29
+ format.html
30
+ format.json { render json: @banks }
31
+ end
25
32
  end
26
33
 
27
34
  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
35
+ @bank = BancosBrasileiros.find_bank_by_compe(params[:id])
36
+ respond_to do |format|
37
+ if @bank
38
+ format.html
39
+ format.json { render json: @bank }
40
+ else
41
+ format.html { render plain: 'Bank not found.', status: :not_found }
42
+ format.json { render json: { error: 'Bank not found.' }, status: :not_found }
43
+ end
33
44
  end
34
45
  end
35
46
 
36
47
  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
48
+ @bank = BancosBrasileiros.find_bank_by_ispb(params[:ispb])
49
+ respond_to do |format|
50
+ if @bank
51
+ format.html { render :show }
52
+ format.json { render json: @bank }
53
+ else
54
+ format.html { render plain: 'Bank not found.', status: :not_found }
55
+ format.json { render json: { error: 'Bank not found.' }, status: :not_found }
56
+ end
42
57
  end
43
58
  end
44
59
 
45
60
  def by_network
46
- banks = BancosBrasileiros.find_banks_by_network(params[:network])
47
- render json: bancos
61
+ @banks = BancosBrasileiros.find_banks_by_network(params[:network])
62
+ respond_to do |format|
63
+ format.html { render :index }
64
+ format.json { render json: @banks }
65
+ end
48
66
  end
49
67
 
50
68
  def by_type
51
- banks = BancosBrasileiros.find_banks_by_type(params[:type])
52
- render json: banks
69
+ @banks = BancosBrasileiros.find_banks_by_type(params[:type])
70
+ respond_to do |format|
71
+ format.html { render :index }
72
+ format.json { render json: @banks }
73
+ end
53
74
  end
54
75
 
55
76
  def by_pix_type
56
- banks = BancosBrasileiros.find_banks_by_pix_type(params[:pix_type])
57
- render json: banks
77
+ @banks = BancosBrasileiros.find_banks_by_pix_type(params[:pix_type])
78
+ respond_to do |format|
79
+ format.html { render :index }
80
+ format.json { render json: @banks }
81
+ end
58
82
  end
59
83
  end
60
84
  ```
@@ -73,6 +97,52 @@ Create routes:
73
97
  end
74
98
  end
75
99
  ```
100
+ Create a example of view:
101
+
102
+ ```html
103
+ <!-- app/views/banks/index.html.erb -->
104
+ <h1>Lista de Bancos Brasileiros</h1>
105
+ <table>
106
+ <thead>
107
+ <tr>
108
+ <th>COMPE</th>
109
+ <th>Nome</th>
110
+ <th>Tipo</th>
111
+ <th>Network</th>
112
+ <th>Ações</th>
113
+ </tr>
114
+ </thead>
115
+ <tbody>
116
+ <% @banks.each do |bank| %>
117
+ <tr>
118
+ <td><%= bank['COMPE'] %></td>
119
+ <td><%= bank['LongName'] %></td>
120
+ <td><%= bank['Type'] %></td>
121
+ <td><%= bank['Network'] %></td>
122
+ <td><%= link_to 'Ver detalhes', bank_path(bank['COMPE']) %></td>
123
+ </tr>
124
+ <% end %>
125
+ </tbody>
126
+ </table>
127
+
128
+ <!-- app/views/banks/show.html.erb -->
129
+ <h1>Detalhes do Banco</h1>
130
+ <p><strong>COMPE:</strong> <%= @bank['COMPE'] %></p>
131
+ <p><strong>ISPB:</strong> <%= @bank['ISPB'] %></p>
132
+ <p><strong>Nome:</strong> <%= @bank['LongName'] %></p>
133
+ <p><strong>Nome Curto:</strong> <%= @bank['ShortName'] %></p>
134
+ <p><strong>Tipo:</strong> <%= @bank['Type'] %></p>
135
+ <p><strong>Network:</strong> <%= @bank['Network'] %></p>
136
+ <p><strong>Pix Type:</strong> <%= @bank['PixType'] %></p>
137
+ <p><strong>Produtos:</strong> <%= @bank['Products'].join(', ') %></p>
138
+ <p><strong>URL:</strong> <%= link_to @bank['Url'], @bank['Url'] %></p>
139
+ <p><strong>Data de Início de Operação:</strong> <%= @bank['DateOperationStarted'] %></p>
140
+ <p><strong>Data de Início do Pix:</strong> <%= @bank['DatePixStarted'] %></p>
141
+ <p><strong>Data de Registro:</strong> <%= @bank['DateRegistered'] %></p>
142
+ <p><strong>Data de Atualização:</strong> <%= @bank['DateUpdated'] %></p>
143
+
144
+ <%= link_to 'Voltar', banks_path %>
145
+ ```
76
146
 
77
147
  ## Requirements
78
148
 
Binary file
@@ -19,8 +19,6 @@ Gem::Specification.new do |spec|
19
19
  "changelog_uri" => "https://github.com/eltonsantos/bancos_brasileiros/blob/master/CHANGELOG.md",
20
20
  }
21
21
 
22
- # Specify which files should be added to the gem when it is released.
23
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
22
  spec.files = Dir.chdir(__dir__) do
25
23
  `git ls-files -z`.split("\x0").reject do |f|
26
24
  (File.expand_path(f) == __FILE__) ||
@@ -30,10 +28,4 @@ Gem::Specification.new do |spec|
30
28
  spec.bindir = "exe"
31
29
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
30
  spec.require_paths = ["lib"]
33
-
34
- # Uncomment to register a new dependency of your gem
35
- # spec.add_dependency "example-gem", "~> 1.0"
36
-
37
- # For more information and examples about making a new gem, check out our
38
- # guide at: https://bundler.io/guides/creating_gem.html
39
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BancosBrasileiros
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elton Santos
@@ -24,6 +24,7 @@ files:
24
24
  - Rakefile
25
25
  - bancos_brasileiros-0.1.0.gem
26
26
  - bancos_brasileiros-0.1.1.gem
27
+ - bancos_brasileiros-0.1.2.gem
27
28
  - bancos_brasileiros.gemspec
28
29
  - data/bancos.json
29
30
  - lib/bancos_brasileiros.rb