instant_quote 1.6.1 → 1.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c46963e390b87e65c4e598adb90a56dcbc9c8d4e9757816b0734af085cd098f6
4
- data.tar.gz: abfa20a481247b1ddc9aa3abbda4de1c858bbf3d50584ef9fe7ac904c1f6a948
3
+ metadata.gz: c8a949bc8d63fd2ad95636f7a72ff7e8a9f801927eea13634681a20321abf0e5
4
+ data.tar.gz: 25822b27eabbe49c12a40dfd97b614c6d80d17c69ee83f48e0f20149264d4be8
5
5
  SHA512:
6
- metadata.gz: 3e42e95e2474ad1e4b04838ace2371e409ce811b4c129fe7cc65375536febd85816338b4b943f5c3133ad19d3643817d4a466fe636c843a1fb36e6542c2c63b5
7
- data.tar.gz: 26257fb6401faf86be51b53dc7c0ebacd787f8ebb187cdf330e646318cea2a113dd7131871eac972f28272b9f363dfeb209a6f2f3a330a080c526ac36c1c0c38
6
+ metadata.gz: c42945fc752a43165f1c010974b1489095be672cacf42580d0ce7693e7fd27d147060d376e343f40ddc6399771e84824edf206fef853dba168433053a21611a4
7
+ data.tar.gz: cb94c2781c903afe2ae45e61dd1180ffa739752a2c604f42c01dd81fe6bb111b3ccd43168f21e0968c8b0f803c6f078ade80fffa524d1aaed2365dfd6fcb3095
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- instant_quote (1.6.1)
4
+ instant_quote (1.6.2)
5
5
  activesupport
6
6
  capital_on_tap
7
7
  iwoca
@@ -25,16 +25,34 @@ module InstantQuote
25
25
  status_hash[:loanOptions].empty?
26
26
  end
27
27
 
28
- def amount
29
- option = status_hash[:loanOptions].first
28
+ def sweep
29
+ first_option[:fee]
30
+ end
30
31
 
31
- amount_approved = option[:fundedAmount].to_f + option[:fee].to_f
32
+ def fee
33
+ fee = first_option[:fee].to_f
32
34
 
33
- Money.new(amount_approved * 100).format
35
+ Money.new(fee * 100).format
36
+ end
37
+
38
+ def loan_amount
39
+ amount = first_option[:loanAmount].to_f
40
+
41
+ Money.new(amount * 100).format
42
+ end
43
+
44
+ def funded_amount
45
+ amount = first_option[:fundedAmount].to_f
46
+
47
+ Money.new(amount * 100).format
34
48
  end
35
49
 
36
50
  private
37
51
 
52
+ def first_option
53
+ @first_option ||= status_hash[:loanOptions].find { |opt| opt[:fundedAmount].positive? }
54
+ end
55
+
38
56
  def status_hash
39
57
  data.presence || { loanOptions: [] }
40
58
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InstantQuote
4
- VERSION = '1.6.1'
4
+ VERSION = '1.6.2'
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.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rikas