finapps 1.0.1 → 1.0.2
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 +18 -11
- data/finapps.gemspec +1 -0
- data/lib/finapps/rest/alert.rb +1 -8
- data/lib/finapps/rest/alert_definition.rb +8 -4
- data/lib/finapps/rest/alert_preferences.rb +8 -4
- data/lib/finapps/rest/alert_settings.rb +8 -4
- data/lib/finapps/rest/budget_calculation.rb +9 -4
- data/lib/finapps/rest/budget_models.rb +8 -4
- data/lib/finapps/rest/budgets.rb +5 -5
- data/lib/finapps/rest/cashflows.rb +1 -3
- data/lib/finapps/rest/categories.rb +4 -2
- data/lib/finapps/rest/client.rb +48 -20
- data/lib/finapps/rest/connection.rb +1 -1
- data/lib/finapps/rest/defaults.rb +2 -1
- data/lib/finapps/rest/institutions.rb +8 -4
- data/lib/finapps/rest/relevance/rulesets.rb +6 -6
- data/lib/finapps/rest/transactions.rb +12 -6
- data/lib/finapps/rest/user_institutions.rb +0 -25
- data/lib/finapps/rest/users.rb +22 -1
- data/lib/finapps/utils/logging.rb +8 -0
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/client_spec.rb +10 -0
- data/spec/rest/users_spec.rb +24 -0
- data/spec/spec_helper.rb +7 -18
- data/spec/support/fake_api.rb +14 -0
- data/spec/support/fixtures/user.json +8 -0
- metadata +30 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9574b3eed162bb96cc5308dd0305166f40263409
|
4
|
+
data.tar.gz: f0d82e74f4fb58ea3544a7baf559f0403d8f7590
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf2e62fb190c83bb688ce7217bd95a1cf44c421d0aff1bf049dd8dce526d75ce530a60b9c91f90aec178cf8ed462854922259afe73e8b128407fa1f3734abbfa
|
7
|
+
data.tar.gz: b59461b34ca64d04cc621256e8a2b07c84e1c42717ea2b38c13fbdd8ad164dc51353084b19b6ba8e931bb1fb5b213a5271d70e688c1e1793b16d86cc910864fa
|
data/.gitignore
CHANGED
@@ -1,24 +1,31 @@
|
|
1
1
|
/spec/examples.txt
|
2
2
|
*.gem
|
3
|
-
*.rbc
|
4
|
-
.bundle
|
5
3
|
.config
|
6
|
-
.yardoc
|
7
4
|
Gemfile.lock
|
8
|
-
InstalledFiles
|
9
|
-
_yardoc
|
10
|
-
coverage
|
11
|
-
doc/
|
12
5
|
lib/bundler/man
|
13
6
|
pkg
|
14
7
|
rdoc
|
15
|
-
spec/reports
|
16
|
-
test/tmp
|
17
|
-
test/version_tmp
|
18
|
-
tmp
|
19
8
|
*.bundle
|
20
9
|
*.so
|
21
10
|
*.o
|
22
11
|
*.a
|
23
12
|
mkmf.log
|
13
|
+
|
14
|
+
|
15
|
+
# Ignore bundler config.
|
16
|
+
/.bundle
|
17
|
+
/vendor/bundle/
|
18
|
+
/vendor/ruby/
|
19
|
+
|
20
|
+
# Ignore all log files and tempfiles.
|
21
|
+
/log/*
|
22
|
+
!/log/.keep
|
23
|
+
/tmp
|
24
|
+
|
25
|
+
# various artifacts
|
26
|
+
.project
|
27
|
+
.secret
|
24
28
|
.idea/
|
29
|
+
/spec/tmp/*
|
30
|
+
/spec/examples.txt
|
31
|
+
|
data/finapps.gemspec
CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'fuubar', '~> 2.0', '>= 2.0.0'
|
31
31
|
spec.add_development_dependency 'rspec', '~> 3.4', '>= 3.4.0'
|
32
32
|
spec.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.2'
|
33
|
+
spec.add_development_dependency 'sinatra', '~> 1.4', '>= 1.4.7'
|
33
34
|
|
34
35
|
spec.extra_rdoc_files = %w(README.md LICENSE.txt)
|
35
36
|
spec.rdoc_options = %w(--line-numbers --inline-source --title finapps-ruby --main README.md)
|
data/lib/finapps/rest/alert.rb
CHANGED
@@ -8,7 +8,6 @@ module FinApps
|
|
8
8
|
|
9
9
|
# @return [Hash, Array<String>]
|
10
10
|
def list(page = 1, requested=100, sort='date', asc=false, read='all')
|
11
|
-
logger.debug "##{__method__.to_s} => Started"
|
12
11
|
|
13
12
|
end_point = Defaults::END_POINTS[:alert_list]
|
14
13
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
@@ -22,16 +21,14 @@ module FinApps
|
|
22
21
|
|
23
22
|
result, error_messages = @client.send_request(path, :get)
|
24
23
|
|
25
|
-
logger.debug "##{__method__.to_s} => Completed"
|
26
24
|
return result, error_messages
|
27
25
|
end
|
28
26
|
|
29
27
|
# @return [Hash, Array<String>]
|
30
28
|
def update(alert_id, read=true)
|
31
|
-
logger.debug "##{__method__.to_s} => Started"
|
32
|
-
|
33
29
|
raise MissingArgumentsError.new 'Missing argument: alert_id.' if alert_id.blank?
|
34
30
|
logger.debug "##{__method__.to_s} => alert_id: #{alert_id.inspect}"
|
31
|
+
|
35
32
|
raise MissingArgumentsError.new 'Missing argument: read.' if read.blank?
|
36
33
|
logger.debug "##{__method__.to_s} => read: #{read.inspect}"
|
37
34
|
|
@@ -44,14 +41,11 @@ module FinApps
|
|
44
41
|
|
45
42
|
_, error_messages = @client.send_request(path, :put)
|
46
43
|
|
47
|
-
logger.debug "##{__method__.to_s} => Completed"
|
48
44
|
error_messages
|
49
45
|
end
|
50
46
|
|
51
47
|
# @return [Hash, Array<String>]
|
52
48
|
def delete(alert_id)
|
53
|
-
logger.debug "##{__method__.to_s} => Started"
|
54
|
-
|
55
49
|
raise MissingArgumentsError.new 'Missing argument: alert_id.' if alert_id.blank?
|
56
50
|
logger.debug "##{__method__.to_s} => alert_id: #{alert_id.inspect}"
|
57
51
|
|
@@ -63,7 +57,6 @@ module FinApps
|
|
63
57
|
|
64
58
|
_, error_messages = @client.send_request(path, :delete)
|
65
59
|
|
66
|
-
logger.debug "##{__method__.to_s} => Completed"
|
67
60
|
error_messages
|
68
61
|
end
|
69
62
|
|
@@ -8,24 +8,24 @@ module FinApps
|
|
8
8
|
|
9
9
|
# @return [Hash, Array<String>]
|
10
10
|
def list
|
11
|
-
logger.debug "##{__method__.to_s} => Started"
|
12
|
-
|
13
11
|
end_point = Defaults::END_POINTS[:alert_definition_list]
|
14
12
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
15
13
|
|
16
14
|
path = end_point
|
17
15
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
18
16
|
|
17
|
+
<<<<<<< HEAD
|
18
|
+
result, error_messages = @client.send(path, :get)
|
19
|
+
=======
|
19
20
|
result, error_messages = @client.send_request(path, :get)
|
20
21
|
|
21
22
|
logger.debug "##{__method__.to_s} => Completed"
|
23
|
+
>>>>>>> develop
|
22
24
|
return result, error_messages
|
23
25
|
end
|
24
26
|
|
25
27
|
# @return [Hash, Array<String>]
|
26
28
|
def show(alert_name)
|
27
|
-
logger.debug "##{__method__.to_s} => Started"
|
28
|
-
|
29
29
|
raise MissingArgumentsError.new 'Missing argument: alert_name.' if alert_name.blank?
|
30
30
|
logger.debug "##{__method__.to_s} => alert_name: #{alert_name}"
|
31
31
|
|
@@ -35,9 +35,13 @@ module FinApps
|
|
35
35
|
path = end_point.sub ':alert_name', ERB::Util.url_encode(alert_name)
|
36
36
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
37
37
|
|
38
|
+
<<<<<<< HEAD
|
39
|
+
result, error_messages = @client.send(path, :get)
|
40
|
+
=======
|
38
41
|
result, error_messages = @client.send_request(path, :get)
|
39
42
|
|
40
43
|
logger.debug "##{__method__.to_s} => Completed"
|
44
|
+
>>>>>>> develop
|
41
45
|
return result, error_messages
|
42
46
|
end
|
43
47
|
|
@@ -8,24 +8,24 @@ module FinApps
|
|
8
8
|
|
9
9
|
# @return [Hash, Array<String>]
|
10
10
|
def show
|
11
|
-
logger.debug "##{__method__.to_s} => Started"
|
12
|
-
|
13
11
|
end_point = Defaults::END_POINTS[:alert_preferences_show]
|
14
12
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
15
13
|
|
16
14
|
path = end_point
|
17
15
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
18
16
|
|
17
|
+
<<<<<<< HEAD
|
18
|
+
result, error_messages = @client.send(path, :get)
|
19
|
+
=======
|
19
20
|
result, error_messages = @client.send_request(path, :get)
|
20
21
|
|
21
22
|
logger.debug "##{__method__.to_s} => Completed"
|
23
|
+
>>>>>>> develop
|
22
24
|
return result, error_messages
|
23
25
|
end
|
24
26
|
|
25
27
|
# @return [Hash, Array<String>]
|
26
28
|
def update(params)
|
27
|
-
logger.debug "##{__method__.to_s} => Started"
|
28
|
-
|
29
29
|
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
30
30
|
logger.debug "##{__method__.to_s} => params: #{params.inspect}"
|
31
31
|
|
@@ -35,9 +35,13 @@ module FinApps
|
|
35
35
|
path = end_point
|
36
36
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
37
37
|
|
38
|
+
<<<<<<< HEAD
|
39
|
+
_, error_messages = @client.send(path, :put, params.compact)
|
40
|
+
=======
|
38
41
|
_, error_messages = @client.send_request(path, :put, params.compact)
|
39
42
|
|
40
43
|
logger.debug "##{__method__.to_s} => Completed"
|
44
|
+
>>>>>>> develop
|
41
45
|
error_messages
|
42
46
|
end
|
43
47
|
|
@@ -8,24 +8,24 @@ module FinApps
|
|
8
8
|
|
9
9
|
# @return [Hash, Array<String>]
|
10
10
|
def show
|
11
|
-
logger.debug "##{__method__.to_s} => Started"
|
12
|
-
|
13
11
|
end_point = Defaults::END_POINTS[:alert_settings_show]
|
14
12
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
15
13
|
|
16
14
|
path = end_point
|
17
15
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
18
16
|
|
17
|
+
<<<<<<< HEAD
|
18
|
+
result, error_messages = @client.send(path, :get)
|
19
|
+
=======
|
19
20
|
result, error_messages = @client.send_request(path, :get)
|
20
21
|
|
21
22
|
logger.debug "##{__method__.to_s} => Completed"
|
23
|
+
>>>>>>> develop
|
22
24
|
return result, error_messages
|
23
25
|
end
|
24
26
|
|
25
27
|
# @return [Hash, Array<String>]
|
26
28
|
def update(params)
|
27
|
-
logger.debug "##{__method__.to_s} => Started"
|
28
|
-
|
29
29
|
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
30
30
|
logger.debug "##{__method__.to_s} => params: #{params.inspect}"
|
31
31
|
|
@@ -35,9 +35,13 @@ module FinApps
|
|
35
35
|
path = end_point
|
36
36
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
37
37
|
|
38
|
+
<<<<<<< HEAD
|
39
|
+
_, error_messages = @client.send(path, :put, params.compact)
|
40
|
+
=======
|
38
41
|
_, error_messages = @client.send_request(path, :put, params.compact)
|
39
42
|
|
40
43
|
logger.debug "##{__method__.to_s} => Completed"
|
44
|
+
>>>>>>> develop
|
41
45
|
error_messages
|
42
46
|
end
|
43
47
|
|
@@ -10,10 +10,9 @@ module FinApps
|
|
10
10
|
# @param [Number] income
|
11
11
|
# @return [Array<Hash>, Array<String>]
|
12
12
|
def create(budget_model_id, income)
|
13
|
-
logger.debug "##{__method__.to_s} => Started"
|
14
|
-
|
15
13
|
raise MissingArgumentsError.new 'Missing argument: budget_model_id.' if budget_model_id.blank?
|
16
14
|
logger.debug "##{__method__.to_s} => budget_model: #{budget_model_id}"
|
15
|
+
|
17
16
|
raise MissingArgumentsError.new 'Missing argument: income.' if income.blank?
|
18
17
|
logger.debug "##{__method__.to_s} => income: #{income}"
|
19
18
|
|
@@ -23,25 +22,31 @@ module FinApps
|
|
23
22
|
path = end_point.sub(':budget_model_id', ERB::Util.url_encode(budget_model_id)).sub(':income', ERB::Util.url_encode(income))
|
24
23
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
25
24
|
|
25
|
+
<<<<<<< HEAD
|
26
|
+
budget_calculation, error_messages = @client.send(path, :get)
|
27
|
+
=======
|
26
28
|
budget_calculation, error_messages = @client.send_request(path, :get)
|
27
29
|
logger.debug "##{__method__.to_s} => Completed"
|
28
30
|
|
31
|
+
>>>>>>> develop
|
29
32
|
return budget_calculation, error_messages
|
30
33
|
end
|
31
34
|
|
32
35
|
# @return [Array<Hash>, Array<String>]
|
33
36
|
def show
|
34
|
-
logger.debug "##{__method__.to_s} => Started"
|
35
|
-
|
36
37
|
end_point = Defaults::END_POINTS[:budget_calculation_show]
|
37
38
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
38
39
|
|
39
40
|
path = end_point
|
40
41
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
41
42
|
|
43
|
+
<<<<<<< HEAD
|
44
|
+
budget_calculation, error_messages = @client.send(path, :get)
|
45
|
+
=======
|
42
46
|
budget_calculation, error_messages = @client.send_request(path, :get)
|
43
47
|
logger.debug "##{__method__.to_s} => Completed"
|
44
48
|
|
49
|
+
>>>>>>> develop
|
45
50
|
return budget_calculation, error_messages
|
46
51
|
end
|
47
52
|
|
@@ -8,21 +8,21 @@ module FinApps
|
|
8
8
|
|
9
9
|
# @return [Array<Hash>, Array<String>]
|
10
10
|
def list
|
11
|
-
logger.debug "##{__method__.to_s} => Started"
|
12
|
-
|
13
11
|
path = Defaults::END_POINTS[:budget_models_list]
|
14
12
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
15
13
|
|
14
|
+
<<<<<<< HEAD
|
15
|
+
budget_models, error_messages = @client.send(path, :get)
|
16
|
+
=======
|
16
17
|
budget_models, error_messages = @client.send_request(path, :get)
|
17
18
|
|
18
19
|
logger.debug "##{__method__.to_s} => Completed"
|
20
|
+
>>>>>>> develop
|
19
21
|
return budget_models, error_messages
|
20
22
|
end
|
21
23
|
|
22
24
|
# @param [Integer] budget_model_id
|
23
25
|
def show(budget_model_id)
|
24
|
-
logger.debug "##{__method__.to_s} => Started"
|
25
|
-
|
26
26
|
raise MissingArgumentsError.new 'Missing argument: budget_model_id.' if budget_model_id.blank?
|
27
27
|
logger.debug "##{__method__.to_s} => budget_model_id: #{budget_model_id}"
|
28
28
|
|
@@ -32,9 +32,13 @@ module FinApps
|
|
32
32
|
path = end_point.sub ':budget_model_id', ERB::Util.url_encode(budget_model_id)
|
33
33
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
34
34
|
|
35
|
+
<<<<<<< HEAD
|
36
|
+
budget_model, error_messages = @client.send(path, :get) { |r| BudgetModel.new(r.body) }
|
37
|
+
=======
|
35
38
|
budget_model, error_messages = @client.send_request(path, :get) { |r| BudgetModel.new(r.body) }
|
36
39
|
|
37
40
|
logger.debug "##{__method__.to_s} => Completed"
|
41
|
+
>>>>>>> develop
|
38
42
|
return budget_model, error_messages
|
39
43
|
end
|
40
44
|
|
data/lib/finapps/rest/budgets.rb
CHANGED
@@ -10,10 +10,9 @@ module FinApps
|
|
10
10
|
# @param [Date] end_date
|
11
11
|
# @return [Hash, Array<String>]
|
12
12
|
def show(start_date, end_date)
|
13
|
-
logger.debug "##{__method__.to_s} => Started"
|
14
|
-
|
15
13
|
raise MissingArgumentsError.new 'Missing argument: start_date.' if start_date.blank?
|
16
14
|
logger.debug "##{__method__.to_s} => start_date: #{start_date}"
|
15
|
+
|
17
16
|
raise MissingArgumentsError.new 'Missing argument: end_date.' if end_date.blank?
|
18
17
|
logger.debug "##{__method__.to_s} => end_date: #{end_date}"
|
19
18
|
|
@@ -34,23 +33,24 @@ module FinApps
|
|
34
33
|
categories.each { |category| budget.details << result_category_to_budget_detail(category, transactions) }
|
35
34
|
end
|
36
35
|
|
37
|
-
logger.debug "##{__method__.to_s} => Completed"
|
38
36
|
return budget, error_messages
|
39
37
|
end
|
40
38
|
|
41
39
|
# @param [Hash] params
|
42
40
|
# @return [Array<Hash>, Array<String>]
|
43
41
|
def update(params={})
|
44
|
-
logger.debug "##{__method__.to_s} => Started"
|
45
|
-
|
46
42
|
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
47
43
|
|
48
44
|
end_point = Defaults::END_POINTS[:budget_update]
|
49
45
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
50
46
|
|
47
|
+
<<<<<<< HEAD
|
48
|
+
budget, error_messages = @client.send(end_point, :put, params)
|
49
|
+
=======
|
51
50
|
budget, error_messages = @client.send_request(end_point, :put, params)
|
52
51
|
logger.debug "##{__method__.to_s} => Completed"
|
53
52
|
|
53
|
+
>>>>>>> develop
|
54
54
|
return budget, error_messages
|
55
55
|
end
|
56
56
|
|
@@ -10,10 +10,9 @@ module FinApps
|
|
10
10
|
# @param [Date] end_date
|
11
11
|
# @return [Hash, Array<String>]
|
12
12
|
def show(start_date, end_date)
|
13
|
-
logger.debug "##{__method__.to_s} => Started"
|
14
|
-
|
15
13
|
raise MissingArgumentsError.new 'Missing argument: start_date.' if start_date.blank?
|
16
14
|
logger.debug "##{__method__.to_s} => start_date: #{start_date}"
|
15
|
+
|
17
16
|
raise MissingArgumentsError.new 'Missing argument: end_date.' if end_date.blank?
|
18
17
|
logger.debug "##{__method__.to_s} => end_date: #{end_date}"
|
19
18
|
|
@@ -52,7 +51,6 @@ module FinApps
|
|
52
51
|
categories.each { |category| cashflow.details << result_category_to_cashflow_detail(category) }
|
53
52
|
end
|
54
53
|
|
55
|
-
logger.debug "##{__method__.to_s} => Completed"
|
56
54
|
return cashflow, error_messages
|
57
55
|
end
|
58
56
|
|
@@ -5,17 +5,19 @@ module FinApps
|
|
5
5
|
|
6
6
|
# @return [Array<Hash>, Array<String>]
|
7
7
|
def list
|
8
|
-
logger.debug "##{__method__.to_s} => Started"
|
9
|
-
|
10
8
|
end_point = Defaults::END_POINTS[:categories_list]
|
11
9
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
12
10
|
|
13
11
|
path = end_point
|
14
12
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
15
13
|
|
14
|
+
<<<<<<< HEAD
|
15
|
+
categories, error_messages = @client.send(path, :get)
|
16
|
+
=======
|
16
17
|
categories, error_messages = @client.send_request(path, :get)
|
17
18
|
|
18
19
|
logger.debug "##{__method__.to_s} => Completed"
|
20
|
+
>>>>>>> develop
|
19
21
|
return categories, error_messages
|
20
22
|
end
|
21
23
|
|
data/lib/finapps/rest/client.rb
CHANGED
@@ -10,8 +10,6 @@ module FinApps
|
|
10
10
|
# @param [Hash] options
|
11
11
|
# @return [FinApps::REST::Client]
|
12
12
|
def initialize(company_identifier, company_token, options = {})
|
13
|
-
logger.debug "##{__method__.to_s} => Started"
|
14
|
-
|
15
13
|
@config = DEFAULTS.merge! options
|
16
14
|
logger_config @config
|
17
15
|
|
@@ -21,6 +19,10 @@ module FinApps
|
|
21
19
|
logger.debug "##{__method__.to_s} => Completed"
|
22
20
|
end
|
23
21
|
|
22
|
+
<<<<<<< HEAD
|
23
|
+
set_up_resources
|
24
|
+
logger.debug "##{__method__.to_s} => All resources initialized"
|
25
|
+
=======
|
24
26
|
def connection
|
25
27
|
@connection ||= set_up_connection(@company_credentials, @config)
|
26
28
|
end
|
@@ -79,6 +81,7 @@ module FinApps
|
|
79
81
|
|
80
82
|
def rule_sets
|
81
83
|
@rule_sets ||= FinApps::REST::Relevance::Rulesets.new self
|
84
|
+
>>>>>>> develop
|
82
85
|
end
|
83
86
|
|
84
87
|
# Performs HTTP GET, POST, UPDATE and DELETE requests.
|
@@ -89,8 +92,14 @@ module FinApps
|
|
89
92
|
# @param [String] method
|
90
93
|
# @param [Proc] proc
|
91
94
|
# @return [Hash,Array<String>]
|
95
|
+
<<<<<<< HEAD
|
96
|
+
def send(path, method, params = {}, &proc)
|
97
|
+
raise MissingArgumentsError.new 'Missing argument: method.' if method.blank?
|
98
|
+
result, error_messages = nil, nil
|
99
|
+
=======
|
92
100
|
def send_request(path, method, params = {}, &proc)
|
93
101
|
logger.debug "##{__method__.to_s} => Started"
|
102
|
+
>>>>>>> develop
|
94
103
|
|
95
104
|
raise FinApps::REST::MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
96
105
|
raise FinApps::REST::MissingArgumentsError.new 'Missing argument: method.' if method.blank?
|
@@ -131,24 +140,18 @@ module FinApps
|
|
131
140
|
ensure
|
132
141
|
logger.debug "##{__method__.to_s} => Failed, error_messages: #{error_messages.pretty_inspect}" if error_messages.present?
|
133
142
|
end
|
134
|
-
|
135
|
-
logger.debug "##{__method__.to_s} => Completed"
|
136
143
|
return result, error_messages
|
137
144
|
end
|
138
145
|
|
139
146
|
# @param [String] user_identifier
|
140
147
|
# @param [String] user_token
|
141
148
|
def user_credentials!(user_identifier, user_token)
|
142
|
-
logger.debug "##{__method__.to_s} => Started"
|
143
|
-
|
144
149
|
{:user_identifier => user_identifier, :user_token => user_token}.validate_required_strings!
|
145
150
|
logger.debug "##{__method__.to_s} => Credentials passed validation. Attempting to set user credentials on current connection."
|
146
151
|
|
147
152
|
@config[:user_identifier] = user_identifier
|
148
153
|
@config[:user_token] = user_token
|
149
154
|
@connection = set_up_connection(@company_credentials, @config)
|
150
|
-
|
151
|
-
logger.debug "##{__method__.to_s} => Completed"
|
152
155
|
end
|
153
156
|
|
154
157
|
private
|
@@ -160,16 +163,19 @@ module FinApps
|
|
160
163
|
# @param [String] path
|
161
164
|
# @return [Hash,Array<String>]
|
162
165
|
def get(path)
|
163
|
-
logger.debug "##{__method__.to_s} => Started"
|
164
166
|
raise MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
165
167
|
|
166
168
|
logger.debug "##{__method__.to_s} => GET path:#{path}"
|
169
|
+
<<<<<<< HEAD
|
170
|
+
@connection.get { |req| req.url path }
|
171
|
+
=======
|
167
172
|
response = connection.get do |req|
|
168
173
|
req.url path
|
169
174
|
end
|
170
175
|
|
171
176
|
logger.debug "##{__method__.to_s} => Completed"
|
172
177
|
response
|
178
|
+
>>>>>>> develop
|
173
179
|
end
|
174
180
|
|
175
181
|
# Performs an HTTP POST request.
|
@@ -180,17 +186,17 @@ module FinApps
|
|
180
186
|
# @param [Hash] params
|
181
187
|
# @return [Hash,Array<String>]
|
182
188
|
def post(path, params = {})
|
183
|
-
logger.debug "##{__method__.to_s} => Started"
|
184
189
|
raise MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
185
190
|
|
186
191
|
logger.debug "##{__method__.to_s} => POST path:#{path} params:#{skip_sensitive_data params }"
|
192
|
+
<<<<<<< HEAD
|
193
|
+
@connection.post do |req|
|
194
|
+
=======
|
187
195
|
response = connection.post do |req|
|
196
|
+
>>>>>>> develop
|
188
197
|
req.url path
|
189
198
|
req.body = params
|
190
199
|
end
|
191
|
-
|
192
|
-
logger.debug "##{__method__.to_s} => Completed"
|
193
|
-
response
|
194
200
|
end
|
195
201
|
|
196
202
|
# Performs an HTTP PUT request.
|
@@ -201,17 +207,17 @@ module FinApps
|
|
201
207
|
# @param [Hash] params
|
202
208
|
# @return [Hash,Array<String>]
|
203
209
|
def put(path, params = {})
|
204
|
-
logger.debug "##{__method__.to_s} => Started"
|
205
210
|
raise MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
206
211
|
|
207
212
|
logger.debug "##{__method__.to_s} => PUT path:#{path} params:#{skip_sensitive_data(params)}"
|
213
|
+
<<<<<<< HEAD
|
214
|
+
@connection.put do |req|
|
215
|
+
=======
|
208
216
|
response = connection.put do |req|
|
217
|
+
>>>>>>> develop
|
209
218
|
req.url path
|
210
219
|
req.body = params
|
211
220
|
end
|
212
|
-
|
213
|
-
logger.debug "##{__method__.to_s} => Completed"
|
214
|
-
response
|
215
221
|
end
|
216
222
|
|
217
223
|
# Performs an HTTP DELETE request.
|
@@ -222,19 +228,41 @@ module FinApps
|
|
222
228
|
# @param [Hash] params
|
223
229
|
# @return [Hash,Array<String>]
|
224
230
|
def delete(path, params = {})
|
225
|
-
logger.debug "##{__method__.to_s} => Started"
|
226
231
|
raise MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
227
232
|
|
228
233
|
logger.debug "##{__method__.to_s} => DELETE path:#{path} params:#{skip_sensitive_data(params)}"
|
234
|
+
<<<<<<< HEAD
|
235
|
+
@connection.delete do |req|
|
236
|
+
=======
|
229
237
|
response = connection.delete do |req|
|
238
|
+
>>>>>>> develop
|
230
239
|
req.url path
|
231
240
|
req.body = params
|
232
241
|
end
|
242
|
+
end
|
233
243
|
|
234
|
-
|
235
|
-
|
244
|
+
<<<<<<< HEAD
|
245
|
+
# Initialize resources.
|
246
|
+
#
|
247
|
+
def set_up_resources
|
248
|
+
@users ||= FinApps::REST::Users.new self
|
249
|
+
@institutions ||= FinApps::REST::Institutions.new self
|
250
|
+
@user_institutions ||= FinApps::REST::UserInstitutions.new self
|
251
|
+
@transactions ||= FinApps::REST::Transactions.new self
|
252
|
+
@categories ||= FinApps::REST::Categories.new self
|
253
|
+
@budget_models ||= FinApps::REST::BudgetModels.new self
|
254
|
+
@budget_calculation ||= FinApps::REST::BudgetCalculation.new self
|
255
|
+
@budgets ||= FinApps::REST::Budgets.new self
|
256
|
+
@cashflows ||= FinApps::REST::Cashflows.new self
|
257
|
+
@alert ||= FinApps::REST::Alert.new self
|
258
|
+
@alert_definition ||= FinApps::REST::AlertDefinition.new self
|
259
|
+
@alert_settings ||= FinApps::REST::AlertSettings.new self
|
260
|
+
@alert_preferences ||= FinApps::REST::AlertPreferences.new self
|
261
|
+
@rule_sets ||= FinApps::REST::Relevance::Rulesets.new self
|
236
262
|
end
|
237
263
|
|
264
|
+
=======
|
265
|
+
>>>>>>> develop
|
238
266
|
end
|
239
267
|
end
|
240
268
|
end
|
@@ -11,7 +11,7 @@ module FinApps
|
|
11
11
|
|
12
12
|
# noinspection SpellCheckingInspection
|
13
13
|
DEFAULTS = {
|
14
|
-
:host => 'https://
|
14
|
+
:host => 'https://api.financialapps.com',
|
15
15
|
:timeout => 30,
|
16
16
|
:proxy_addr => nil,
|
17
17
|
:proxy_port => nil,
|
@@ -27,6 +27,7 @@ module FinApps
|
|
27
27
|
:users_update => 'user',
|
28
28
|
:users_update_password => 'user/password',
|
29
29
|
:users_delete => 'users/:public_id',
|
30
|
+
:users_show => 'users/:public_id',
|
30
31
|
:users_login => 'users/login',
|
31
32
|
|
32
33
|
:relevance_rulesets_list => 'relevance/ruleset/names',
|
@@ -9,8 +9,6 @@ module FinApps
|
|
9
9
|
# @param [String] term
|
10
10
|
# @return [Array<FinApps::REST::Institution>, Array<String>]
|
11
11
|
def search(term)
|
12
|
-
logger.debug "##{__method__.to_s} => Started"
|
13
|
-
|
14
12
|
raise MissingArgumentsError.new 'Missing argument: term.' if term.blank?
|
15
13
|
logger.debug "##{__method__.to_s} => term: #{term}"
|
16
14
|
|
@@ -20,16 +18,18 @@ module FinApps
|
|
20
18
|
path = end_point.sub ':search_term', ERB::Util.url_encode(term)
|
21
19
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
22
20
|
|
21
|
+
<<<<<<< HEAD
|
22
|
+
institutions, error_messages = @client.send(path, :get)
|
23
|
+
=======
|
23
24
|
institutions, error_messages = @client.send_request(path, :get)
|
24
25
|
|
25
26
|
logger.debug "##{__method__.to_s} => Completed"
|
27
|
+
>>>>>>> develop
|
26
28
|
return institutions, error_messages
|
27
29
|
end
|
28
30
|
|
29
31
|
# @param [Integer] site_id
|
30
32
|
def form(site_id)
|
31
|
-
logger.debug "##{__method__.to_s} => Started"
|
32
|
-
|
33
33
|
raise MissingArgumentsError.new 'Missing argument: site_id.' if site_id.blank?
|
34
34
|
logger.debug "##{__method__.to_s} => site_id: #{site_id}"
|
35
35
|
|
@@ -39,9 +39,13 @@ module FinApps
|
|
39
39
|
path = end_point.sub ':site_id', ERB::Util.url_encode(site_id)
|
40
40
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
41
41
|
|
42
|
+
<<<<<<< HEAD
|
43
|
+
institution, error_messages = @client.send(path, :get) { |r| Institution.new(r.body) }
|
44
|
+
=======
|
42
45
|
institution, error_messages = @client.send_request(path, :get) { |r| Institution.new(r.body) }
|
43
46
|
|
44
47
|
logger.debug "##{__method__.to_s} => Completed"
|
48
|
+
>>>>>>> develop
|
45
49
|
return institution, error_messages
|
46
50
|
end
|
47
51
|
|
@@ -7,7 +7,7 @@ module FinApps
|
|
7
7
|
class Rulesets < FinApps::REST::Resources
|
8
8
|
|
9
9
|
def list
|
10
|
-
|
10
|
+
|
11
11
|
|
12
12
|
end_point = Defaults::END_POINTS[:relevance_rulesets_list]
|
13
13
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
@@ -17,12 +17,12 @@ module FinApps
|
|
17
17
|
|
18
18
|
results, error_messages = @client.send_request(path, :get)
|
19
19
|
|
20
|
-
|
20
|
+
|
21
21
|
return results, error_messages
|
22
22
|
end
|
23
23
|
|
24
24
|
def show(ruleset_name)
|
25
|
-
|
25
|
+
|
26
26
|
|
27
27
|
raise MissingArgumentsError.new 'Missing argument: ruleset_name.' if ruleset_name.blank?
|
28
28
|
logger.debug "##{__method__.to_s} => ruleset_name: #{ruleset_name}"
|
@@ -35,12 +35,12 @@ module FinApps
|
|
35
35
|
|
36
36
|
results, error_messages = @client.send_request(path, :get)
|
37
37
|
|
38
|
-
|
38
|
+
|
39
39
|
return results, error_messages
|
40
40
|
end
|
41
41
|
|
42
42
|
def run(params = {})
|
43
|
-
|
43
|
+
|
44
44
|
|
45
45
|
raise MissingArgumentsError.new 'Missing argument: params.' if params.blank?
|
46
46
|
logger.debug "##{__method__.to_s} => params: #{params.inspect}"
|
@@ -53,7 +53,7 @@ module FinApps
|
|
53
53
|
|
54
54
|
results, error_messages = @client.send_request(path, :post, params)
|
55
55
|
|
56
|
-
|
56
|
+
|
57
57
|
return results, error_messages
|
58
58
|
end
|
59
59
|
|
@@ -7,45 +7,51 @@ module FinApps
|
|
7
7
|
# @transaction_id [String]
|
8
8
|
# # @return [Hash, Array<String>]
|
9
9
|
def show(transaction_id)
|
10
|
-
logger.debug "##{__method__.to_s} => Started"
|
11
|
-
|
12
10
|
end_point = Defaults::END_POINTS[:transactions_show]
|
13
11
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
14
12
|
|
15
13
|
path = end_point.sub ':transaction_id', ERB::Util.url_encode(transaction_id)
|
16
14
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
17
15
|
|
16
|
+
<<<<<<< HEAD
|
17
|
+
transaction, error_messages = @client.send(path, :get)
|
18
|
+
=======
|
18
19
|
transaction, error_messages = @client.send_request(path, :get)
|
19
20
|
|
20
21
|
logger.debug "##{__method__.to_s} => Completed"
|
22
|
+
>>>>>>> develop
|
21
23
|
return transaction, error_messages
|
22
24
|
end
|
23
25
|
|
24
26
|
# @param [Hash] params
|
25
27
|
# @return [Array<Hash>, Array<String>]
|
26
28
|
def search(params={})
|
27
|
-
logger.debug "##{__method__.to_s} => Started"
|
28
|
-
|
29
29
|
path = Defaults::END_POINTS[:transactions_list]
|
30
30
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
31
31
|
|
32
|
+
<<<<<<< HEAD
|
33
|
+
transactions, error_messages = @client.send(path, :post, params.compact)
|
34
|
+
=======
|
32
35
|
transactions, error_messages = @client.send_request(path, :post, params.compact)
|
33
36
|
|
34
37
|
logger.debug "##{__method__.to_s} => Completed"
|
38
|
+
>>>>>>> develop
|
35
39
|
return transactions, error_messages
|
36
40
|
end
|
37
41
|
|
38
42
|
# @param [Hash] params
|
39
43
|
# @return [Array<Hash>, Array<String>]
|
40
44
|
def update(params={})
|
41
|
-
logger.debug "##{__method__.to_s} => Started"
|
42
|
-
|
43
45
|
path = Defaults::END_POINTS[:transactions_update]
|
44
46
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
45
47
|
|
48
|
+
<<<<<<< HEAD
|
49
|
+
_, error_messages = @client.send(path, :put, params.compact)
|
50
|
+
=======
|
46
51
|
_, error_messages = @client.send_request(path, :put, params.compact)
|
47
52
|
|
48
53
|
logger.debug "##{__method__.to_s} => Completed"
|
54
|
+
>>>>>>> develop
|
49
55
|
error_messages
|
50
56
|
end
|
51
57
|
|
@@ -7,19 +7,15 @@ module FinApps
|
|
7
7
|
include FinApps::REST::Defaults
|
8
8
|
|
9
9
|
def list
|
10
|
-
logger.debug "##{__method__.to_s} => Started"
|
11
|
-
|
12
10
|
path = Defaults::END_POINTS[:user_institutions_list]
|
13
11
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
14
12
|
|
15
13
|
user_institutions, error_messages = @client.send_request(path, :get)
|
16
14
|
|
17
|
-
logger.debug "##{__method__.to_s} => Completed"
|
18
15
|
return user_institutions, error_messages
|
19
16
|
end
|
20
17
|
|
21
18
|
def add(site_id, parameters)
|
22
|
-
logger.debug "##{__method__.to_s} => Started"
|
23
19
|
|
24
20
|
raise MissingArgumentsError.new 'Missing argument: site_id.' if site_id.blank?
|
25
21
|
logger.debug "##{__method__.to_s} => site_id: #{site_id}"
|
@@ -35,12 +31,10 @@ module FinApps
|
|
35
31
|
|
36
32
|
user_institution, error_messages = @client.send_request(path, :post, :parameters => parameters)
|
37
33
|
|
38
|
-
logger.debug "##{__method__.to_s} => Completed"
|
39
34
|
return user_institution, error_messages
|
40
35
|
end
|
41
36
|
|
42
37
|
def show(user_institution_id)
|
43
|
-
logger.debug "##{__method__.to_s} => Started"
|
44
38
|
|
45
39
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
46
40
|
logger.debug "##{__method__.to_s} => user_institution_id: #{user_institution_id}"
|
@@ -53,13 +47,10 @@ module FinApps
|
|
53
47
|
|
54
48
|
user_institution, error_messages = @client.send_request(path, :get)
|
55
49
|
|
56
|
-
logger.debug "##{__method__.to_s} => Completed"
|
57
50
|
return user_institution, error_messages
|
58
51
|
end
|
59
52
|
|
60
53
|
def form(user_institution_id)
|
61
|
-
logger.debug "##{__method__.to_s} => Started"
|
62
|
-
|
63
54
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
64
55
|
logger.debug "##{__method__.to_s} => user_institution_id: #{user_institution_id}"
|
65
56
|
|
@@ -71,13 +62,10 @@ module FinApps
|
|
71
62
|
|
72
63
|
user_institution, error_messages = @client.send_request(path, :get)
|
73
64
|
|
74
|
-
logger.debug "##{__method__.to_s} => Completed"
|
75
65
|
return user_institution, error_messages
|
76
66
|
end
|
77
67
|
|
78
68
|
def status(user_institution_id)
|
79
|
-
logger.debug "##{__method__.to_s} => Started"
|
80
|
-
|
81
69
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
82
70
|
logger.debug "##{__method__.to_s} => user_institution_id: #{user_institution_id}"
|
83
71
|
|
@@ -89,13 +77,10 @@ module FinApps
|
|
89
77
|
|
90
78
|
user_institution, error_messages = @client.send_request(path, :get)
|
91
79
|
|
92
|
-
logger.debug "##{__method__.to_s} => Completed"
|
93
80
|
return user_institution, error_messages
|
94
81
|
end
|
95
82
|
|
96
83
|
def mfa(user_institution_id, parameters)
|
97
|
-
logger.debug "##{__method__.to_s} => Started"
|
98
|
-
|
99
84
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
100
85
|
logger.debug "##{__method__.to_s} => user_institution_id: #{user_institution_id}"
|
101
86
|
|
@@ -110,13 +95,10 @@ module FinApps
|
|
110
95
|
|
111
96
|
user_institution, error_messages = @client.send_request(path, :put, :parameters => parameters)
|
112
97
|
|
113
|
-
logger.debug "##{__method__.to_s} => Completed"
|
114
98
|
return user_institution, error_messages
|
115
99
|
end
|
116
100
|
|
117
101
|
def update(user_institution_id, parameters)
|
118
|
-
logger.debug "##{__method__.to_s} => Started"
|
119
|
-
|
120
102
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
121
103
|
logger.debug "##{__method__.to_s} => user_institution_id: #{user_institution_id}"
|
122
104
|
|
@@ -131,26 +113,20 @@ module FinApps
|
|
131
113
|
|
132
114
|
user_institution, error_messages = @client.send_request(path, :put, :parameters => parameters)
|
133
115
|
|
134
|
-
logger.debug "##{__method__.to_s} => Completed"
|
135
116
|
return user_institution, error_messages
|
136
117
|
end
|
137
118
|
|
138
119
|
def refresh
|
139
|
-
logger.debug "##{__method__.to_s} => Started"
|
140
|
-
|
141
120
|
path = Defaults::END_POINTS[:user_institutions_refresh]
|
142
121
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
143
122
|
|
144
123
|
user_institutions, error_messages = @client.send_request(path, :get)
|
145
124
|
|
146
|
-
logger.debug "##{__method__.to_s} => Completed"
|
147
125
|
return user_institutions, error_messages
|
148
126
|
end
|
149
127
|
|
150
128
|
# @return [Hash, Array<String>]
|
151
129
|
def delete(user_institution_id)
|
152
|
-
logger.debug "##{__method__.to_s} => Started"
|
153
|
-
|
154
130
|
raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
|
155
131
|
logger.debug "##{__method__.to_s} => user_institution_id: #{user_institution_id.inspect}"
|
156
132
|
|
@@ -162,7 +138,6 @@ module FinApps
|
|
162
138
|
|
163
139
|
_, error_messages = @client.send_request(path, :delete)
|
164
140
|
|
165
|
-
logger.debug "##{__method__.to_s} => Completed"
|
166
141
|
error_messages
|
167
142
|
end
|
168
143
|
|
data/lib/finapps/rest/users.rb
CHANGED
@@ -7,6 +7,23 @@ module FinApps
|
|
7
7
|
include FinApps::Logging
|
8
8
|
include FinApps::REST::Defaults
|
9
9
|
|
10
|
+
# @param [String] public_id
|
11
|
+
# @return [FinApps::REST::User, Array<String>]
|
12
|
+
def show(public_id)
|
13
|
+
raise MissingArgumentsError.new 'Missing argument: public_id.' if public_id.blank?
|
14
|
+
logger.debug "##{__method__.to_s} => public_id: #{public_id}"
|
15
|
+
|
16
|
+
end_point = Defaults::END_POINTS[:users_show]
|
17
|
+
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
18
|
+
|
19
|
+
path = end_point.sub ':public_id', ERB::Util.url_encode(public_id)
|
20
|
+
logger.debug "##{__method__.to_s} => path: #{path}"
|
21
|
+
|
22
|
+
user, error_messages = @client.send_request(path, :get) { |r| User.new(r.body) }
|
23
|
+
|
24
|
+
return user, error_messages
|
25
|
+
end
|
26
|
+
|
10
27
|
# @param [Hash] params
|
11
28
|
# @return [FinApps::REST::User, Array<String>]
|
12
29
|
def create(params = {})
|
@@ -24,6 +41,8 @@ module FinApps
|
|
24
41
|
return user, error_messages
|
25
42
|
end
|
26
43
|
|
44
|
+
# @param [Hash] params
|
45
|
+
# @return [Array<String>]
|
27
46
|
def update(params = {})
|
28
47
|
logger.debug "##{__method__.to_s} => Started"
|
29
48
|
|
@@ -38,6 +57,8 @@ module FinApps
|
|
38
57
|
error_messages
|
39
58
|
end
|
40
59
|
|
60
|
+
# @param [Hash] params
|
61
|
+
# @return [FinApps::REST::User, Array<String>]
|
41
62
|
def update_password(params = {})
|
42
63
|
logger.debug "##{__method__.to_s} => Started"
|
43
64
|
|
@@ -96,4 +117,4 @@ module FinApps
|
|
96
117
|
end
|
97
118
|
|
98
119
|
end
|
99
|
-
end
|
120
|
+
end
|
@@ -35,9 +35,17 @@ module FinApps
|
|
35
35
|
|
36
36
|
end
|
37
37
|
|
38
|
+
<<<<<<< HEAD
|
39
|
+
def set_up_logger_level(logger_level)
|
40
|
+
unless logger_level.blank? || logger.level == logger_level
|
41
|
+
logger.info "##{__method__.to_s} => Setting logger level to #{SEVERITY_LABEL[logger_level]}"
|
42
|
+
logger.level = logger_level
|
43
|
+
end
|
44
|
+
=======
|
38
45
|
def logger_config(config)
|
39
46
|
Logging.tag= config[:logger_tag] if config[:logger_tag].present?
|
40
47
|
Logging.level = config[:log_level] if config[:log_level].present?
|
48
|
+
>>>>>>> develop
|
41
49
|
end
|
42
50
|
|
43
51
|
# noinspection SpellCheckingInspection
|
data/lib/finapps/version.rb
CHANGED
data/spec/rest/client_spec.rb
CHANGED
@@ -22,6 +22,15 @@ 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
|
+
=======
|
25
34
|
end
|
26
35
|
|
27
36
|
context 'after initialized' do
|
@@ -33,6 +42,7 @@ RSpec.describe FinApps::REST::Client do
|
|
33
42
|
:alert_definition, :alert_preferences, :alert_settings, :rule_sets, :user_credentials!].each do |method|
|
34
43
|
it "responds to #{method}" do
|
35
44
|
expect(client).to respond_to(method)
|
45
|
+
>>>>>>> develop
|
36
46
|
end
|
37
47
|
end
|
38
48
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
RSpec.describe FinApps::REST::Users do
|
2
|
+
|
3
|
+
context 'after initialized' do
|
4
|
+
let(:users) { FinApps::REST::Users.new(FinApps::REST::Client.new(:id, :token)) }
|
5
|
+
|
6
|
+
[:show, :create, :update, :update_password, :login, :delete].each do |method|
|
7
|
+
it "responds to #{method}" do
|
8
|
+
expect(users).to respond_to(method)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#show' do
|
13
|
+
|
14
|
+
context 'when public_id is NOT provided' do
|
15
|
+
it { expect { users.show(nil) }.to raise_error(FinApps::REST::MissingArgumentsError) }
|
16
|
+
end
|
17
|
+
|
18
|
+
it { expect(users.show(1)[0]).to be_an_instance_of(FinApps::REST::User) }
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,22 +2,9 @@ require 'bundler/setup'
|
|
2
2
|
Bundler.setup
|
3
3
|
|
4
4
|
require 'finapps'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# file to always be loaded, without a need to explicitly require it in any files.
|
9
|
-
#
|
10
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
11
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
12
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
13
|
-
# individual file that may not need all of that loaded. Instead, make a
|
14
|
-
# separate helper file that requires this one and then use it only in the specs
|
15
|
-
# that actually need it.
|
16
|
-
#
|
17
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
18
|
-
# users commonly want.
|
19
|
-
#
|
20
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
5
|
+
require 'webmock/rspec'
|
6
|
+
require File.join(File.dirname(__dir__), 'spec/support/fake_api')
|
7
|
+
|
21
8
|
RSpec.configure do |config|
|
22
9
|
config.expect_with(:rspec) do |expectations|
|
23
10
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
@@ -33,6 +20,8 @@ RSpec.configure do |config|
|
|
33
20
|
config.warnings = true
|
34
21
|
config.profile_examples = 5
|
35
22
|
Kernel.srand config.seed
|
36
|
-
end
|
37
23
|
|
38
|
-
|
24
|
+
config.before(:each) do
|
25
|
+
stub_request(:any, /api.financialapps.com/).to_rack(::FakeApi )
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
|
3
|
+
class FakeApi < Sinatra::Base
|
4
|
+
# users
|
5
|
+
get('/v1/users/:id') { json_response 200, 'user.json' }
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def json_response(response_code, file_name)
|
10
|
+
content_type :json
|
11
|
+
status response_code
|
12
|
+
File.open(File.dirname(__FILE__) + '/fixtures/' + file_name, 'rb').read
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
{
|
2
|
+
"public_id":"83e6c55a-9883-40bb-45f9-fc70d70731c9",
|
3
|
+
"first_name":"Erich",
|
4
|
+
"last_name":"{\"phone_number\":\"3052224444\", \"first_name\":\"John\", \"last_name\":\"Smith\", \"savings_plan_id\":1}",
|
5
|
+
"email":"erich.1440775160085@example.com",
|
6
|
+
"postal_code":"00000",
|
7
|
+
"token":"XkI8MORAlR5m2DvF+QuSkrWGsVrBfZUI3mRToYzZ494="
|
8
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erich Quintero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -190,6 +190,26 @@ dependencies:
|
|
190
190
|
- - ">="
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: 1.24.2
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: sinatra
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - "~>"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '1.4'
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: 1.4.7
|
203
|
+
type: :development
|
204
|
+
prerelease: false
|
205
|
+
version_requirements: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - "~>"
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '1.4'
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: 1.4.7
|
193
213
|
description: A simple library for communicating with the FinApps REST API.
|
194
214
|
email:
|
195
215
|
- erich@financialapps.com
|
@@ -238,7 +258,10 @@ files:
|
|
238
258
|
- spec/middleware/api_token_spec.rb
|
239
259
|
- spec/rest/client_spec.rb
|
240
260
|
- spec/rest/connection_spec.rb
|
261
|
+
- spec/rest/users_spec.rb
|
241
262
|
- spec/spec_helper.rb
|
263
|
+
- spec/support/fake_api.rb
|
264
|
+
- spec/support/fixtures/user.json
|
242
265
|
- spec/utils/logging_spec.rb
|
243
266
|
homepage: http://github.com/finapps/finapps-ruby
|
244
267
|
licenses:
|
@@ -266,13 +289,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
289
|
version: '0'
|
267
290
|
requirements: []
|
268
291
|
rubyforge_project:
|
269
|
-
rubygems_version: 2.
|
292
|
+
rubygems_version: 2.4.8
|
270
293
|
signing_key:
|
271
294
|
specification_version: 4
|
272
295
|
summary: FinApps REST API ruby client.
|
273
296
|
test_files:
|
274
297
|
- spec/spec_helper.rb
|
275
|
-
- spec/
|
276
|
-
- spec/rest/client_spec.rb
|
298
|
+
- spec/support/fake_api.rb
|
277
299
|
- spec/utils/logging_spec.rb
|
278
300
|
- spec/middleware/api_token_spec.rb
|
301
|
+
- spec/rest/connection_spec.rb
|
302
|
+
- spec/rest/client_spec.rb
|
303
|
+
- spec/rest/users_spec.rb
|