Module: RootInsurance::Api::Quote

Included in:
Client
Defined in:
lib/root_insurance/api/quote.rb

Instance Method Summary collapse

Instance Method Details

#create_quote(opts = {}) ⇒ Hash

Create a quote

:root_gadgets

model_name (String)

The model name of the gadget

:root_term

cover_amount (Integer)

Amount to cover, in cents. Should be between R100 000 and R5 000 000, inclusive.

cover_period (String or Symbol)

Duration to cover: :1_year, :2_years, :5_years, :10_years, :15_years, :20_years or :whole_life.

basic_income_per_month (Integer)

Policyholder’s basic monthly income, in cents.

education_status (String or Symbol)

Policyholder’s education class: :grade_12_no_matric, :grade_12_matric, :diploma_or_btech, :undergraduate_degree or :professional_degree

smoker (Boolean)

Is the policyholder a smoker.

gender (String or Symbol)

Gender of policyholder. Should be either :male or :female.

age (Integer)

Age of policyholder. Should be between 18 and 63, inclusive.

:root_funeral

cover_amount (Integer)

Amount to cover, in cents. Should be between R10k and R50k, inclusive.

has_spouse (Boolean)

Should a spouse also be covered.

number_of_children (Integer)

Number of children to include in the policy. Should be between 0 and 8, inclusive

extended_family_ages (Array<Integer>)

Ages of extended family members to cover.

Examples:

client.create_quote(
  type:       :root_gadgets,
  model_name: 'iPhone 6s 64GB LTE')

Parameters:

  • opts (Hash) (defaults to: {})

    The quote details. Depending on :type, different options are available. Available types are: :root_gadgets, :root_term and :root_funeral See below for details

Returns:

  • (Hash)


32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/root_insurance/api/quote.rb', line 32

def create_quote(opts={})
  type = opts[:type]
  case type.to_sym
  when :root_gadgets
    create_gadget_quote(opts)
  when :root_term
    create_term_quote(opts)
  when :root_funeral
    create_funeral_quote(opts)
  else
    raise ArgumentError("Unknown quote type: #{type}")
  end
end

#list_gadget_modelsArray<Hash>

List available gadget models

Examples:

client.list_gadget_models

Returns:

  • (Array<Hash>)


53
54
55
# File 'lib/root_insurance/api/quote.rb', line 53

def list_gadget_models
  get('gadgets/models')
end