Sha256: 0608d74ab29b031c6d25cb55aad492eb554d02028eae4b8dac88a212b4c27044

Contents?: true

Size: 442 Bytes

Versions: 9

Compression:

Stored size: 442 Bytes

Contents

module AlfaInsurance
  class Response
    def initialize(soap_response)
      @raw_response = soap_response
    end

    def success?
      body.dig(:return_code, :code) == 'OK'
    end

    def error_code
      body.dig(:return_code, :code) unless success?
    end

    def error_description
      body.dig(:return_code, :error_message) unless success?
    end

    def body
      @body ||= @raw_response.body.values.first
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
alfa_insurance-0.1.8 lib/alfa_insurance/response.rb
alfa_insurance-0.1.7 lib/alfa_insurance/response.rb
alfa_insurance-0.1.6 lib/alfa_insurance/response.rb
alfa_insurance-0.1.5 lib/alfa_insurance/response.rb
alfa_insurance-0.1.4 lib/alfa_insurance/response.rb
alfa_insurance-0.1.3 lib/alfa_insurance/response.rb
alfa_insurance-0.1.2 lib/alfa_insurance/response.rb
alfa_insurance-0.1.1 lib/alfa_insurance/response.rb
alfa_insurance-0.1.0 lib/alfa_insurance/response.rb