Class: AlfaInsurance::FindResponse

Inherits:
CalculateResponse show all
Defined in:
lib/alfa_insurance/find_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/find_response.rb', line 7

def cost
  Money.from_amount(body.dig(:policy_information, :rate).to_f, currency)
end

#insurance_idObject



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

def insurance_id
  body.dig(:policy_information, :policy_id).to_i
end

#risk_typeObject



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

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

#risk_valueObject



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

def risk_value
  Money.from_amount(body.dig(:policy_information, :risk_value, :@value).to_f, risk_currency)
end

#stateObject



19
20
21
# File 'lib/alfa_insurance/find_response.rb', line 19

def state
  body.dig(:policy_information, :policy_status)
end