afterbanks-api-ruby 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/afterbanks/resources/bank.rb +42 -11
- data/lib/afterbanks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19bc05050d36cdf980cc1d2ab883c6b82f4ed4622fa959cebaa80099b5a40716
|
4
|
+
data.tar.gz: a5ffd80b0e31ee743d903564909ba692839c34a390eab12bcec6948719b56b6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89335c1312001084d537c486f800d3d46fc252b80a634d970b68120210888cbc2e9ba66ee80f331da86cd813c8362081c25f4c91da8501bf6e0157970a4aea51
|
7
|
+
data.tar.gz: e97843bdfd06e003e5ba6136e8e237084e5b0d43c0ad347c221f42586936772c099bf2a2cf59ec57a8363db0b6b600304e21ad0f36d629f83fba70de44f5719c
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -33,7 +33,8 @@ You can set a `logger` as well.
|
|
33
33
|
Changelog
|
34
34
|
---------
|
35
35
|
|
36
|
-
* v.0.1
|
36
|
+
* v.0.2.1 Better naming for banks
|
37
|
+
* v.0.2.0 Allow adding an (opt-in) random parameter to Afterbanks::Account.list to avoid caching
|
37
38
|
* v.0.1.1 Fix rake security issue and remove specific Ruby version dependency.
|
38
39
|
* v.0.1.0 First vull version, including resource wrapping (for banks, accounts, transactions and the user) and separate exceptions for each different code.
|
39
40
|
|
@@ -24,16 +24,11 @@ module Afterbanks
|
|
24
24
|
path: '/forms/'
|
25
25
|
)
|
26
26
|
|
27
|
-
if ordered
|
28
|
-
response.sort! do |bank1, bank2|
|
29
|
-
bank1['fullname'].downcase <=> bank2['fullname'].downcase
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
27
|
Response.new(
|
34
28
|
result: Collection.new(
|
35
29
|
banks_information_for(
|
36
|
-
response: response
|
30
|
+
response: response,
|
31
|
+
ordered: ordered
|
37
32
|
),
|
38
33
|
self
|
39
34
|
),
|
@@ -43,18 +38,54 @@ module Afterbanks
|
|
43
38
|
|
44
39
|
private
|
45
40
|
|
46
|
-
def self.banks_information_for(response:)
|
41
|
+
def self.banks_information_for(response:, ordered:)
|
47
42
|
banks_information = []
|
48
43
|
|
44
|
+
services_number_by_bank_id = {}
|
45
|
+
response.each { |bank_information|
|
46
|
+
bank_id = bank_id_for(bank_information: bank_information)
|
47
|
+
services_number_by_bank_id[bank_id] ||= 0
|
48
|
+
services_number_by_bank_id[bank_id] += 1
|
49
|
+
}
|
50
|
+
|
49
51
|
response.each do |bank_information|
|
50
|
-
|
51
|
-
bank_information
|
52
|
-
|
52
|
+
bank_information['fullname'] = bank_name_for(
|
53
|
+
bank_information: bank_information,
|
54
|
+
services_number_by_bank_id: services_number_by_bank_id
|
55
|
+
)
|
53
56
|
|
54
57
|
banks_information << bank_information
|
55
58
|
end
|
56
59
|
|
60
|
+
if ordered
|
61
|
+
banks_information.sort! do |bank_information1, bank_information2|
|
62
|
+
bank_information1['fullname'].downcase <=> bank_information2['fullname'].downcase
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
57
66
|
banks_information
|
58
67
|
end
|
68
|
+
|
69
|
+
def self.bank_name_for(bank_information:, services_number_by_bank_id:)
|
70
|
+
if bank_information['service'] == 'cajaingenieros'
|
71
|
+
return "Caixa d'Enginyers"
|
72
|
+
end
|
73
|
+
|
74
|
+
fullname = bank_information['fullname']
|
75
|
+
if bank_information['business'] == "1"
|
76
|
+
return "#{fullname} Empresas"
|
77
|
+
end
|
78
|
+
|
79
|
+
bank_id = bank_id_for(bank_information: bank_information)
|
80
|
+
if services_number_by_bank_id[bank_id] > 1
|
81
|
+
return "#{fullname} Particulares"
|
82
|
+
end
|
83
|
+
|
84
|
+
fullname
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.bank_id_for(bank_information:)
|
88
|
+
bank_information['service'].split("_").first
|
89
|
+
end
|
59
90
|
end
|
60
91
|
end
|
data/lib/afterbanks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: afterbanks-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Albert Bellonch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|