bankscrap-arquia 1.0.0 → 2.0.0

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
  SHA1:
3
- metadata.gz: 5da0a8be1c72e2f78a71e1de5bd7162b3f81eab6
4
- data.tar.gz: cb67eb4591184e996e058d41d4f5f0afc07f66c3
3
+ metadata.gz: c1196d9bac3e2cce43fac1f4d722912aa2937ee7
4
+ data.tar.gz: 23ff8e899293b131ed1294ed642a58fa45ada972
5
5
  SHA512:
6
- metadata.gz: 8418b19ad9f11e3476f1538e37e812620f5464e7160f2b7ea53a122af6cfe874bf56a01ae8a60bed9bd615f78490f43e72a6be3abfba11c0f85570aa446baac2
7
- data.tar.gz: e58074b6b0a58f4ac823ae0ce66cc42b77bc622efb4acaa421f79b4b066f5bf7ca5721da808b03a67a584207e9a526016646db6328763a077ff05d26052a4c68
6
+ metadata.gz: f0242bc58143912db763ec1eb93084ac66e1635f30c938fbef787253f1cf565745de6eab29c1f3ed74a085a70feb972134a2bc9b4ee840d4a281403559f932f4
7
+ data.tar.gz: 7659cff520d528517e34771eaf9f8f2596e67417d0961f6ff6d3243d5df2e84b383ba6ff98624814716e55caa7a6fc47050df39c54fa031779db1fc200b0c625
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Bankscrap::Arquia
2
2
 
3
- Bankscrap adapter for [Arquia Banca](https://www.arquia.es/) (only tested with personal accounts).
3
+ [Bankscrap](https://github.com/bankscrap/bankscrap) adapter for [Arquia Banca](https://www.arquia.es/) (only tested with personal accounts).
4
4
 
5
5
 
6
6
  ## Installation
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_runtime_dependency 'bankscrap', '~> 1.0.3'
20
+ spec.add_runtime_dependency 'bankscrap', '~> 2.0.0'
21
21
  spec.add_development_dependency 'bundler', '~> 1.7'
22
22
  spec.add_development_dependency 'rake', '~> 10.0'
23
23
  end
@@ -13,25 +13,20 @@ module Bankscrap
13
13
  PRODUCTS_ENDPOINT = '/api/products'.freeze
14
14
  ACCOUNTS_ENDPOINT = '/api/accounts'.freeze
15
15
 
16
- def initialize(user, password, log: false, debug: false, extra_args: nil)
17
- @user = user
18
- @password = password
19
- @log = log
20
- @debug = debug
21
- @nif = extra_args.with_indifferent_access['nif'].dup.upcase
22
-
23
- initialize_connection
24
-
25
- add_headers(
26
- 'Authorization' => 'Bearer',
27
- 'api-version' => '2',
28
- 'Content-Type' => 'application/json; charset=utf-8',
29
- 'Host' => 'api.arquia.es',
30
- 'User-Agent' => ''
31
- )
32
-
33
- login
34
- super
16
+ REQUIRED_CREDENTIALS = [:user, :password, :nif]
17
+
18
+ def initialize(credentials = {})
19
+ super do
20
+ @nif = @nif.dup.upcase
21
+
22
+ add_headers(
23
+ 'Authorization' => 'Bearer',
24
+ 'api-version' => '2',
25
+ 'Content-Type' => 'application/json; charset=utf-8',
26
+ 'Host' => 'api.arquia.es',
27
+ 'User-Agent' => ''
28
+ )
29
+ end
35
30
  end
36
31
 
37
32
  # Fetch all the accounts for the given user
@@ -120,11 +115,10 @@ module Bankscrap
120
115
  bank: self,
121
116
  id: data['numProd'],
122
117
  name: data['description'],
123
- available_balance: data['availableBalance'],
124
- balance: data['balance'],
125
- currency: 'EUR',
118
+ available_balance: Money.new(data['availableBalance'] * 100, 'EUR'),
119
+ balance: Money.new(data['balance'] * 100, 'EUR'),
126
120
  iban: data['iban']['ibanCode'],
127
- description: data['description']
121
+ description: "ARQUIA: #{data['description']}"
128
122
  )
129
123
  end
130
124
 
@@ -136,7 +130,6 @@ module Bankscrap
136
130
  amount: Money.new(data['amount'].to_f * 100, 'EUR'),
137
131
  description: data['description'],
138
132
  effective_date: data['valueDate'].to_date, # Format is 2016-05-02T00:00:00
139
- currency: 'EUR', # We only know the API returns data['currency'] == 0 for EUR
140
133
  balance: Money.new(data['balance'].to_f * 100, 'EUR')
141
134
  )
142
135
  end
@@ -1,5 +1,5 @@
1
1
  module Bankscrap
2
2
  module Arquia
3
- VERSION = '1.0.0'.freeze
3
+ VERSION = '2.0.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bankscrap-arquia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Cuevas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-02 00:00:00.000000000 Z
11
+ date: 2016-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bankscrap
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.3
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.3
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.6.4
92
+ rubygems_version: 2.5.1
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: Arquia adapter for Bankscrap