revo-loans_api 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/revo/loans_api/client.rb +25 -9
- data/lib/revo/loans_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08a66e7335a4d5d4371890e1ee11b9778729f7c5ddd9cd107f07d6c1596a2991'
|
4
|
+
data.tar.gz: cc46a9ca1e703815a6d1f3af08071d2d4ac727c44313b615fc9e4d9be9e813fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94e5e78e1756fc7324c12a71ba1b15a28d6c03990254cd642175f7eb7207248debc38229adaa7a3eeff14a980ee536ab7a5cb6c591cedf4d4fa9e7cbea3c1d8c
|
7
|
+
data.tar.gz: 668b22a558b359915f48a0156d4c30e59293ffa90eef8518fdfb3a8cf966de1431b49d99b3f608ebcbabca86599495157c9197a8fd8439d9e807bd8b455fffe1
|
data/Gemfile.lock
CHANGED
@@ -33,13 +33,14 @@ class Revo::LoansApi::Client
|
|
33
33
|
return response unless response.success?
|
34
34
|
|
35
35
|
@loan_request_token = response.response.dig(:loan_request, :token)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
terms = loan_request_terms
|
37
|
+
return terms unless terms.success?
|
38
|
+
|
39
|
+
Result.new(success?: true,
|
40
|
+
response: {
|
41
|
+
token: loan_request_token,
|
42
|
+
terms: terms.response[:loan_request]
|
43
|
+
})
|
43
44
|
end
|
44
45
|
|
45
46
|
def update_loan_request(token:, options:)
|
@@ -48,12 +49,24 @@ class Revo::LoansApi::Client
|
|
48
49
|
|
49
50
|
return response unless response.success?
|
50
51
|
|
52
|
+
@loan_request_token = token
|
53
|
+
terms = loan_request_terms
|
54
|
+
return terms unless terms.success?
|
55
|
+
|
51
56
|
Result.new(
|
52
57
|
success?: true,
|
53
|
-
response: {
|
58
|
+
response: {
|
59
|
+
terms: terms.response[:loan_request]
|
60
|
+
}
|
54
61
|
)
|
55
62
|
end
|
56
63
|
|
64
|
+
def get_loan_request_info(token:, amount:)
|
65
|
+
result = make_request(:get, "loan_requests/#{token}?amount=#{amount}")
|
66
|
+
|
67
|
+
result.success? ? result.response[:loan_request] : []
|
68
|
+
end
|
69
|
+
|
57
70
|
# prerequisite: a client with the LR's phone number should already exist
|
58
71
|
def document(token:, type:, format: 'html')
|
59
72
|
make_request(:get, "loan_requests/#{token}/documents/#{type}.#{format}")
|
@@ -145,7 +158,10 @@ class Revo::LoansApi::Client
|
|
145
158
|
end
|
146
159
|
|
147
160
|
def loan_request_terms(&block)
|
148
|
-
make_request(:get, "loan_requests/#{loan_request_token}", &block)
|
161
|
+
result = make_request(:get, "loan_requests/#{loan_request_token}", &block)
|
162
|
+
return result if result.success?
|
163
|
+
|
164
|
+
Result.new(success?: false, response: { errors: { loan_request_terms: :cant_fetch } })
|
149
165
|
end
|
150
166
|
|
151
167
|
def make_request(method, endpoint, params = {}, &block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: revo-loans_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Revo Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|