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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42037b1b0b7a36cd1e24c0bcae6a3c530704fb9e0c1d7391badd901b78d49a0e
4
- data.tar.gz: '04967e25561ba10bfc5a963e2377e23bf65a822ebfdd38ede6f07605652da9e3'
3
+ metadata.gz: '08a66e7335a4d5d4371890e1ee11b9778729f7c5ddd9cd107f07d6c1596a2991'
4
+ data.tar.gz: cc46a9ca1e703815a6d1f3af08071d2d4ac727c44313b615fc9e4d9be9e813fc
5
5
  SHA512:
6
- metadata.gz: 1e35433067f7cf5c10af3e1e59e6a1be1012d392255d2ff6369102bdace33ffe0a2ab6d2cf290b8ad616170d8d5be4c3d85e9dcaa11225d0e62c96ae26cf223f
7
- data.tar.gz: a8b81f6be52bda5d1902664a75846bd348ece0f15777060aea7de532ba804b87ad72c82e47b33e0461160f48f7191c7d5bf74acc605d2adff4c0794c89758447
6
+ metadata.gz: 94e5e78e1756fc7324c12a71ba1b15a28d6c03990254cd642175f7eb7207248debc38229adaa7a3eeff14a980ee536ab7a5cb6c591cedf4d4fa9e7cbea3c1d8c
7
+ data.tar.gz: 668b22a558b359915f48a0156d4c30e59293ffa90eef8518fdfb3a8cf966de1431b49d99b3f608ebcbabca86599495157c9197a8fd8439d9e807bd8b455fffe1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- revo-loans_api (0.0.7)
4
+ revo-loans_api (0.0.8)
5
5
  activesupport
6
6
  http
7
7
 
@@ -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
- Result.new(
37
- success?: true,
38
- response: {
39
- token: loan_request_token,
40
- terms: loan_request_terms.response[:loan_request]
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)
@@ -1,5 +1,5 @@
1
1
  module Revo
2
2
  module LoansApi
3
- VERSION = '0.0.7'
3
+ VERSION = '0.0.8'
4
4
  end
5
5
  end
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.7
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-09 00:00:00.000000000 Z
11
+ date: 2019-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http