Class: AlfaInsurance::CreateResponse

Inherits:
CalculateResponse show all
Defined in:
lib/alfa_insurance/create_response.rb

Instance Method Summary collapse

Methods inherited from Response

#body, #error_code, #error_description, #initialize, #success?

Constructor Details

This class inherits a constructor from AlfaInsurance::Response

Instance Method Details

#costObject



7
8
9
# File 'lib/alfa_insurance/create_response.rb', line 7

def cost
  Money.from_amount(body.dig(:calculation_result, :premium).to_f, currency)
end

#insurance_idObject



3
4
5
# File 'lib/alfa_insurance/create_response.rb', line 3

def insurance_id
  body[:policy_id].to_i
end

#risk_typeObject



15
16
17
# File 'lib/alfa_insurance/create_response.rb', line 15

def risk_type
  body.dig(:calculation_result, :risk_value, :@risk_type)
end

#risk_valueObject



11
12
13
# File 'lib/alfa_insurance/create_response.rb', line 11

def risk_value
  Money.from_amount(body.dig(:calculation_result, :risk_value_sum).to_f, currency)
end