instant_quote 1.1.3 → 1.1.8
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/.rubocop.yml +9 -0
- data/.ruby-version +1 -1
- data/Gemfile.lock +37 -26
- data/instant_quote.gemspec +1 -0
- data/lib/instant_quote/adapter_finder.rb +11 -8
- data/lib/instant_quote/adapters/capital_on_tap.rb +12 -4
- data/lib/instant_quote/adapters/iwoca.rb +12 -3
- data/lib/instant_quote/adapters/iwoca_cbils.rb +19 -0
- 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/connection_translators/iwoca.rb +5 -1
- data/lib/instant_quote/connection_translators/iwoca_cbils.rb +15 -0
- data/lib/instant_quote/decision_parsers/iwoca.rb +1 -1
- data/lib/instant_quote/decision_parsers/iwoca_cbils.rb +10 -0
- data/lib/instant_quote/version.rb +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2c7f021aa42714cc517f85e9828e2c34a20ba4044c4f024570338117218e68c3
|
|
4
|
+
data.tar.gz: ba11fe1ed79bd940c613587f85481583885dd8311dd021a5cb83e3c7d9178281
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78426747755312c4618ebc70b42b51f19435b04bbc26d2385881b82a3b9113d26d6fa13af7ad97dcdb83540a20bc0a6113d854a469c501029edbd34a5c4d9c33
|
|
7
|
+
data.tar.gz: 76448f87df25db208b0d5c25d7e68df33f0c6c78ff7fcf58fa5cd041b50d21ae378ba5b328023155c5c95609412d4bfec98b352be79576f735f393b101626b20
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.6.
|
|
1
|
+
2.6.6
|
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.8)
|
|
5
5
|
activesupport
|
|
6
6
|
capital_on_tap
|
|
7
7
|
iwoca
|
|
@@ -11,12 +11,12 @@ PATH
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
activesupport (6.0.
|
|
14
|
+
activesupport (6.0.3.2)
|
|
15
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
16
16
|
i18n (>= 0.7, < 2)
|
|
17
17
|
minitest (~> 5.1)
|
|
18
18
|
tzinfo (~> 1.1)
|
|
19
|
-
zeitwerk (~> 2.2)
|
|
19
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
|
20
20
|
addressable (2.7.0)
|
|
21
21
|
public_suffix (>= 2.0.2, < 5.0)
|
|
22
22
|
ast (2.4.0)
|
|
@@ -29,14 +29,17 @@ 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
|
-
|
|
39
|
+
faraday_middleware (1.0.0)
|
|
40
|
+
faraday (~> 1.0)
|
|
41
|
+
hashdiff (1.0.1)
|
|
42
|
+
i18n (1.8.5)
|
|
40
43
|
concurrent-ruby (~> 1.0)
|
|
41
44
|
iwoca (1.0.0)
|
|
42
45
|
addressable
|
|
@@ -45,55 +48,62 @@ GEM
|
|
|
45
48
|
multi_json
|
|
46
49
|
rainbow
|
|
47
50
|
jaro_winkler (1.5.4)
|
|
48
|
-
method_source (0.
|
|
49
|
-
minitest (5.14.
|
|
50
|
-
money (6.13.
|
|
51
|
+
method_source (1.0.0)
|
|
52
|
+
minitest (5.14.1)
|
|
53
|
+
money (6.13.8)
|
|
51
54
|
i18n (>= 0.6.4, <= 2)
|
|
52
|
-
multi_json (1.
|
|
55
|
+
multi_json (1.15.0)
|
|
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
|
-
phonelib (0.6.
|
|
58
|
-
pry (0.
|
|
59
|
-
coderay (~> 1.1
|
|
60
|
-
method_source (~>
|
|
61
|
-
pry-byebug (3.
|
|
60
|
+
phonelib (0.6.44)
|
|
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)
|
|
96
|
-
|
|
102
|
+
webmock (3.8.3)
|
|
103
|
+
addressable (>= 2.3.6)
|
|
104
|
+
crack (>= 0.3.2)
|
|
105
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
|
106
|
+
zeitwerk (2.4.0)
|
|
97
107
|
|
|
98
108
|
PLATFORMS
|
|
99
109
|
ruby
|
|
@@ -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
|
-
2.
|
|
123
|
+
2.1.4
|
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'
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Require all the connection translators
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
Dir.glob('*.rb', base: File.expand_path('connection_translators', __dir__)) do |translator|
|
|
5
|
+
require "instant_quote/connection_translators/#{translator}"
|
|
6
|
+
end
|
|
6
7
|
|
|
7
8
|
# Require all the decision parsers
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
Dir.glob('*.rb', base: File.expand_path('decision_parsers', __dir__)) do |parser|
|
|
10
|
+
require "instant_quote/decision_parsers/#{parser}"
|
|
11
|
+
end
|
|
10
12
|
|
|
11
13
|
# Require all the adapters
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
Dir.glob('*.rb', base: File.expand_path('adapters', __dir__)) do |adapter|
|
|
15
|
+
require "instant_quote/adapters/#{adapter}"
|
|
16
|
+
end
|
|
14
17
|
|
|
15
18
|
module InstantQuote
|
|
16
19
|
class AdapterFinder
|
|
@@ -28,8 +31,8 @@ module InstantQuote
|
|
|
28
31
|
end
|
|
29
32
|
|
|
30
33
|
def self.available_adapters
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
Dir.glob('*.rb', base: File.expand_path('adapters', __dir__))
|
|
35
|
+
.map { |adapter| adapter.sub('.rb', '') }
|
|
33
36
|
end
|
|
34
37
|
|
|
35
38
|
def get_link
|
|
@@ -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
|
+
decision_parser.new(response.body)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
# Gets the URL for the given state key.
|
|
@@ -96,8 +96,17 @@ module InstantQuote
|
|
|
96
96
|
|
|
97
97
|
private
|
|
98
98
|
|
|
99
|
+
def decision_parser
|
|
100
|
+
DecisionParsers::Iwoca
|
|
101
|
+
end
|
|
102
|
+
|
|
99
103
|
def raise_error(response)
|
|
100
|
-
raise ApiError.new(
|
|
104
|
+
raise ApiError.new(
|
|
105
|
+
adapter: 'iwoca',
|
|
106
|
+
data: response.data,
|
|
107
|
+
code: response.errors.first[:code],
|
|
108
|
+
error: response.errors.first[:detail]
|
|
109
|
+
)
|
|
101
110
|
end
|
|
102
111
|
end
|
|
103
112
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'iwoca'
|
|
4
|
+
require 'instant_quote/adapters/iwoca'
|
|
5
|
+
require 'instant_quote/decision_parsers/iwoca_cbils'
|
|
6
|
+
|
|
7
|
+
module InstantQuote
|
|
8
|
+
module Adapters
|
|
9
|
+
class IwocaCbils < Iwoca
|
|
10
|
+
additional_fields Iwoca.additional_fields
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def decision_parser
|
|
15
|
+
DecisionParsers::IwocaCbils
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
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)
|
|
@@ -10,7 +10,7 @@ module InstantQuote
|
|
|
10
10
|
company: company_information,
|
|
11
11
|
people: [person_information],
|
|
12
12
|
requested_products: {
|
|
13
|
-
|
|
13
|
+
product_name => {
|
|
14
14
|
approval: {
|
|
15
15
|
amount: (application.amount_pennies / 100),
|
|
16
16
|
duration: 12,
|
|
@@ -25,6 +25,10 @@ module InstantQuote
|
|
|
25
25
|
|
|
26
26
|
private
|
|
27
27
|
|
|
28
|
+
def product_name
|
|
29
|
+
:credit_facility
|
|
30
|
+
end
|
|
31
|
+
|
|
28
32
|
# rubocop:disable Metrics/AbcSize
|
|
29
33
|
def company_information
|
|
30
34
|
information = {
|
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.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- rikas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-08-07 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
|
|
@@ -202,13 +216,16 @@ files:
|
|
|
202
216
|
- lib/instant_quote/adapter_finder.rb
|
|
203
217
|
- lib/instant_quote/adapters/capital_on_tap.rb
|
|
204
218
|
- lib/instant_quote/adapters/iwoca.rb
|
|
219
|
+
- lib/instant_quote/adapters/iwoca_cbils.rb
|
|
205
220
|
- lib/instant_quote/api_error.rb
|
|
206
221
|
- lib/instant_quote/connection_translator.rb
|
|
207
222
|
- lib/instant_quote/connection_translators/capital_on_tap.rb
|
|
208
223
|
- lib/instant_quote/connection_translators/iwoca.rb
|
|
224
|
+
- lib/instant_quote/connection_translators/iwoca_cbils.rb
|
|
209
225
|
- lib/instant_quote/decision_parser.rb
|
|
210
226
|
- lib/instant_quote/decision_parsers/capital_on_tap.rb
|
|
211
227
|
- lib/instant_quote/decision_parsers/iwoca.rb
|
|
228
|
+
- lib/instant_quote/decision_parsers/iwoca_cbils.rb
|
|
212
229
|
- lib/instant_quote/version.rb
|
|
213
230
|
- lib/instant_quote/webhooks/iwoca.rb
|
|
214
231
|
homepage: https://finpoint.co.uk
|