sealine_insurance 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: 7f8468bc392fa0743e78395915c6b0ab388a2d5a
4
- data.tar.gz: 9c6afc24aa9c26095db97d6c387ace3fa6dc0496
3
+ metadata.gz: 4b4d5ea8dad442272118a4d2feec5961272eb9a4
4
+ data.tar.gz: 022f972433736ffda4f5dd9964977dbc066f3263
5
5
  SHA512:
6
- metadata.gz: 7be3dc35208e4735d776f42bad333c690457b9f48f29c8971f51c322b2c3d8108fa8efc420892ea1a57795e2510d1a89c8273ac768eab5bda2659f2a797c8cf8
7
- data.tar.gz: 25ff3d2d6851fff4ce932423ea168591204169c3e872603422b4ed09d75b24d62d86d710f72f05e4e68c0eb0cc7e9e0ba951fbc128762df02556e402feb77a3e
6
+ metadata.gz: 29208d8432593e45da8f88bbf03479416b1a44b488663ea7deee01f43dff71daef64285790ce09f03923a99184e8c950e16b9d9c45b968400176f3c1ab96a98c
7
+ data.tar.gz: 3e5bd19fe9574f9dc06918ca75cb8ca90e0d4070b93313724d523621488da7e761dea5eab4e0727cbb8647331ab05ae4183c6e0b2944cb94a636339e8b679644
@@ -72,6 +72,10 @@ module SealineInsurance
72
72
  "#{key_path.join('.')}: #{data}"
73
73
  end
74
74
  end
75
+
76
+ def to_money(raw_value)
77
+ Money.from_amount(raw_value.to_f, DEFAULT_CURRENCY) if raw_value
78
+ end
75
79
  end
76
80
  end
77
81
  end
@@ -19,10 +19,17 @@ module SealineInsurance
19
19
  end
20
20
 
21
21
  def price
22
- result = body['results']&.detect { |item| item['status'] == 'DONE' }
23
- if result && result['price']
24
- Money.from_amount(result['price'].to_f, DEFAULT_CURRENCY)
25
- end
22
+ to_money(result['price'])
23
+ end
24
+
25
+ def coverage
26
+ to_money(result.dig('result_data', 'coverage'))
27
+ end
28
+
29
+ private
30
+
31
+ def result
32
+ @result ||= body['results']&.detect { |item| item['status'] == 'DONE' } || {}
26
33
  end
27
34
  end
28
35
  end
@@ -28,7 +28,7 @@ module SealineInsurance
28
28
  end
29
29
 
30
30
  def price
31
- Money.from_amount(body['price'].to_f, DEFAULT_CURRENCY) if body['price']
31
+ to_money(body['price'])
32
32
  end
33
33
 
34
34
  def documents
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SealineInsurance
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sealine_insurance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Khrebtov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-01 00:00:00.000000000 Z
11
+ date: 2018-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday