instant_quote 1.1.2 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/Gemfile.lock +29 -18
- data/instant_quote.gemspec +1 -0
- data/lib/instant_quote/adapters/capital_on_tap.rb +12 -4
- data/lib/instant_quote/adapters/iwoca.rb +8 -3
- data/lib/instant_quote/api_error.rb +3 -1
- data/lib/instant_quote/connection_translators/capital_on_tap.rb +1 -1
- data/lib/instant_quote/decision_parsers/capital_on_tap.rb +1 -1
- data/lib/instant_quote/decision_parsers/iwoca.rb +1 -1
- data/lib/instant_quote/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 358724fb16cc0c89f578d0b59b1dc3b7f962af917986c46d8c77406cab783abf
|
4
|
+
data.tar.gz: 3cdff1f454bfdb1ac5637912ac0bf421671fcbadf33c98bc0d3533c4f981c054
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3bb568804077b6526a0c39debbb36c39da156bbb158dd6e5f4ca32d59797aad9ab140aba3ee37955021196a833754e35281db9d26bf757ac080da991a077526
|
7
|
+
data.tar.gz: 8301b9bd8ce4c50f502e86b0a62faca488a35150a7ad247af3b3148004552c04e70c3c6febf31895bdba94e0c96316e70cf4214be0dd4b68113c26d47b4ab463
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
instant_quote (1.1.
|
4
|
+
instant_quote (1.1.7)
|
5
5
|
activesupport
|
6
6
|
capital_on_tap
|
7
7
|
iwoca
|
@@ -11,7 +11,7 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activesupport (6.0.2.
|
14
|
+
activesupport (6.0.2.2)
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
16
|
i18n (>= 0.7, < 2)
|
17
17
|
minitest (~> 5.1)
|
@@ -29,13 +29,16 @@ GEM
|
|
29
29
|
rainbow
|
30
30
|
coderay (1.1.2)
|
31
31
|
concurrent-ruby (1.1.6)
|
32
|
+
crack (0.4.3)
|
33
|
+
safe_yaml (~> 1.0.0)
|
32
34
|
diff-lcs (1.3)
|
33
35
|
docile (1.3.2)
|
34
36
|
dotenv (2.7.5)
|
35
|
-
faraday (0.
|
37
|
+
faraday (1.0.1)
|
36
38
|
multipart-post (>= 1.2, < 3)
|
37
|
-
faraday_middleware (0.
|
38
|
-
faraday (
|
39
|
+
faraday_middleware (1.0.0)
|
40
|
+
faraday (~> 1.0)
|
41
|
+
hashdiff (1.0.1)
|
39
42
|
i18n (1.8.2)
|
40
43
|
concurrent-ruby (~> 1.0)
|
41
44
|
iwoca (1.0.0)
|
@@ -45,54 +48,61 @@ GEM
|
|
45
48
|
multi_json
|
46
49
|
rainbow
|
47
50
|
jaro_winkler (1.5.4)
|
48
|
-
method_source (0.
|
51
|
+
method_source (1.0.0)
|
49
52
|
minitest (5.14.0)
|
50
53
|
money (6.13.7)
|
51
54
|
i18n (>= 0.6.4, <= 2)
|
52
55
|
multi_json (1.14.1)
|
53
56
|
multipart-post (2.1.1)
|
54
57
|
parallel (1.19.1)
|
55
|
-
parser (2.7.0.
|
58
|
+
parser (2.7.0.5)
|
56
59
|
ast (~> 2.4.0)
|
57
60
|
phonelib (0.6.42)
|
58
|
-
pry (0.
|
59
|
-
coderay (~> 1.1
|
60
|
-
method_source (~>
|
61
|
-
pry-byebug (3.
|
61
|
+
pry (0.13.0)
|
62
|
+
coderay (~> 1.1)
|
63
|
+
method_source (~> 1.0)
|
64
|
+
pry-byebug (3.9.0)
|
62
65
|
byebug (~> 11.0)
|
63
|
-
pry (~> 0.
|
66
|
+
pry (~> 0.13.0)
|
64
67
|
public_suffix (4.0.3)
|
65
68
|
rainbow (3.0.0)
|
66
69
|
rake (10.5.0)
|
70
|
+
rexml (3.2.4)
|
67
71
|
rspec (3.9.0)
|
68
72
|
rspec-core (~> 3.9.0)
|
69
73
|
rspec-expectations (~> 3.9.0)
|
70
74
|
rspec-mocks (~> 3.9.0)
|
71
75
|
rspec-core (3.9.1)
|
72
76
|
rspec-support (~> 3.9.1)
|
73
|
-
rspec-expectations (3.9.
|
77
|
+
rspec-expectations (3.9.1)
|
74
78
|
diff-lcs (>= 1.2.0, < 2.0)
|
75
79
|
rspec-support (~> 3.9.0)
|
76
80
|
rspec-mocks (3.9.1)
|
77
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
78
82
|
rspec-support (~> 3.9.0)
|
79
83
|
rspec-support (3.9.2)
|
80
|
-
rubocop (0.
|
84
|
+
rubocop (0.80.1)
|
81
85
|
jaro_winkler (~> 1.5.1)
|
82
86
|
parallel (~> 1.10)
|
83
87
|
parser (>= 2.7.0.1)
|
84
88
|
rainbow (>= 2.2.2, < 4.0)
|
89
|
+
rexml
|
85
90
|
ruby-progressbar (~> 1.7)
|
86
91
|
unicode-display_width (>= 1.4.0, < 1.7)
|
87
92
|
ruby-progressbar (1.10.1)
|
88
|
-
|
93
|
+
safe_yaml (1.0.5)
|
94
|
+
simplecov (0.18.5)
|
89
95
|
docile (~> 1.1)
|
90
|
-
simplecov-html (~> 0.11
|
91
|
-
simplecov-html (0.
|
96
|
+
simplecov-html (~> 0.11)
|
97
|
+
simplecov-html (0.12.2)
|
92
98
|
thread_safe (0.3.6)
|
93
|
-
tzinfo (1.2.
|
99
|
+
tzinfo (1.2.7)
|
94
100
|
thread_safe (~> 0.1)
|
95
101
|
unicode-display_width (1.6.1)
|
102
|
+
webmock (3.8.3)
|
103
|
+
addressable (>= 2.3.6)
|
104
|
+
crack (>= 0.3.2)
|
105
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
96
106
|
zeitwerk (2.3.0)
|
97
107
|
|
98
108
|
PLATFORMS
|
@@ -107,6 +117,7 @@ DEPENDENCIES
|
|
107
117
|
rspec (~> 3.0)
|
108
118
|
rubocop
|
109
119
|
simplecov
|
120
|
+
webmock
|
110
121
|
|
111
122
|
BUNDLED WITH
|
112
123
|
2.0.2
|
data/instant_quote.gemspec
CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
34
|
spec.add_development_dependency 'rubocop'
|
35
35
|
spec.add_development_dependency 'simplecov'
|
36
|
+
spec.add_development_dependency 'webmock'
|
36
37
|
|
37
38
|
spec.add_dependency 'activesupport'
|
38
39
|
spec.add_dependency 'capital_on_tap'
|
@@ -50,9 +50,7 @@ module InstantQuote
|
|
50
50
|
response = ::CapitalOnTap::Application.create(params)
|
51
51
|
|
52
52
|
# CoT responses can be 200 OK but still have an error!
|
53
|
-
unless response.success? && !response.error
|
54
|
-
raise ApiError.new(data: response.body, error: response.error || 'Unknown API error')
|
55
|
-
end
|
53
|
+
raise_error(response) unless response.success? && !response.error
|
56
54
|
|
57
55
|
response.body.dig(:result)
|
58
56
|
end
|
@@ -75,7 +73,7 @@ module InstantQuote
|
|
75
73
|
def get_status(application_id)
|
76
74
|
response = ::CapitalOnTap::Application.status(application_id)
|
77
75
|
|
78
|
-
|
76
|
+
raise_error(response) unless response.success?
|
79
77
|
|
80
78
|
DecisionParsers::CapitalOnTap.new(response.body[:applicationStatus])
|
81
79
|
end
|
@@ -89,6 +87,16 @@ module InstantQuote
|
|
89
87
|
def get_approval(_application_id)
|
90
88
|
true
|
91
89
|
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def raise_error(response)
|
94
|
+
raise ApiError.new(
|
95
|
+
adapter: 'capital_on_tap',
|
96
|
+
data: response.body,
|
97
|
+
error: response.error || 'Unknown API error'
|
98
|
+
)
|
99
|
+
end
|
92
100
|
end
|
93
101
|
end
|
94
102
|
end
|
@@ -75,9 +75,9 @@ module InstantQuote
|
|
75
75
|
def get_status(state_key)
|
76
76
|
response = ::Iwoca::Quote.credit_facility_status(state_key)
|
77
77
|
|
78
|
-
|
78
|
+
raise_error(response) unless response.success?
|
79
79
|
|
80
|
-
|
80
|
+
DecisionParsers::Iwoca.new(response.body)
|
81
81
|
end
|
82
82
|
|
83
83
|
# Gets the URL for the given state key.
|
@@ -97,7 +97,12 @@ module InstantQuote
|
|
97
97
|
private
|
98
98
|
|
99
99
|
def raise_error(response)
|
100
|
-
raise ApiError.new(
|
100
|
+
raise ApiError.new(
|
101
|
+
adapter: 'iwoca',
|
102
|
+
data: response.data,
|
103
|
+
code: response.errors.first[:code],
|
104
|
+
error: response.errors.first[:detail]
|
105
|
+
)
|
101
106
|
end
|
102
107
|
end
|
103
108
|
end
|
@@ -2,14 +2,16 @@
|
|
2
2
|
|
3
3
|
module InstantQuote
|
4
4
|
class ApiError < StandardError
|
5
|
-
attr_accessor :error, :data
|
5
|
+
attr_accessor :error, :data, :code, :adapter
|
6
6
|
|
7
7
|
alias message error
|
8
8
|
alias to_s error
|
9
9
|
|
10
10
|
def initialize(params = {})
|
11
|
+
@adapter = params[:adapter]
|
11
12
|
@error = params[:error]
|
12
13
|
@data = params[:data] || {}
|
14
|
+
@code = params[:code]
|
13
15
|
|
14
16
|
# Delete the metaData key, because it's irrelevant and has long strings
|
15
17
|
@data.delete(:metaData) if @data.key?(:metaData)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instant_quote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rikas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03
|
11
|
+
date: 2020-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: activesupport
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|