finapps 0.1.8.pre → 0.1.10.pre
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/finapps/rest/client.rb +10 -14
- data/lib/finapps/rest/institutions.rb +2 -2
- data/lib/finapps/rest/users.rb +3 -3
- data/lib/finapps/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9bb9c1f912e72afc9a3b0b8c72e1f8285df32a7
|
4
|
+
data.tar.gz: 7047152f6c890bd120dc1e0cd1ef4ce76f393e09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1739253c2b1d1c9420ceb99c486ea5d30f64763552d221fc41c015649a7a45c6b219d36159ef4906294044f73258c23e196cf3e2f3e205c2c7ef6c76f271897e
|
7
|
+
data.tar.gz: 445c302fe03d7727540fbd58e7bab99d4b6e3a5408adfe2a91ae5233f66d910f38808c59a77f9520aa1ab3ec35ba51b0c81431d6b4073ee10f66f52980c3ec77
|
data/lib/finapps/rest/client.rb
CHANGED
@@ -45,6 +45,7 @@ module FinApps
|
|
45
45
|
# @return [Hash,Array<String>]
|
46
46
|
def send(path, method, params = {}, &proc)
|
47
47
|
logger.debug "##{__method__.to_s} => Started"
|
48
|
+
raise MissingArgumentsError.new 'Missing argument: method.' if method.blank?
|
48
49
|
result, error_messages = nil, nil
|
49
50
|
|
50
51
|
begin
|
@@ -88,20 +89,15 @@ module FinApps
|
|
88
89
|
def get(path, &proc)
|
89
90
|
logger.debug "##{__method__.to_s} => Started"
|
90
91
|
raise MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
91
|
-
|
92
|
+
result, error_messages = nil, nil
|
92
93
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
logger.debug "##{__method__.to_s} => parsed result: #{result.pretty_inspect}" if result.present?
|
101
|
-
end
|
102
|
-
rescue FinApps::REST::Error => error
|
103
|
-
error_messages = error.error_messages
|
104
|
-
logger.debug "##{__method__.to_s} => Failed, error_messages: #{error_messages.pretty_inspect}" if error_messages.present?
|
94
|
+
logger.debug "##{__method__.to_s} => GET path:#{path}"
|
95
|
+
response = @connection.get do |req|
|
96
|
+
req.url path
|
97
|
+
end
|
98
|
+
if response.present? && block_given?
|
99
|
+
result = proc.call(response)
|
100
|
+
logger.debug "##{__method__.to_s} => parsed result: #{result.pretty_inspect}" if result.present?
|
105
101
|
end
|
106
102
|
|
107
103
|
logger.debug "##{__method__.to_s} => Completed"
|
@@ -119,7 +115,7 @@ module FinApps
|
|
119
115
|
def post(path, params = {}, &proc)
|
120
116
|
logger.debug "##{__method__.to_s} => Started"
|
121
117
|
raise MissingArgumentsError.new 'Missing argument: path.' if path.blank?
|
122
|
-
result, error_messages = nil, nil
|
118
|
+
result, error_messages = nil, nil
|
123
119
|
|
124
120
|
logger.debug "##{__method__.to_s} => POST path:#{path} params:#{skip_sensitive_data(params)}"
|
125
121
|
response = @connection.post do |req|
|
@@ -20,7 +20,7 @@ module FinApps
|
|
20
20
|
path = end_point.sub ':search_term', ERB::Util.url_encode(term)
|
21
21
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
22
22
|
|
23
|
-
institutions, error_messages = @client.
|
23
|
+
institutions, error_messages = @client.post(path, :post) do |r|
|
24
24
|
r.body.each { |i| Institution.new(i) }
|
25
25
|
end
|
26
26
|
|
@@ -41,7 +41,7 @@ module FinApps
|
|
41
41
|
path = end_point.sub ':site_id', ERB::Util.url_encode(site_id)
|
42
42
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
43
43
|
|
44
|
-
institution, error_messages = @client.
|
44
|
+
institution, error_messages = @client.send(path, :get) { |r| Institution.new(r.body) }
|
45
45
|
|
46
46
|
logger.debug "##{__method__.to_s} => Completed"
|
47
47
|
return institution, error_messages
|
data/lib/finapps/rest/users.rb
CHANGED
@@ -15,7 +15,7 @@ module FinApps
|
|
15
15
|
end_point = Defaults::END_POINTS[:users_create]
|
16
16
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
17
17
|
|
18
|
-
user, error_messages = @client.
|
18
|
+
user, error_messages = @client.send(end_point, :post, params) { |r| User.new(r.body) }
|
19
19
|
logger.debug "##{__method__.to_s} => Completed"
|
20
20
|
|
21
21
|
return user, error_messages
|
@@ -31,7 +31,7 @@ module FinApps
|
|
31
31
|
end_point = Defaults::END_POINTS[:users_login]
|
32
32
|
logger.debug "##{__method__.to_s} => end_point: #{end_point}"
|
33
33
|
|
34
|
-
user, error_messages = @client.
|
34
|
+
user, error_messages = @client.send(end_point, :post, params) { |r| User.new(r.body) }
|
35
35
|
logger.debug "##{__method__.to_s} => Completed"
|
36
36
|
|
37
37
|
return user, error_messages
|
@@ -51,7 +51,7 @@ module FinApps
|
|
51
51
|
path = end_point.sub ':public_id', ERB::Util.url_encode(public_id)
|
52
52
|
logger.debug "##{__method__.to_s} => path: #{path}"
|
53
53
|
|
54
|
-
_, error_messages = @client.
|
54
|
+
_, error_messages = @client.send(path, :delete)
|
55
55
|
logger.debug "##{__method__.to_s} => Completed"
|
56
56
|
|
57
57
|
error_messages
|
data/lib/finapps/version.rb
CHANGED