Sha256: 7d8390ac56af71d25e1b6f21e18860cb6d478434bd806e6b162f52782feaf0ae

Contents?: true

Size: 445 Bytes

Versions: 3

Compression:

Stored size: 445 Bytes

Contents

module AlfaInsurance
  class CalculateResponse < Response
    def cost
      Money.new(body.dig(:calculation_result, :premium), currency)
    end

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

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

  private

    def currency
      @currency ||= body.dig(:calculation_result, :currency)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alfa_insurance-0.1.2 lib/alfa_insurance/calculate_response.rb
alfa_insurance-0.1.1 lib/alfa_insurance/calculate_response.rb
alfa_insurance-0.1.0 lib/alfa_insurance/calculate_response.rb