instant_quote 1.7.31 → 1.7.33

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: 9427b9b3f5d933dd039f07f6ccccc6b6c0efeb746415c360b6454a31e2988268
4
- data.tar.gz: 637be19d103075d4acefaf072cb48933542a941c64be38fd424a1174a02d9e9b
3
+ metadata.gz: 961b0814c5895349859b111b9154e56582aade793a7e7623c68e53b142742b86
4
+ data.tar.gz: 7e88f40122d9bc7442618b3fc4aa3994f6b8f988887cfb240de853d47094bd95
5
5
  SHA512:
6
- metadata.gz: 0c8b0e02ef19ea18274d19b0e7c2ed5219d4b5ed89d798f23ab81b398faf6687119f2bd6625beb1e4d93d74ffc44ab6019afa331ed54eaa97046dcf5691bda74
7
- data.tar.gz: 4a7e5a37a70580e483fd89c71ae90c8cbd3490af2986a0657bf571164537c0560d588dfe6ff2d63f8857c8daf3d909251eae23f2acca6d849b5d638e617853af
6
+ metadata.gz: ccf3b9a9eb9d9e38c3c9ad2a9341432f683dd0dc6ca14e59b31b80b701563560c4796869f8202a84c45461798387419dbf90b1db943635ad6b513e417b6971f8
7
+ data.tar.gz: aaa6b9dcd4fc6dfebf247e443911af337f77a0cd0f1f713547fc2aa51840e73d6069f68b194b8504ae997598f26c7d9556dff0a665b72457f41d6723629b7947
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- instant_quote (1.7.31)
4
+ instant_quote (1.7.33)
5
5
  activesupport
6
6
  capital_on_tap (~> 1.0.1)
7
7
  iwoca (~> 1.1.0)
@@ -112,8 +112,9 @@ module InstantQuote
112
112
 
113
113
  if @data.key?(:offers)
114
114
  @offers = @data[:offers]
115
+
115
116
  # For some reason sometimes the offers are nested in another key called 'offers'
116
- @offers = @offers[:offers] if @offers.key?(:offers)
117
+ @offers = @offers[:offers] if @offers.is_a?(Hash) && @offers.key?(:offers)
117
118
  end
118
119
  end
119
120
 
@@ -164,10 +165,14 @@ module InstantQuote
164
165
  unit = suggested_product.dig(:duration, :unit)
165
166
  amount = suggested_product.dig(:duration, :amount)
166
167
 
168
+ return unless unit && amount
169
+
167
170
  { unit: unit, amount: amount }
168
171
  end
169
172
 
170
173
  def monthly_interest_rate
174
+ return 0 unless first_offer
175
+
171
176
  first_offer[:interest_rate]
172
177
  end
173
178
 
@@ -180,7 +185,7 @@ module InstantQuote
180
185
  private
181
186
 
182
187
  def suggested_product
183
- @status[:requests]&.first&.dig(:suggested_product)
188
+ @status[:requests]&.first&.dig(:suggested_product) || {}
184
189
  end
185
190
 
186
191
  def first_offer
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InstantQuote
4
- VERSION = '1.7.31'
4
+ VERSION = '1.7.33'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instant_quote
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.31
4
+ version: 1.7.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - rikas