finapps 1.0.6 → 1.0.7
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/.gitignore +0 -1
- data/.travis.yml +4 -0
- data/lib/finapps/middleware/raise_http_exceptions.rb +4 -4
- data/lib/finapps/middleware/response_logger.rb +5 -5
- data/lib/finapps/rest/alert.rb +9 -9
- data/lib/finapps/rest/alert_definition.rb +5 -5
- data/lib/finapps/rest/alert_preferences.rb +5 -5
- data/lib/finapps/rest/alert_settings.rb +5 -5
- data/lib/finapps/rest/budget_calculation.rb +6 -6
- data/lib/finapps/rest/budget_models.rb +4 -4
- data/lib/finapps/rest/budgets.rb +5 -5
- data/lib/finapps/rest/cashflows.rb +4 -4
- data/lib/finapps/rest/categories.rb +2 -2
- data/lib/finapps/rest/client.rb +9 -9
- data/lib/finapps/rest/errors.rb +2 -2
- data/lib/finapps/rest/institutions.rb +6 -6
- data/lib/finapps/rest/relevance/rulesets.rb +8 -8
- data/lib/finapps/rest/transactions.rb +4 -4
- data/lib/finapps/rest/user_institutions.rb +26 -26
- data/lib/finapps/rest/users.rb +14 -14
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/client_spec.rb +1 -12
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b97343472dab5d3664e7e6591dcccb5fb25475b
|
4
|
+
data.tar.gz: 70d1f02f877c97a52bfc29d324df79c8b54fb306
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bb3a058a241f04a9091d8ca9237e9a486c2c051af220626e7c6deeb1ae19b1c5e070b13f946552bb6f48d3df4ca4f15a480ca765a3bda5fe0e50fea97474e35
|
7
|
+
data.tar.gz: 4d8410c594a80ef8d98ada8bfe6d021fc90390ffa7ec2b092742451ae1dfc44d26289a474876601ad72d2dc58628ea7c9a0ce8444d572dbe9a85c24f407905ff
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -43,7 +43,7 @@ module FinApps
|
|
43
43
|
else
|
44
44
|
# 200..206 Success codes
|
45
45
|
# all good!
|
46
|
-
logger.debug "##{__method__
|
46
|
+
logger.debug "##{__method__} => Status code: [#{env[:status]}]."
|
47
47
|
end
|
48
48
|
|
49
49
|
end
|
@@ -63,12 +63,12 @@ module FinApps
|
|
63
63
|
error_array.push message.to_s
|
64
64
|
end
|
65
65
|
end
|
66
|
-
logger.info "##{__method__
|
66
|
+
logger.info "##{__method__} => Extracted errors: #{error_array.inspect}."
|
67
67
|
else
|
68
|
-
logger.info "##{__method__
|
68
|
+
logger.info "##{__method__} => Cannot extract errors: unexpected error while parsing response."
|
69
69
|
end
|
70
70
|
rescue ::JSON::ParserError => e
|
71
|
-
logger.error "##{__method__
|
71
|
+
logger.error "##{__method__} => Unable to parse JSON response."
|
72
72
|
logger.error e
|
73
73
|
end
|
74
74
|
end
|
@@ -5,16 +5,16 @@ module FinApps
|
|
5
5
|
include FinApps::Logging
|
6
6
|
|
7
7
|
def call(env)
|
8
|
-
logger.info "##{__method__
|
9
|
-
logger.debug "##{__method__
|
8
|
+
logger.info "##{__method__} => ##{env.method} #{env.url.to_s}"
|
9
|
+
logger.debug "##{__method__} => Request Headers: #{dump_headers env.request_headers}"
|
10
10
|
|
11
11
|
super
|
12
12
|
end
|
13
13
|
|
14
14
|
def on_complete(env)
|
15
|
-
logger.info "##{__method__
|
16
|
-
logger.debug "##{__method__
|
17
|
-
logger.info "##{__method__
|
15
|
+
logger.info "##{__method__} => ##{env.method} #{env.url.to_s}"
|
16
|
+
logger.debug "##{__method__} => Response Headers: #{dump_headers env.response_headers}"
|
17
|
+
logger.info "##{__method__} => Response Body: #{env.body}" if env.body
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
data/lib/finapps/rest/alert.rb
CHANGED
@@ -10,14 +10,14 @@ module FinApps
|
|
10
10
|
def list(page = 1, requested=100, sort='date', asc=false, read='all')
|
11
11
|
|
12
12
|
end_point = Defaults::END_POINTS[:alert_list]
|
13
|
-
logger.debug "##{__method__
|
13
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
14
14
|
|
15
15
|
path = end_point.sub ':page', ERB::Util.url_encode(page)
|
16
16
|
path = path.sub ':requested', ERB::Util.url_encode(requested)
|
17
17
|
path = path.sub ':sort', ERB::Util.url_encode(sort)
|
18
18
|
path = path.sub ':asc', ERB::Util.url_encode(asc)
|
19
19
|
path = path.sub ':read', ERB::Util.url_encode(read)
|
20
|
-
logger.debug "##{__method__
|
20
|
+
logger.debug "##{__method__} => path: #{path}"
|
21
21
|
|
22
22
|
result, error_messages = client.send_request(path, :get)
|
23
23
|
return result, error_messages
|
@@ -26,17 +26,17 @@ module FinApps
|
|
26
26
|
# @return [Hash, Array<String>]
|
27
27
|
def update(alert_id, read=true)
|
28
28
|
raise MissingArgumentsError.new 'Missing argument: alert_id.' if alert_id.blank?
|
29
|
-
logger.debug "##{__method__
|
29
|
+
logger.debug "##{__method__} => alert_id: #{alert_id.inspect}"
|
30
30
|
|
31
31
|
raise MissingArgumentsError.new 'Missing argument: read.' if read.blank?
|
32
|
-
logger.debug "##{__method__
|
32
|
+
logger.debug "##{__method__} => read: #{read.inspect}"
|
33
33
|
|
34
34
|
end_point = Defaults::END_POINTS[:alert_update]
|
35
|
-
logger.debug "##{__method__
|
35
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
36
36
|
|
37
37
|
path = end_point.sub ':alert_id', ERB::Util.url_encode(alert_id)
|
38
38
|
path = path.sub ':read', ERB::Util.url_encode(read)
|
39
|
-
logger.debug "##{__method__
|
39
|
+
logger.debug "##{__method__} => path: #{path}"
|
40
40
|
|
41
41
|
_, error_messages = client.send_request(path, :put)
|
42
42
|
error_messages
|
@@ -45,13 +45,13 @@ module FinApps
|
|
45
45
|
# @return [Hash, Array<String>]
|
46
46
|
def delete(alert_id)
|
47
47
|
raise MissingArgumentsError.new 'Missing argument: alert_id.' if alert_id.blank?
|
48
|
-
logger.debug "##{__method__
|
48
|
+
logger.debug "##{__method__} => alert_id: #{alert_id.inspect}"
|
49
49
|
|
50
50
|
end_point = Defaults::END_POINTS[:alert_delete]
|
51
|
-
logger.debug "##{__method__
|
51
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
52
52
|
|
53
53
|
path = end_point.sub ':alert_id', ERB::Util.url_encode(alert_id)
|
54
|
-
logger.debug "##{__method__
|
54
|
+
logger.debug "##{__method__} => path: #{path}"
|
55
55
|
|
56
56
|
_, error_messages = client.send_request(path, :delete)
|
57
57
|
error_messages
|
@@ -10,10 +10,10 @@ module FinApps
|
|
10
10
|
# @return [Hash, Array<String>]
|
11
11
|
def list
|
12
12
|
end_point = Defaults::END_POINTS[:alert_definition_list]
|
13
|
-
logger.debug "##{__method__
|
13
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
14
14
|
|
15
15
|
path = end_point
|
16
|
-
logger.debug "##{__method__
|
16
|
+
logger.debug "##{__method__} => path: #{path}"
|
17
17
|
|
18
18
|
result, error_messages = client.send_request(path, :get)
|
19
19
|
return result, error_messages
|
@@ -23,13 +23,13 @@ module FinApps
|
|
23
23
|
# @return [Hash, Array<String>]
|
24
24
|
def show(alert_name)
|
25
25
|
raise MissingArgumentsError.new 'Missing argument: alert_name.' if alert_name.blank?
|
26
|
-
logger.debug "##{__method__
|
26
|
+
logger.debug "##{__method__} => alert_name: #{alert_name}"
|
27
27
|
|
28
28
|
end_point = Defaults::END_POINTS[:alert_definition_show]
|
29
|
-
logger.debug "##{__method__
|
29
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
30
30
|
|
31
31
|
path = end_point.sub ':alert_name', ERB::Util.url_encode(alert_name)
|
32
|
-
logger.debug "##{__method__
|
32
|
+
logger.debug "##{__method__} => path: #{path}"
|
33
33
|
|
34
34
|
result, error_messages = client.send_request(path, :get)
|
35
35
|
return result, error_messages
|
@@ -10,10 +10,10 @@ module FinApps
|
|
10
10
|
# @return [Hash, Array<String>]
|
11
11
|
def show
|
12
12
|
end_point = Defaults::END_POINTS[:alert_preferences_show]
|
13
|
-
logger.debug "##{__method__
|
13
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
14
14
|
|
15
15
|
path = end_point
|
16
|
-
logger.debug "##{__method__
|
16
|
+
logger.debug "##{__method__} => path: #{path}"
|
17
17
|
|
18
18
|
result, error_messages = client.send_request(path, :get)
|
19
19
|
return result, error_messages
|
@@ -23,13 +23,13 @@ module FinApps
|
|
23
23
|
# @return [Hash, Array<String>]
|
24
24
|
def update(params)
|
25
25
|
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
26
|
-
logger.debug "##{__method__
|
26
|
+
logger.debug "##{__method__} => params: #{params.inspect}"
|
27
27
|
|
28
28
|
end_point = Defaults::END_POINTS[:alert_preferences_update]
|
29
|
-
logger.debug "##{__method__
|
29
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
30
30
|
|
31
31
|
path = end_point
|
32
|
-
logger.debug "##{__method__
|
32
|
+
logger.debug "##{__method__} => path: #{path}"
|
33
33
|
|
34
34
|
_, error_messages = client.send_request(path, :put, params.compact)
|
35
35
|
error_messages
|
@@ -10,10 +10,10 @@ module FinApps
|
|
10
10
|
# @return [Hash, Array<String>]
|
11
11
|
def show
|
12
12
|
end_point = Defaults::END_POINTS[:alert_settings_show]
|
13
|
-
logger.debug "##{__method__
|
13
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
14
14
|
|
15
15
|
path = end_point
|
16
|
-
logger.debug "##{__method__
|
16
|
+
logger.debug "##{__method__} => path: #{path}"
|
17
17
|
|
18
18
|
result, error_messages = client.send_request(path, :get)
|
19
19
|
return result, error_messages
|
@@ -23,13 +23,13 @@ module FinApps
|
|
23
23
|
# @return [Hash, Array<String>]
|
24
24
|
def update(params)
|
25
25
|
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
26
|
-
logger.debug "##{__method__
|
26
|
+
logger.debug "##{__method__} => params: #{params.inspect}"
|
27
27
|
|
28
28
|
end_point = Defaults::END_POINTS[:alert_settings_update]
|
29
|
-
logger.debug "##{__method__
|
29
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
30
30
|
|
31
31
|
path = end_point
|
32
|
-
logger.debug "##{__method__
|
32
|
+
logger.debug "##{__method__} => path: #{path}"
|
33
33
|
|
34
34
|
_, error_messages = client.send_request(path, :put, params.compact)
|
35
35
|
error_messages
|
@@ -13,15 +13,15 @@ module FinApps
|
|
13
13
|
# @return [Array<Hash>, Array<String>]
|
14
14
|
def create(budget_model_id, income)
|
15
15
|
raise MissingArgumentsError.new 'Missing argument: budget_model_id.' if budget_model_id.blank?
|
16
|
-
logger.debug "##{__method__
|
16
|
+
logger.debug "##{__method__} => budget_model: #{budget_model_id}"
|
17
17
|
raise MissingArgumentsError.new 'Missing argument: income.' if income.blank?
|
18
|
-
logger.debug "##{__method__
|
18
|
+
logger.debug "##{__method__} => income: #{income}"
|
19
19
|
|
20
20
|
end_point = Defaults::END_POINTS[:budget_calculation_create]
|
21
|
-
logger.debug "##{__method__
|
21
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
22
22
|
|
23
23
|
path = end_point.sub(':budget_model_id', ERB::Util.url_encode(budget_model_id)).sub(':income', ERB::Util.url_encode(income))
|
24
|
-
logger.debug "##{__method__
|
24
|
+
logger.debug "##{__method__} => path: #{path}"
|
25
25
|
|
26
26
|
budget_calculation, error_messages = client.send_request(path, :get)
|
27
27
|
return budget_calculation, error_messages
|
@@ -31,10 +31,10 @@ module FinApps
|
|
31
31
|
# @return [Array<Hash>, Array<String>]
|
32
32
|
def show
|
33
33
|
end_point = Defaults::END_POINTS[:budget_calculation_show]
|
34
|
-
logger.debug "##{__method__
|
34
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
35
35
|
|
36
36
|
path = end_point
|
37
|
-
logger.debug "##{__method__
|
37
|
+
logger.debug "##{__method__} => path: #{path}"
|
38
38
|
|
39
39
|
budget_calculation, error_messages = client.send_request(path, :get)
|
40
40
|
return budget_calculation, error_messages
|
@@ -10,7 +10,7 @@ module FinApps
|
|
10
10
|
# @return [Array<Hash>, Array<String>]
|
11
11
|
def list
|
12
12
|
path = Defaults::END_POINTS[:budget_models_list]
|
13
|
-
logger.debug "##{__method__
|
13
|
+
logger.debug "##{__method__} => path: #{path}"
|
14
14
|
|
15
15
|
budget_models, error_messages = client.send_request(path, :get)
|
16
16
|
return budget_models, error_messages
|
@@ -20,13 +20,13 @@ module FinApps
|
|
20
20
|
# @param [Integer] budget_model_id
|
21
21
|
def show(budget_model_id)
|
22
22
|
raise MissingArgumentsError.new 'Missing argument: budget_model_id.' if budget_model_id.blank?
|
23
|
-
logger.debug "##{__method__
|
23
|
+
logger.debug "##{__method__} => budget_model_id: #{budget_model_id}"
|
24
24
|
|
25
25
|
end_point = Defaults::END_POINTS[:budget_models_show]
|
26
|
-
logger.debug "##{__method__
|
26
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
27
27
|
|
28
28
|
path = end_point.sub ':budget_model_id', ERB::Util.url_encode(budget_model_id)
|
29
|
-
logger.debug "##{__method__
|
29
|
+
logger.debug "##{__method__} => path: #{path}"
|
30
30
|
|
31
31
|
budget_model, error_messages = client.send_request(path, :get) { |r| BudgetModel.new(r.body) }
|
32
32
|
return budget_model, error_messages
|
data/lib/finapps/rest/budgets.rb
CHANGED
@@ -12,17 +12,17 @@ module FinApps
|
|
12
12
|
# @return [Hash, Array<String>]
|
13
13
|
def show(start_date, end_date)
|
14
14
|
raise MissingArgumentsError.new 'Missing argument: start_date.' if start_date.blank?
|
15
|
-
logger.debug "##{__method__
|
15
|
+
logger.debug "##{__method__} => start_date: #{start_date}"
|
16
16
|
raise MissingArgumentsError.new 'Missing argument: end_date.' if end_date.blank?
|
17
|
-
logger.debug "##{__method__
|
17
|
+
logger.debug "##{__method__} => end_date: #{end_date}"
|
18
18
|
|
19
19
|
budget = Budget.new({:start_date => start_date, :end_date => end_date, :details => []})
|
20
20
|
|
21
21
|
end_point = Defaults::END_POINTS[:budget_show]
|
22
|
-
logger.debug "##{__method__
|
22
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
23
23
|
|
24
24
|
path = end_point.sub(':start_date', ERB::Util.url_encode(start_date)).sub(':end_date', ERB::Util.url_encode(end_date))
|
25
|
-
logger.debug "##{__method__
|
25
|
+
logger.debug "##{__method__} => path: #{path}"
|
26
26
|
|
27
27
|
result, error_messages = client.send_request(path, :get)
|
28
28
|
if result.present? && error_messages.blank?
|
@@ -43,7 +43,7 @@ module FinApps
|
|
43
43
|
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
44
44
|
|
45
45
|
end_point = Defaults::END_POINTS[:budget_update]
|
46
|
-
logger.debug "##{__method__
|
46
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
47
47
|
|
48
48
|
budget, error_messages = client.send_request(end_point, :put, params)
|
49
49
|
return budget, error_messages
|
@@ -11,9 +11,9 @@ module FinApps
|
|
11
11
|
# @return [Hash, Array<String>]
|
12
12
|
def show(start_date, end_date)
|
13
13
|
raise MissingArgumentsError.new 'Missing argument: start_date.' if start_date.blank?
|
14
|
-
logger.debug "##{__method__
|
14
|
+
logger.debug "##{__method__} => start_date: #{start_date}"
|
15
15
|
raise MissingArgumentsError.new 'Missing argument: end_date.' if end_date.blank?
|
16
|
-
logger.debug "##{__method__
|
16
|
+
logger.debug "##{__method__} => end_date: #{end_date}"
|
17
17
|
|
18
18
|
cashflow = Cashflow.new({:start_date => start_date,
|
19
19
|
:end_date => end_date,
|
@@ -23,10 +23,10 @@ module FinApps
|
|
23
23
|
:details => []})
|
24
24
|
|
25
25
|
end_point = Defaults::END_POINTS[:cashflow_show]
|
26
|
-
logger.debug "##{__method__
|
26
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
27
27
|
|
28
28
|
path = end_point.sub(':start_date', ERB::Util.url_encode(start_date)).sub(':end_date', ERB::Util.url_encode(end_date))
|
29
|
-
logger.debug "##{__method__
|
29
|
+
logger.debug "##{__method__} => path: #{path}"
|
30
30
|
|
31
31
|
result, error_messages = client.send_request(path, :get)
|
32
32
|
if result.present? && error_messages.blank?
|
@@ -7,10 +7,10 @@ module FinApps
|
|
7
7
|
# @return [Array<Hash>, Array<String>]
|
8
8
|
def list
|
9
9
|
end_point = Defaults::END_POINTS[:categories_list]
|
10
|
-
logger.debug "##{__method__
|
10
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
11
11
|
|
12
12
|
path = end_point
|
13
|
-
logger.debug "##{__method__
|
13
|
+
logger.debug "##{__method__} => path: #{path}"
|
14
14
|
|
15
15
|
categories, error_messages = client.send_request(path, :get)
|
16
16
|
return categories, error_messages
|
data/lib/finapps/rest/client.rb
CHANGED
@@ -110,7 +110,7 @@ module FinApps
|
|
110
110
|
if response.present?
|
111
111
|
result = block_given? ? proc.call(response) : response.body
|
112
112
|
else
|
113
|
-
logger.error "##{__method__
|
113
|
+
logger.error "##{__method__} => Null response found. Unable to process it."
|
114
114
|
end
|
115
115
|
|
116
116
|
rescue FinApps::REST::InvalidArgumentsError => error
|
@@ -119,13 +119,13 @@ module FinApps
|
|
119
119
|
error_messages = error.error_messages
|
120
120
|
rescue Faraday::ParsingError => error
|
121
121
|
error_messages << 'Unable to parse the server response.'
|
122
|
-
logger.error "##{__method__
|
122
|
+
logger.error "##{__method__} => Faraday::ParsingError, #{error.to_s}"
|
123
123
|
rescue Exception => error
|
124
124
|
error_messages << 'Unexpected error.'
|
125
|
-
logger.fatal "##{__method__
|
125
|
+
logger.fatal "##{__method__} => Exception, #{error.to_s}"
|
126
126
|
logger.fatal error
|
127
127
|
ensure
|
128
|
-
logger.debug "##{__method__
|
128
|
+
logger.debug "##{__method__} => Failed, error_messages: #{error_messages.pretty_inspect}" if error_messages.present?
|
129
129
|
end
|
130
130
|
|
131
131
|
return result, error_messages
|
@@ -139,7 +139,7 @@ module FinApps
|
|
139
139
|
@config[:user_identifier] = user_identifier
|
140
140
|
@config[:user_token] = user_token
|
141
141
|
|
142
|
-
logger.debug "##{__method__
|
142
|
+
logger.debug "##{__method__} => Attempting to set user credentials on current connection."
|
143
143
|
@connection = set_up_connection(company_credentials, config)
|
144
144
|
end
|
145
145
|
|
@@ -154,7 +154,7 @@ module FinApps
|
|
154
154
|
def get(path)
|
155
155
|
raise MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
156
156
|
|
157
|
-
logger.debug "##{__method__
|
157
|
+
logger.debug "##{__method__} => GET path:#{path}"
|
158
158
|
connection.get { |req| req.url path }
|
159
159
|
end
|
160
160
|
|
@@ -168,7 +168,7 @@ module FinApps
|
|
168
168
|
def post(path, params = {})
|
169
169
|
raise MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
170
170
|
|
171
|
-
logger.debug "##{__method__
|
171
|
+
logger.debug "##{__method__} => POST path:#{path} params:#{skip_sensitive_data params }"
|
172
172
|
connection.post do |req|
|
173
173
|
req.url path
|
174
174
|
req.body = params
|
@@ -185,7 +185,7 @@ module FinApps
|
|
185
185
|
def put(path, params = {})
|
186
186
|
raise MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
187
187
|
|
188
|
-
logger.debug "##{__method__
|
188
|
+
logger.debug "##{__method__} => PUT path:#{path} params:#{skip_sensitive_data(params)}"
|
189
189
|
connection.put do |req|
|
190
190
|
req.url path
|
191
191
|
req.body = params
|
@@ -202,7 +202,7 @@ module FinApps
|
|
202
202
|
def delete(path, params = {})
|
203
203
|
raise MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
204
204
|
|
205
|
-
logger.debug "##{__method__
|
205
|
+
logger.debug "##{__method__} => DELETE path:#{path} params:#{skip_sensitive_data(params)}"
|
206
206
|
connection.delete do |req|
|
207
207
|
req.url path
|
208
208
|
req.body = params
|
data/lib/finapps/rest/errors.rb
CHANGED
@@ -43,10 +43,10 @@ module FinApps
|
|
43
43
|
if parsed
|
44
44
|
body = parsed
|
45
45
|
else
|
46
|
-
logger.info "##{__method__
|
46
|
+
logger.info "##{__method__} => Cannot extract errors: unexpected error while parsing response."
|
47
47
|
end
|
48
48
|
rescue ::JSON::ParserError => e
|
49
|
-
logger.error "##{__method__
|
49
|
+
logger.error "##{__method__} => Unable to parse JSON response."
|
50
50
|
logger.error e
|
51
51
|
end
|
52
52
|
end
|
@@ -10,13 +10,13 @@ module FinApps
|
|
10
10
|
# @return [Array<FinApps::REST::Institution>, Array<String>]
|
11
11
|
def search(term)
|
12
12
|
raise MissingArgumentsError.new 'Missing argument: term.' if term.blank?
|
13
|
-
logger.debug "##{__method__
|
13
|
+
logger.debug "##{__method__} => term: #{term}"
|
14
14
|
|
15
15
|
end_point = Defaults::END_POINTS[:institutions_list]
|
16
|
-
logger.debug "##{__method__
|
16
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
17
17
|
|
18
18
|
path = end_point.sub ':search_term', ERB::Util.url_encode(term)
|
19
|
-
logger.debug "##{__method__
|
19
|
+
logger.debug "##{__method__} => path: #{path}"
|
20
20
|
|
21
21
|
institutions, error_messages = client.send_request(path, :get)
|
22
22
|
return institutions, error_messages
|
@@ -25,13 +25,13 @@ module FinApps
|
|
25
25
|
# @param [Integer] site_id
|
26
26
|
def form(site_id)
|
27
27
|
raise MissingArgumentsError.new 'Missing argument: site_id.' if site_id.blank?
|
28
|
-
logger.debug "##{__method__
|
28
|
+
logger.debug "##{__method__} => site_id: #{site_id}"
|
29
29
|
|
30
30
|
end_point = Defaults::END_POINTS[:institutions_form]
|
31
|
-
logger.debug "##{__method__
|
31
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
32
32
|
|
33
33
|
path = end_point.sub ':site_id', ERB::Util.url_encode(site_id)
|
34
|
-
logger.debug "##{__method__
|
34
|
+
logger.debug "##{__method__} => path: #{path}"
|
35
35
|
|
36
36
|
institution, error_messages = client.send_request(path, :get) { |r| Institution.new(r.body) }
|
37
37
|
return institution, error_messages
|
@@ -10,10 +10,10 @@ module FinApps
|
|
10
10
|
|
11
11
|
|
12
12
|
end_point = Defaults::END_POINTS[:relevance_rulesets_list]
|
13
|
-
logger.debug "##{__method__
|
13
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
14
14
|
|
15
15
|
path = end_point
|
16
|
-
logger.debug "##{__method__
|
16
|
+
logger.debug "##{__method__} => path: #{path}"
|
17
17
|
|
18
18
|
results, error_messages = @client.send_request(path, :get)
|
19
19
|
|
@@ -25,13 +25,13 @@ module FinApps
|
|
25
25
|
|
26
26
|
|
27
27
|
raise MissingArgumentsError.new 'Missing argument: ruleset_name.' if ruleset_name.blank?
|
28
|
-
logger.debug "##{__method__
|
28
|
+
logger.debug "##{__method__} => ruleset_name: #{ruleset_name}"
|
29
29
|
|
30
30
|
end_point = Defaults::END_POINTS[:relevance_rulesets_show]
|
31
|
-
logger.debug "##{__method__
|
31
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
32
32
|
|
33
33
|
path = end_point.sub ':ruleset_name', ERB::Util.url_encode(ruleset_name)
|
34
|
-
logger.debug "##{__method__
|
34
|
+
logger.debug "##{__method__} => path: #{path}"
|
35
35
|
|
36
36
|
results, error_messages = @client.send_request(path, :get)
|
37
37
|
|
@@ -43,13 +43,13 @@ module FinApps
|
|
43
43
|
|
44
44
|
|
45
45
|
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
46
|
-
logger.debug "##{__method__
|
46
|
+
logger.debug "##{__method__} => params: #{params.inspect}"
|
47
47
|
|
48
48
|
end_point = Defaults::END_POINTS[:relevance_rulesets_run]
|
49
|
-
logger.debug "##{__method__
|
49
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
50
50
|
|
51
51
|
path = end_point
|
52
|
-
logger.debug "##{__method__
|
52
|
+
logger.debug "##{__method__} => path: #{path}"
|
53
53
|
|
54
54
|
results, error_messages = @client.send_request(path, :post, params)
|
55
55
|
|
@@ -8,10 +8,10 @@ module FinApps
|
|
8
8
|
# # @return [Hash, Array<String>]
|
9
9
|
def show(transaction_id)
|
10
10
|
end_point = Defaults::END_POINTS[:transactions_show]
|
11
|
-
logger.debug "##{__method__
|
11
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
12
12
|
|
13
13
|
path = end_point.sub ':transaction_id', ERB::Util.url_encode(transaction_id)
|
14
|
-
logger.debug "##{__method__
|
14
|
+
logger.debug "##{__method__} => path: #{path}"
|
15
15
|
|
16
16
|
transaction, error_messages = client.send_request(path, :get)
|
17
17
|
return transaction, error_messages
|
@@ -23,7 +23,7 @@ module FinApps
|
|
23
23
|
end_point = Defaults::END_POINTS[:transactions_list]
|
24
24
|
|
25
25
|
path = end_point
|
26
|
-
logger.debug "##{__method__
|
26
|
+
logger.debug "##{__method__} => path: #{path}"
|
27
27
|
|
28
28
|
transactions, error_messages = client.send_request(path, :post, params.compact)
|
29
29
|
return transactions, error_messages
|
@@ -33,7 +33,7 @@ module FinApps
|
|
33
33
|
# @return [Array<Hash>, Array<String>]
|
34
34
|
def update(params={})
|
35
35
|
path = Defaults::END_POINTS[:transactions_update]
|
36
|
-
logger.debug "##{__method__
|
36
|
+
logger.debug "##{__method__} => path: #{path}"
|
37
37
|
|
38
38
|
_, error_messages = client.send_request(path, :put, params.compact)
|
39
39
|
error_messages
|
@@ -8,7 +8,7 @@ module FinApps
|
|
8
8
|
|
9
9
|
def list
|
10
10
|
path = Defaults::END_POINTS[:user_institutions_list]
|
11
|
-
logger.debug "##{__method__
|
11
|
+
logger.debug "##{__method__} => path: #{path}"
|
12
12
|
|
13
13
|
user_institutions, error_messages = client.send_request(path, :get)
|
14
14
|
return user_institutions, error_messages
|
@@ -17,16 +17,16 @@ module FinApps
|
|
17
17
|
def add(site_id, parameters)
|
18
18
|
|
19
19
|
raise MissingArgumentsError.new 'Missing argument: site_id.' if site_id.blank?
|
20
|
-
logger.debug "##{__method__
|
20
|
+
logger.debug "##{__method__} => site_id: #{site_id}"
|
21
21
|
|
22
22
|
raise MissingArgumentsError.new 'Missing argument: parameters.' if parameters.blank?
|
23
|
-
logger.debug "##{__method__
|
23
|
+
logger.debug "##{__method__} => parameters: #{skip_sensitive_data parameters}"
|
24
24
|
|
25
25
|
end_point = Defaults::END_POINTS[:user_institutions_add]
|
26
|
-
logger.debug "##{__method__
|
26
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
27
27
|
|
28
28
|
path = end_point.sub ':site_id', ERB::Util.url_encode(site_id)
|
29
|
-
logger.debug "##{__method__
|
29
|
+
logger.debug "##{__method__} => path: #{path}"
|
30
30
|
|
31
31
|
user_institution, error_messages = client.send_request(path, :post, :parameters => parameters)
|
32
32
|
return user_institution, error_messages
|
@@ -35,13 +35,13 @@ module FinApps
|
|
35
35
|
def show(user_institution_id)
|
36
36
|
|
37
37
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
38
|
-
logger.debug "##{__method__
|
38
|
+
logger.debug "##{__method__} => user_institution_id: #{user_institution_id}"
|
39
39
|
|
40
40
|
end_point = Defaults::END_POINTS[:user_institutions_show]
|
41
|
-
logger.debug "##{__method__
|
41
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
42
42
|
|
43
43
|
path = end_point.sub ':user_institution_id', ERB::Util.url_encode(user_institution_id)
|
44
|
-
logger.debug "##{__method__
|
44
|
+
logger.debug "##{__method__} => path: #{path}"
|
45
45
|
|
46
46
|
user_institution, error_messages = client.send_request(path, :get)
|
47
47
|
return user_institution, error_messages
|
@@ -49,13 +49,13 @@ module FinApps
|
|
49
49
|
|
50
50
|
def form(user_institution_id)
|
51
51
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
52
|
-
logger.debug "##{__method__
|
52
|
+
logger.debug "##{__method__} => user_institution_id: #{user_institution_id}"
|
53
53
|
|
54
54
|
end_point = Defaults::END_POINTS[:user_institutions_form]
|
55
|
-
logger.debug "##{__method__
|
55
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
56
56
|
|
57
57
|
path = end_point.sub ':user_institution_id', ERB::Util.url_encode(user_institution_id)
|
58
|
-
logger.debug "##{__method__
|
58
|
+
logger.debug "##{__method__} => path: #{path}"
|
59
59
|
|
60
60
|
user_institution, error_messages = client.send_request(path, :get)
|
61
61
|
return user_institution, error_messages
|
@@ -63,13 +63,13 @@ module FinApps
|
|
63
63
|
|
64
64
|
def status(user_institution_id)
|
65
65
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
66
|
-
logger.debug "##{__method__
|
66
|
+
logger.debug "##{__method__} => user_institution_id: #{user_institution_id}"
|
67
67
|
|
68
68
|
end_point = Defaults::END_POINTS[:user_institutions_status]
|
69
|
-
logger.debug "##{__method__
|
69
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
70
70
|
|
71
71
|
path = end_point.sub ':user_institution_id', ERB::Util.url_encode(user_institution_id)
|
72
|
-
logger.debug "##{__method__
|
72
|
+
logger.debug "##{__method__} => path: #{path}"
|
73
73
|
|
74
74
|
user_institution, error_messages = client.send_request(path, :get)
|
75
75
|
return user_institution, error_messages
|
@@ -77,16 +77,16 @@ module FinApps
|
|
77
77
|
|
78
78
|
def mfa(user_institution_id, parameters)
|
79
79
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
80
|
-
logger.debug "##{__method__
|
80
|
+
logger.debug "##{__method__} => user_institution_id: #{user_institution_id}"
|
81
81
|
|
82
82
|
raise MissingArgumentsError.new 'Missing argument: parameters.' if parameters.blank?
|
83
|
-
logger.debug "##{__method__
|
83
|
+
logger.debug "##{__method__} => parameters: #{skip_sensitive_data parameters}"
|
84
84
|
|
85
85
|
end_point = Defaults::END_POINTS[:user_institutions_mfa]
|
86
|
-
logger.debug "##{__method__
|
86
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
87
87
|
|
88
88
|
path = end_point.sub ':user_institution_id', ERB::Util.url_encode(user_institution_id)
|
89
|
-
logger.debug "##{__method__
|
89
|
+
logger.debug "##{__method__} => path: #{path}"
|
90
90
|
|
91
91
|
user_institution, error_messages = client.send_request(path, :put, :parameters => parameters)
|
92
92
|
return user_institution, error_messages
|
@@ -94,16 +94,16 @@ module FinApps
|
|
94
94
|
|
95
95
|
def update(user_institution_id, parameters)
|
96
96
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
97
|
-
logger.debug "##{__method__
|
97
|
+
logger.debug "##{__method__} => user_institution_id: #{user_institution_id}"
|
98
98
|
|
99
99
|
raise MissingArgumentsError.new 'Missing argument: parameters.' if parameters.blank?
|
100
|
-
logger.debug "##{__method__
|
100
|
+
logger.debug "##{__method__} => parameters: #{skip_sensitive_data parameters}"
|
101
101
|
|
102
102
|
end_point = Defaults::END_POINTS[:user_institutions_update]
|
103
|
-
logger.debug "##{__method__
|
103
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
104
104
|
|
105
105
|
path = end_point.sub ':user_institution_id', ERB::Util.url_encode(user_institution_id)
|
106
|
-
logger.debug "##{__method__
|
106
|
+
logger.debug "##{__method__} => path: #{path}"
|
107
107
|
|
108
108
|
user_institution, error_messages = client.send_request(path, :put, :parameters => parameters)
|
109
109
|
return user_institution, error_messages
|
@@ -111,7 +111,7 @@ module FinApps
|
|
111
111
|
|
112
112
|
def refresh
|
113
113
|
path = Defaults::END_POINTS[:user_institutions_refresh]
|
114
|
-
logger.debug "##{__method__
|
114
|
+
logger.debug "##{__method__} => path: #{path}"
|
115
115
|
|
116
116
|
user_institutions, error_messages = client.send_request(path, :get)
|
117
117
|
return user_institutions, error_messages
|
@@ -120,13 +120,13 @@ module FinApps
|
|
120
120
|
# @return [Hash, Array<String>]
|
121
121
|
def delete(user_institution_id)
|
122
122
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
123
|
-
logger.debug "##{__method__
|
123
|
+
logger.debug "##{__method__} => user_institution_id: #{user_institution_id.inspect}"
|
124
124
|
|
125
125
|
end_point = Defaults::END_POINTS[:user_institutions_delete]
|
126
|
-
logger.debug "##{__method__
|
126
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
127
127
|
|
128
128
|
path = end_point.sub ':user_institution_id', ERB::Util.url_encode(user_institution_id)
|
129
|
-
logger.debug "##{__method__
|
129
|
+
logger.debug "##{__method__} => path: #{path}"
|
130
130
|
|
131
131
|
_, error_messages = client.send_request(path, :delete)
|
132
132
|
error_messages
|
data/lib/finapps/rest/users.rb
CHANGED
@@ -11,13 +11,13 @@ module FinApps
|
|
11
11
|
# @return [FinApps::REST::User, Array<String>]
|
12
12
|
def show(public_id)
|
13
13
|
raise MissingArgumentsError.new 'Missing argument: public_id.' if public_id.blank?
|
14
|
-
logger.debug "##{__method__
|
14
|
+
logger.debug "##{__method__} => public_id: #{public_id}"
|
15
15
|
|
16
16
|
end_point = Defaults::END_POINTS[:users_show]
|
17
|
-
logger.debug "##{__method__
|
17
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
18
18
|
|
19
19
|
path = end_point.sub ':public_id', ERB::Util.url_encode(public_id)
|
20
|
-
logger.debug "##{__method__
|
20
|
+
logger.debug "##{__method__} => path: #{path}"
|
21
21
|
|
22
22
|
user, error_messages = client.send_request(path, :get) { |r| User.new(r.body) }
|
23
23
|
return user, error_messages
|
@@ -27,10 +27,10 @@ module FinApps
|
|
27
27
|
# @return [FinApps::REST::User, Array<String>]
|
28
28
|
def create(params = {})
|
29
29
|
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
30
|
-
logger.debug "##{__method__
|
30
|
+
logger.debug "##{__method__} => params: #{skip_sensitive_data params}"
|
31
31
|
|
32
32
|
end_point = Defaults::END_POINTS[:users_create]
|
33
|
-
logger.debug "##{__method__
|
33
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
34
34
|
|
35
35
|
user, error_messages = client.send_request(end_point, :post, params) { |r| User.new(r.body) }
|
36
36
|
return user, error_messages
|
@@ -39,10 +39,10 @@ module FinApps
|
|
39
39
|
# @param [Hash] params
|
40
40
|
# @return [Array<String>]
|
41
41
|
def update(params = {})
|
42
|
-
logger.debug "##{__method__
|
42
|
+
logger.debug "##{__method__} => params: #{skip_sensitive_data params}"
|
43
43
|
|
44
44
|
path = Defaults::END_POINTS[:users_update]
|
45
|
-
logger.debug "##{__method__
|
45
|
+
logger.debug "##{__method__} => path: #{path}"
|
46
46
|
|
47
47
|
_, error_messages = client.send_request(path, :put, params.compact)
|
48
48
|
error_messages
|
@@ -51,10 +51,10 @@ module FinApps
|
|
51
51
|
# @param [Hash] params
|
52
52
|
# @return [FinApps::REST::User, Array<String>]
|
53
53
|
def update_password(params = {})
|
54
|
-
logger.debug "##{__method__
|
54
|
+
logger.debug "##{__method__} => params: #{skip_sensitive_data params}"
|
55
55
|
|
56
56
|
path = Defaults::END_POINTS[:users_update_password]
|
57
|
-
logger.debug "##{__method__
|
57
|
+
logger.debug "##{__method__} => path: #{path}"
|
58
58
|
|
59
59
|
user, error_messages = client.send_request(path, :put, params.compact) { |r| User.new(r.body) }
|
60
60
|
return user, error_messages
|
@@ -64,10 +64,10 @@ module FinApps
|
|
64
64
|
# @return [FinApps::REST::User, Array<String>]
|
65
65
|
def login(params = {})
|
66
66
|
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
67
|
-
logger.debug "##{__method__
|
67
|
+
logger.debug "##{__method__} => params: #{skip_sensitive_data params}"
|
68
68
|
|
69
69
|
end_point = Defaults::END_POINTS[:users_login]
|
70
|
-
logger.debug "##{__method__
|
70
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
71
71
|
|
72
72
|
user, error_messages = client.send_request(end_point, :post, params) { |r| User.new(r.body) }
|
73
73
|
return user, error_messages
|
@@ -77,13 +77,13 @@ module FinApps
|
|
77
77
|
# @return [Array<String>]
|
78
78
|
def delete(public_id)
|
79
79
|
raise MissingArgumentsError.new 'Missing argument: public_id.' if public_id.blank?
|
80
|
-
logger.debug "##{__method__
|
80
|
+
logger.debug "##{__method__} => public_id: #{public_id}"
|
81
81
|
|
82
82
|
end_point = Defaults::END_POINTS[:users_delete]
|
83
|
-
logger.debug "##{__method__
|
83
|
+
logger.debug "##{__method__} => end_point: #{end_point}"
|
84
84
|
|
85
85
|
path = end_point.sub ':public_id', ERB::Util.url_encode(public_id)
|
86
|
-
logger.debug "##{__method__
|
86
|
+
logger.debug "##{__method__} => path: #{path}"
|
87
87
|
|
88
88
|
_, error_messages = client.send_request(path, :delete)
|
89
89
|
error_messages
|
data/lib/finapps/version.rb
CHANGED
data/spec/rest/client_spec.rb
CHANGED
@@ -22,15 +22,6 @@ RSpec.describe FinApps::REST::Client do
|
|
22
22
|
it { expect { FinApps::REST::Client.new :company_identifier, :company_token }.not_to raise_error }
|
23
23
|
end
|
24
24
|
|
25
|
-
<<<<<<< HEAD
|
26
|
-
it 'responds to public api methods' do
|
27
|
-
[:alert, :alert_definition, :alert_settings, :alert_preferences,
|
28
|
-
:budgets, :budget_calculation, :budget_models, :cashflows,
|
29
|
-
:categories, :institutions, :transactions,
|
30
|
-
:user_institutions, :users,
|
31
|
-
:rule_sets].each do |method|
|
32
|
-
expect(@client).to respond_to(method)
|
33
|
-
=======
|
34
25
|
end
|
35
26
|
|
36
27
|
context 'after initialized' do
|
@@ -42,7 +33,6 @@ RSpec.describe FinApps::REST::Client do
|
|
42
33
|
:alert_definition, :alert_preferences, :alert_settings, :rule_sets, :user_credentials!].each do |method|
|
43
34
|
it "responds to #{method}" do
|
44
35
|
expect(client).to respond_to(method)
|
45
|
-
>>>>>>> develop
|
46
36
|
end
|
47
37
|
end
|
48
38
|
|
@@ -129,5 +119,4 @@ RSpec.describe FinApps::REST::Client do
|
|
129
119
|
|
130
120
|
end
|
131
121
|
|
132
|
-
end
|
133
|
-
|
122
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finapps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
@@ -223,6 +223,7 @@ files:
|
|
223
223
|
- ".rspec"
|
224
224
|
- ".ruby-gemset"
|
225
225
|
- ".ruby-version"
|
226
|
+
- ".travis.yml"
|
226
227
|
- Gemfile
|
227
228
|
- LICENSE.txt
|
228
229
|
- README.md
|