root_insurance 1.9.0 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,131 +1,133 @@
1
- module RootInsurance::Api
2
- module Policyholder
3
- # Create a policy holder
4
- #
5
- # @param [Hash] id Hash containing policyholder's identification number, type and country. See below for details.
6
- # @param [String] first_name Policyholder's legal first name.
7
- # @param [String] last_name Policyholder's legal last name.
8
- # @param [String] email Policyholder's contact email address. (Optional)
9
- # @param [String] date_of_birth The policyholder's date of birth in the format YYYYMMDD. This field may be omitted if the policyholder's id type is +id+.
10
- # @param [Hash] cellphone Hash containing policyholder's cellphone number and country. See below for details. (Optional)
11
- # @param [Hash] app_data A hash containing additional custom data for the policy holder.
12
- # @return [Hash]
13
- #
14
- ## == ID
15
- # [type (string or symbol)] Either +:id+ or +:passport+
16
- # [number (string)] The id or passport number
17
- # [country (string)] The ISO Alpha-2 country code of the country of the id/passport number.
18
- #
19
- ## == Cellphone
20
- # [number (string)] The cellphone number
21
- # [country (string)] The ISO Alpha-2 country code of the country of the cellphone number.
22
- #
23
- # @example
24
- # client.create_policy_holder(
25
- # id: {type: :id, number: "6801015800084", country: "ZA"},
26
- # first_name: 'Erlich',
27
- # last_name: 'Bachman',
28
- # email: 'erlich@avaito.com',
29
- # app_data: {company: 'Aviato'})
30
- #
31
- def create_policyholder(id:, first_name:, last_name:, email: nil, date_of_birth: nil, cellphone: nil, app_data: nil)
32
- raise ArgumentError.new('id needs to be a hash') unless id.is_a? Hash
1
+ module RootInsurance
2
+ module Api
3
+ module Policyholder
4
+ # Create a policy holder
5
+ #
6
+ # @param [Hash] id Hash containing policyholder's identification number, type and country. See below for details.
7
+ # @param [String] first_name Policyholder's legal first name.
8
+ # @param [String] last_name Policyholder's legal last name.
9
+ # @param [String] email Policyholder's contact email address. (Optional)
10
+ # @param [String] date_of_birth The policyholder's date of birth in the format YYYYMMDD. This field may be omitted if the policyholder's id type is +id+.
11
+ # @param [Hash] cellphone Hash containing policyholder's cellphone number and country. See below for details. (Optional)
12
+ # @param [Hash] app_data A hash containing additional custom data for the policy holder.
13
+ # @return [Hash]
14
+ #
15
+ ## == ID
16
+ # [type (string or symbol)] Either +:id+ or +:passport+
17
+ # [number (string)] The id or passport number
18
+ # [country (string)] The ISO Alpha-2 country code of the country of the id/passport number.
19
+ #
20
+ ## == Cellphone
21
+ # [number (string)] The cellphone number
22
+ # [country (string)] The ISO Alpha-2 country code of the country of the cellphone number.
23
+ #
24
+ # @example
25
+ # client.create_policy_holder(
26
+ # id: {type: :id, number: "6801015800084", country: "ZA"},
27
+ # first_name: 'Erlich',
28
+ # last_name: 'Bachman',
29
+ # email: 'erlich@avaito.com',
30
+ # app_data: {company: 'Aviato'})
31
+ #
32
+ def create_policyholder(id:, first_name:, last_name:, email: nil, date_of_birth: nil, cellphone: nil, app_data: nil)
33
+ raise ArgumentError.new('id needs to be a hash') unless id.is_a? Hash
33
34
 
34
- data = {
35
- id: id,
36
- first_name: first_name,
37
- last_name: last_name,
38
- date_of_birth: date_of_birth,
39
- email: email,
40
- cellphone: cellphone,
41
- app_data: app_data
42
- }.reject { |key, value| value.nil? }
35
+ data = {
36
+ id: id,
37
+ first_name: first_name,
38
+ last_name: last_name,
39
+ date_of_birth: date_of_birth,
40
+ email: email,
41
+ cellphone: cellphone,
42
+ app_data: app_data
43
+ }.reject { |key, value| value.nil? }
43
44
 
44
- post(:policyholders, data)
45
- end
45
+ post(:policyholders, data)
46
+ end
46
47
 
47
- # List policy holders
48
- #
49
- # @param [Hash] id_number An optional ID or passport number to filter by.
50
- # @param [Array<String, Symbol>, String, Symbol] included_objects An optional list, or single item, of underlying objects to include, e.g. +?include=policies+. Currently, only +policies+ is supported, which will include all policies owned by the policyholder.
51
- # @return [Array<Hash>]
52
- #
53
- # @example
54
- # client.list_policyholders(id_number: "128ba0c0-3f6a-4f8b-9b40-e2066b02b59e", included_objects: :policies)
55
- def list_policyholders(id_number: nil, included_objects: nil)
56
- query = {
57
- include: format_included_objects(included_objects),
58
- id_number: id_number
59
- }.reject { |_, v| v.nil? }
48
+ # List policy holders
49
+ #
50
+ # @param [Hash] id_number An optional ID or passport number to filter by.
51
+ # @param [Array<String, Symbol>, String, Symbol] included_objects An optional list, or single item, of underlying objects to include, e.g. +?include=policies+. Currently, only +policies+ is supported, which will include all policies owned by the policyholder.
52
+ # @return [Array<Hash>]
53
+ #
54
+ # @example
55
+ # client.list_policyholders(id_number: "128ba0c0-3f6a-4f8b-9b40-e2066b02b59e", included_objects: :policies)
56
+ def list_policyholders(id_number: nil, included_objects: nil)
57
+ query = {
58
+ include: format_included_objects(included_objects),
59
+ id_number: id_number
60
+ }.reject { |_, v| v.nil? }
60
61
 
61
- get(:policyholders, query)
62
- end
62
+ get(:policyholders, query)
63
+ end
63
64
 
64
- # Get a policy holder
65
- #
66
- # @param [String] id The unique identifier of the policy holder
67
- # @param [Array<String, Symbol>, String, Symbol] included_objects An optional list, or single item, of underlying objects to include, e.g. +?include=policies+. Currently, only +policies+ is supported, which will include all policies owned by the policyholder.
68
- # @return [Hash]
69
- #
70
- # @example
71
- # client.get_policyholder(id: "128ba0c0-3f6a-4f8b-9b40-e2066b02b59e", included_objects: :policies)
72
- #
73
- def get_policyholder(id:, included_objects: nil)
74
- query = {
75
- include: format_included_objects(included_objects),
76
- }.reject { |_, v| v.nil? }
65
+ # Get a policy holder
66
+ #
67
+ # @param [String] id The unique identifier of the policy holder
68
+ # @param [Array<String, Symbol>, String, Symbol] included_objects An optional list, or single item, of underlying objects to include, e.g. +?include=policies+. Currently, only +policies+ is supported, which will include all policies owned by the policyholder.
69
+ # @return [Hash]
70
+ #
71
+ # @example
72
+ # client.get_policyholder(id: "128ba0c0-3f6a-4f8b-9b40-e2066b02b59e", included_objects: :policies)
73
+ #
74
+ def get_policyholder(id:, included_objects: nil)
75
+ query = {
76
+ include: format_included_objects(included_objects),
77
+ }.reject { |_, v| v.nil? }
77
78
 
78
- get("policyholders/#{id}", query)
79
- end
79
+ get("policyholders/#{id}", query)
80
+ end
80
81
 
81
- # Update a policy holder
82
- #
83
- # @param [String] id The unique identifier of the policy holder
84
- # @param [String] email Policyholder's contact email address. (Optional)
85
- # @param [Hash] cellphone Hash containing policyholder's cellphone number and country. See below for details. (Optional)
86
- # @param [Hash] app_data A hash containing additional custom data for the policy holder.
87
- # @return [Hash]
88
- #
89
- ## == Cellphone
90
- # [number (string)] The cellphone number
91
- # [country (string)] The ISO Alpha-2 country code of the country of the cellphone number.
92
- #
93
- # @example
94
- # client.update_policyholders(
95
- # id: 'bf1ada91-eecb-4f47-9bfa-1258bb1e0055',
96
- # cellphone: {number: '07741011337', country: 'ZA'},
97
- # app_data: {company: 'Pied Piper'})
98
- #
99
- def update_policyholder(id:, email: nil, cellphone: nil, app_data: nil)
100
- data = {
101
- email: email,
102
- cellphone: cellphone,
103
- app_data: app_data
104
- }.reject { |key, value| value.nil? }
82
+ # Update a policy holder
83
+ #
84
+ # @param [String] id The unique identifier of the policy holder
85
+ # @param [String] email Policyholder's contact email address. (Optional)
86
+ # @param [Hash] cellphone Hash containing policyholder's cellphone number and country. See below for details. (Optional)
87
+ # @param [Hash] app_data A hash containing additional custom data for the policy holder.
88
+ # @return [Hash]
89
+ #
90
+ ## == Cellphone
91
+ # [number (string)] The cellphone number
92
+ # [country (string)] The ISO Alpha-2 country code of the country of the cellphone number.
93
+ #
94
+ # @example
95
+ # client.update_policyholders(
96
+ # id: 'bf1ada91-eecb-4f47-9bfa-1258bb1e0055',
97
+ # cellphone: {number: '07741011337', country: 'ZA'},
98
+ # app_data: {company: 'Pied Piper'})
99
+ #
100
+ def update_policyholder(id:, email: nil, cellphone: nil, app_data: nil)
101
+ data = {
102
+ email: email,
103
+ cellphone: cellphone,
104
+ app_data: app_data
105
+ }.reject { |key, value| value.nil? }
105
106
 
106
- patch("policyholders/#{id}", data)
107
- end
107
+ patch("policyholders/#{id}", data)
108
+ end
108
109
 
109
- # List all the events which are applicable to this policy holder.
110
- #
111
- # @param [String] id The unique identifier of the policy holder
112
- # @return [Array<Hash>]
113
- #
114
- # @example
115
- # client.list_policyholder_events(id: "128ba0c0-3f6a-4f8b-9b40-e2066b02b59e")
116
- #
117
- def list_policyholder_events(id:)
118
- get("policyholders/#{id}/events")
119
- end
110
+ # List all the events which are applicable to this policy holder.
111
+ #
112
+ # @param [String] id The unique identifier of the policy holder
113
+ # @return [Array<Hash>]
114
+ #
115
+ # @example
116
+ # client.list_policyholder_events(id: "128ba0c0-3f6a-4f8b-9b40-e2066b02b59e")
117
+ #
118
+ def list_policyholder_events(id:)
119
+ get("policyholders/#{id}/events")
120
+ end
120
121
 
121
- private
122
- def format_included_objects(included_objects)
123
- case included_objects
124
- when String, Symbol
125
- included_objects
126
- when Array
127
- included_objects.join(",")
122
+ private
123
+ def format_included_objects(included_objects)
124
+ case included_objects
125
+ when String, Symbol
126
+ included_objects
127
+ when Array
128
+ included_objects.join(",")
129
+ end
128
130
  end
129
131
  end
130
132
  end
131
- end
133
+ end
@@ -1,94 +1,95 @@
1
- module RootInsurance::Api
2
- module Quote
3
- # Create a quote
4
- #
5
- # @param [Hash] opts The quote details. Depending on +:type+, different options are available. Available types are: +:root_gadgets+, +:root_term+ and +:root_funeral+ See below for details
6
- # @return [Hash]
7
- #
8
- ## == +:root_gadgets+
9
- # [model_name (String)] The model name of the gadget
10
- #
11
- ## == +:root_term+
12
- # [cover_amount (Integer)] Amount to cover, in cents. Should be between R100 000 and R5 000 000, inclusive.
13
- # [cover_period (String or Symbol)] Duration to cover: +:1_year+, +:2_years+, +:5_years+, +:10_years+, +:15_years+, +:20_years+ or +:whole_life+.
14
- # [basic_income_per_month (Integer)] Policyholder's basic monthly income, in cents.
15
- # [education_status (String or Symbol)] Policyholders education class: +:grade_12_no_matric+, +:grade_12_matric+, +:diploma_or_btech+, +:undergraduate_degree+ or +:professional_degree+
16
- # [smoker (Boolean)] Is the policyholder a smoker.
17
- # [gender (String or Symbol)] Gender of policyholder. Should be either +:male+ or +:female+.
18
- # [age (Integer)] Age of policyholder. Should be between 18 and 63, inclusive.
19
- #
20
- # == +:root_funeral+
21
- # [cover_amount (Integer)] Amount to cover, in cents. Should be between R10k and R50k, inclusive.
22
- # [has_spouse (Boolean)] Should a spouse also be covered.
23
- # [number_of_children (Integer)] Number of children to include in the policy. Should be between 0 and 8, inclusive
24
- # [extended_family_ages (Array<Integer>)] Ages of extended family members to cover.
25
- #
26
- # @example
27
- # client.create_quote(
28
- # type: :root_gadgets,
29
- # model_name: 'iPhone 6s 64GB LTE')
30
- #
31
- def create_quote(opts={})
32
- type = opts[:type]
33
-
34
- case type.to_sym
35
- when :root_gadgets
36
- create_gadget_quote(opts)
37
- when :root_term
38
- create_term_quote(opts)
39
- when :root_funeral
40
- create_funeral_quote(opts)
41
- else
42
- raise ArgumentError("Unknown quote type: #{type}")
1
+ module RootInsurance
2
+ module Api
3
+ module Quote
4
+ # Create a quote
5
+ #
6
+ # @param [Hash] opts The quote details. Depending on +:type+, different options are available. Available types are: +:root_gadgets+, +:root_term+ and +:root_funeral+ See below for details
7
+ # @return [Hash]
8
+ #
9
+ ## == +:root_gadgets+
10
+ # [model_name (String)] The model name of the gadget
11
+ #
12
+ ## == +:root_term+
13
+ # [cover_amount (Integer)] Amount to cover, in cents. Should be between R100 000 and R5 000 000, inclusive.
14
+ # [cover_period (String or Symbol)] Duration to cover: +:1_year+, +:2_years+, +:5_years+, +:10_years+, +:15_years+, +:20_years+ or +:whole_life+.
15
+ # [basic_income_per_month (Integer)] Policyholder's basic monthly income, in cents.
16
+ # [education_status (String or Symbol)] Policyholder’s education class: +:grade_12_no_matric+, +:grade_12_matric+, +:diploma_or_btech+, +:undergraduate_degree+ or +:professional_degree+
17
+ # [smoker (Boolean)] Is the policyholder a smoker.
18
+ # [gender (String or Symbol)] Gender of policyholder. Should be either +:male+ or +:female+.
19
+ # [age (Integer)] Age of policyholder. Should be between 18 and 63, inclusive.
20
+ #
21
+ # == +:root_funeral+
22
+ # [cover_amount (Integer)] Amount to cover, in cents. Should be between R10k and R50k, inclusive.
23
+ # [has_spouse (Boolean)] Should a spouse also be covered.
24
+ # [number_of_children (Integer)] Number of children to include in the policy. Should be between 0 and 8, inclusive
25
+ # [extended_family_ages (Array<Integer>)] Ages of extended family members to cover.
26
+ #
27
+ # @example
28
+ # client.create_quote(
29
+ # type: :root_gadgets,
30
+ # model_name: 'iPhone 6s 64GB LTE')
31
+ #
32
+ def create_quote(opts={})
33
+ type = opts[:type]
34
+ case type.to_sym
35
+ when :root_gadgets
36
+ create_gadget_quote(opts)
37
+ when :root_term
38
+ create_term_quote(opts)
39
+ when :root_funeral
40
+ create_funeral_quote(opts)
41
+ else
42
+ raise ArgumentError("Unknown quote type: #{type}")
43
+ end
43
44
  end
44
- end
45
45
 
46
- # List available gadget models
47
- #
48
- # @return [Array<Hash>]
49
- #
50
- # @example
51
- # client.list_gadget_models
52
- #
53
- def list_gadget_models
54
- get('gadgets/models')
55
- end
46
+ # List available gadget models
47
+ #
48
+ # @return [Array<Hash>]
49
+ #
50
+ # @example
51
+ # client.list_gadget_models
52
+ #
53
+ def list_gadget_models
54
+ get('gadgets/models')
55
+ end
56
56
 
57
- private
58
- def create_gadget_quote(opts)
59
- data = {
60
- type: :root_gadgets,
61
- model_name: opts[:model_name]
62
- }
57
+ private
63
58
 
64
- post(:quotes, data)
65
- end
59
+ def create_gadget_quote(opts)
60
+ data = {
61
+ type: :root_gadgets,
62
+ model_name: opts[:model_name]
63
+ }
66
64
 
67
- def create_term_quote(opts)
68
- data = {
69
- type: :root_term,
70
- cover_amount: opts[:cover_amount],
71
- cover_period: opts[:cover_period],
72
- education_status: opts[:education_status],
73
- smoker: opts[:smoker],
74
- gender: opts[:gender],
75
- age: opts[:age],
76
- basic_income_per_month: opts[:basic_income_per_month],
77
- }
65
+ post(:quotes, data)
66
+ end
78
67
 
79
- post(:quotes, data)
80
- end
68
+ def create_term_quote(opts)
69
+ data = {
70
+ type: :root_term,
71
+ cover_amount: opts[:cover_amount],
72
+ cover_period: opts[:cover_period],
73
+ education_status: opts[:education_status],
74
+ smoker: opts[:smoker],
75
+ gender: opts[:gender],
76
+ age: opts[:age],
77
+ basic_income_per_month: opts[:basic_income_per_month],
78
+ }
81
79
 
82
- def create_funeral_quote(opts)
83
- data = {
84
- type: :root_funeral,
85
- cover_amount: opts[:cover_amount],
86
- has_spouse: opts[:has_spouse],
87
- number_of_children: opts[:number_of_children],
88
- extended_family_ages: opts[:extended_family_ages]
89
- }
80
+ post(:quotes, data)
81
+ end
90
82
 
91
- post(:quotes, data)
83
+ def create_funeral_quote(opts)
84
+ data = {
85
+ type: :root_funeral,
86
+ cover_amount: opts[:cover_amount],
87
+ has_spouse: opts[:has_spouse],
88
+ number_of_children: opts[:number_of_children],
89
+ extended_family_ages: opts[:extended_family_ages]
90
+ }
91
+ post(:quotes, data)
92
+ end
92
93
  end
93
94
  end
94
95
  end
@@ -1,3 +1,3 @@
1
1
  module RootInsurance
2
- VERSION = "1.9.0"
2
+ VERSION = "1.9.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: root_insurance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Root Wealth
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-01 00:00:00.000000000 Z
11
+ date: 2018-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  requirements: []
172
172
  rubyforge_project:
173
- rubygems_version: 2.4.8
173
+ rubygems_version: 2.7.7
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: Root Insurance API client