lib/root_insurance/api/policy.rb
# Add a benificiary to a policy
#
# @param [String] policy_id The unique identifier of the policy.
# @param [String] first_name The beneficiary's first name
# @param [String] last_name The beneficiary's last name
# @param [Hash] id An hash containing the beneficiary's identification number, type and country. See below.
# @param [Integer] percentage An integer representing the percentage of a claim payout that the beneficiary should receive.
# @param [String] cellphone Hash containing beneficiary's cellphone number and country. See below for details. (optional)
# @return [Hash]
#
## == ID
# [type (string or symbol)]   Either +:id+ or +:passport+
# [number (string)]   The id or passport number
# [country (string)]   The ISO Alpha-2 country code of the country of the id/passport number.
#
## == Cellphone
# [number (string)]   The cellphone number
# [country (string)]   The ISO Alpha-2 country code of the country of the cellphone number.
#
# @example
#   client.add_policy_beneficiary(
#     policy_id: "128ba0c0-3f6a-4f8b-9b40-e2066b02b59e",
#     first_name: "Jared"
#     last_name:  "Dunn",
#     id:         {type: :id, number: "8704094800082", country: "ZA"},
#     percentage: 100)
#
Add a benificiary to a policy
Add a benificiary to a policy
def add_policy_beneficiary(policy_id:, id:, first_name:, last_name:, percentage:, cellphone: nil)
        raise ArgumentError.new('id needs to be a hash') unless id.is_a? Hash
        data = {
          id:         id,
          first_name: first_name,
          last_name:  last_name,
          percentage: percentage,
          cellphone:  cellphone
        }.reject { |k, v| v.nil? }
        put("policies/#{policy_id}/beneficiaries", data)
      end
def add_policy_beneficiary ( policy_id : , id : , first_name : , last_name : , percentage : , cellphone : nil ) raise ArgumentError . new ( 'id needs to be a hash' ) unless id . is_a? Hash data = { id : id , first_name : first_name , last_name : last_name , percentage : percentage , cellphone : cellphone } . reject { | k , v | v . nil? } put ( "policies/#{policy_id}/beneficiaries" , data ) end
Add a benificiary to a policy
Add a benificiary to a policy
ID [type (string or symbol)] Either +:id+ or +:passport+ [number (string)] The id or passport number [country (string)] The ISO Alpha-2 country code of the country of the id/passport number. == Cellphone [number (string)] The cellphone number [country (string)] The ISO Alpha-2 country code of the country of the cellphone number.
ID [ type ( string or symbol ) ] Either + : id + or + : passport + [ number ( string ) ] The id or passport number [ country ( string ) ] The ISO Alpha - 2 country code of the country of the id / passport number . == Cellphone [ number ( string ) ] The cellphone number [ country ( string ) ] The ISO Alpha - 2 country code of the country of the cellphone number .
Hash
policy_id
<not_specific>
id
<not_specific>
first_name
<not_specific>
last_name
<not_specific>
percentage
<not_specific>
cellphone
<not_specific>
<not_specific>
cellphone Hash containing beneficiary's cellphone number and country. See below for details. (optional)
cellphone Hash containing beneficiary ' s cellphone number and country . See below for details . ( optional )
example
None