qonto 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/qonto/actions/transactions.rb +6 -6
- data/lib/qonto/client.rb +7 -7
- data/lib/qonto/model/bank_account.rb +2 -0
- data/lib/qonto/model/transaction.rb +4 -0
- data/lib/qonto/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94826f445212489870421cdbc931d2be335464a1
|
4
|
+
data.tar.gz: c1108a0ddfcaae32d02f04afa503fc6de6e4fdb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 454908ec5ed286c4fa1f1a3ce7e605a5e9017d9f1b338d882bed87757c2f0158ece0d86139c9e76fff0e7d5f52ae36260109a28f1dd7c787d7b2014b4dbb72aa
|
7
|
+
data.tar.gz: 61201d2ffedeee015af3f7de5e0559704c0eecee5221ce092376f47bae9842d96e25379d42a69bc75e9e3d35ddf8e89ca4b760622848e29115bc95cbe6c2092f
|
@@ -1,24 +1,24 @@
|
|
1
1
|
module Qonto
|
2
2
|
module Actions
|
3
3
|
module Transactions
|
4
|
-
def list_transactions(bank_account:, current_page: nil, per_page: nil)
|
5
|
-
query =
|
6
|
-
|
4
|
+
def list_transactions(bank_account:, status: nil, current_page: nil, per_page: nil)
|
5
|
+
query = prepare_query(bank_account, status, current_page, per_page)
|
6
|
+
|
7
|
+
response = get("/transactions", query: query)
|
7
8
|
|
8
9
|
modelize_transactions(response.parsed_response['transactions'])
|
9
10
|
end
|
10
11
|
|
11
12
|
private
|
12
13
|
|
13
|
-
def
|
14
|
+
def prepare_query(bank_account, status, current_page, per_page)
|
14
15
|
{
|
15
16
|
slug: bank_account.slug,
|
16
17
|
iban: bank_account.iban,
|
18
|
+
status: status,
|
17
19
|
current_page: current_page,
|
18
20
|
per_page: per_page
|
19
21
|
}.delete_if { |key, value| value.nil? }
|
20
|
-
.map { |(key, value)| "#{key}=#{value}" }
|
21
|
-
.join('&')
|
22
22
|
end
|
23
23
|
|
24
24
|
def modelize_transactions(transactions)
|
data/lib/qonto/client.rb
CHANGED
@@ -8,7 +8,7 @@ module Qonto
|
|
8
8
|
include Qonto::Actions::Organization
|
9
9
|
include Qonto::Actions::Transactions
|
10
10
|
|
11
|
-
API_VERSION = '
|
11
|
+
API_VERSION = 'v2'.freeze
|
12
12
|
BASE_URL = 'https://thirdparty.qonto.eu/'.freeze
|
13
13
|
USER_AGENT = "qonto-ruby/#{VERSION}".freeze
|
14
14
|
|
@@ -21,17 +21,17 @@ module Qonto
|
|
21
21
|
"#{BASE_URL}#{API_VERSION}"
|
22
22
|
end
|
23
23
|
|
24
|
-
def get(path)
|
25
|
-
execute
|
24
|
+
def get(path, options = {})
|
25
|
+
execute(:get, path, options)
|
26
26
|
end
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
30
|
attr_reader :slug, :secret_key
|
31
31
|
|
32
|
-
def execute(method, path)
|
32
|
+
def execute(method, path, options)
|
33
33
|
begin
|
34
|
-
response = request(method, path)
|
34
|
+
response = request(method, path, options)
|
35
35
|
rescue *Error::NET_HTTP_ERRORS => err
|
36
36
|
raise ConnectionError.new, err.message
|
37
37
|
end
|
@@ -54,8 +54,8 @@ module Qonto
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def request(method, path)
|
58
|
-
HTTParty.send(method, base_url + path, base_options)
|
57
|
+
def request(method, path, options)
|
58
|
+
HTTParty.send(method, base_url + path, base_options.merge(options))
|
59
59
|
end
|
60
60
|
|
61
61
|
def base_options
|
data/lib/qonto/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qonto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sébastien Charrier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|