root_insurance 1.6.1 → 1.7.0

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
  SHA1:
3
- metadata.gz: 4a4814a310a065153f7c37a1ee141282b71c6550
4
- data.tar.gz: e96421a409103a0b56840380f1c6ec52b13f5648
3
+ metadata.gz: 62a647203615d6e8ffd22c1654677fb4755b45af
4
+ data.tar.gz: 7d3f11e7b5d273f9cad9622dd7622820be04661e
5
5
  SHA512:
6
- metadata.gz: 749f9aad7776cf5758d1fefa17da166cef9239ad025ef58f2bfc513386671f1b1692ee03880cc2aea555d949de73278da2ab66a3e398e273c7e3bdcf415ea547
7
- data.tar.gz: e640916120d7745025874e8cb317cd15799fc6d8e6aef0d127564210d446849d47267dcd72cd19e0a13e6d81b142e28494d3c08a113a4b835803d6cb5b787222
6
+ metadata.gz: ef10763848eceb0d098fd20c2152854261f03007a5e733ed57048c503844f08412977bbfa0e964189e6bd272d5f7ecf8fe54ac09d253742c2ae8f8d77ea86b17
7
+ data.tar.gz: 3d4cc78024c42e96757002ec26c05cad8454f7c2101b068272d7c5d2422946eab2247293f607bf38076497f78c1f4291666461b11e29d92a76ee4e346fea34e2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ # 1.7.0 - Release date: 2018-16-05
4
+ * Added missing support for funeral and term modules when creating application
5
+
6
+
3
7
  # 1.6.1 - Release date: 2018-16-05
4
8
  * Fixed variable in payment method spec
5
9
  * Add initial documentation to test rdoc and yard
@@ -1,13 +1,36 @@
1
1
  module RootInsurance::Api
2
2
  module Application
3
- def create_application(policyholder_id:, quote_package_id:, monthly_premium:, serial_number: nil)
3
+
4
+ # Create an application
5
+ #
6
+ # @param [String] policyholder_id The policy holder id
7
+ # @param [String] quote_package_id The quote package id
8
+ # @param [Integer] monthly_premium The monthly premium (in cents)
9
+ # @param [String] serial_number The device to insure's serial number. (for the gadgets module)
10
+ # @param [String] spouse_id SA ID number of the policyholder's spouse. Required if has_spouse is true on the quote.
11
+ # @param [Array<String>] children_ids SA ID numbers of the policyholder's children. Required if number_of_children is greater than 0 on the quote. All children must be younger than 21.
12
+ # @param [Array<String>] SA ID number of the policyholder's extended family members. Required if the length of +extended_family_ages+ is greater than 0 on the quote. The ages inferred from the ID numbers must match the ages given in the quote step.
13
+ # @return [Hash]
14
+ def create_application(policyholder_id:, quote_package_id:, monthly_premium:,
15
+ serial_number: nil, spouse_id: nil, children_ids: nil, extended_famliy_ids: nil)
4
16
  data = {
5
17
  policyholder_id: policyholder_id,
6
18
  quote_package_id: quote_package_id,
7
- monthly_premium: monthly_premium,
8
- serial_number: serial_number
19
+ monthly_premium: monthly_premium
9
20
  }
10
21
 
22
+ module_data = if serial_number
23
+ {serial_number: serial_number}
24
+ elsif spouse_id || children_ids || extended_famliy_ids
25
+ {
26
+ spouse_id: spouse_id,
27
+ children_ids: children_ids,
28
+ extended_famliy_ids: extended_famliy_ids
29
+ }.reject { |key, value| value.nil? }
30
+ end
31
+
32
+ data = module_data ? data.merge(module_data) : data
33
+
11
34
  post(:applications, data)
12
35
  end
13
36
  end
@@ -21,7 +21,7 @@ class RootInsurance::Client
21
21
  #
22
22
  # @param [String] app_id The app's id
23
23
  # @param [String] app_secret The app's secret. Currently it's a blank string
24
- # @param [Symbol] env The environment to use. Either `:production` or `:sandbox`. The default is `:sandbox`
24
+ # @param [Symbol] env The environment to use. Either +:production+ or +:sandbox+. The default is +:sandbox+
25
25
  def initialize(app_id, app_secret, env=nil)
26
26
  @app_id = app_id
27
27
  @app_secret = app_secret
@@ -1,3 +1,3 @@
1
1
  module RootInsurance
2
- VERSION = "1.6.1"
2
+ VERSION = "1.7.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: root_insurance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Root Wealth