Sha256: 959a729645a16082297fb659947029e515f4e9939912b23ea9adcb9fd7ba88aa

Contents?: true

Size: 507 Bytes

Versions: 11

Compression:

Stored size: 507 Bytes

Contents

# frozen_string_literal: true

module Ika3
  class Response
    def initialize(faraday_response)
      @raw_body    = faraday_response.body
      @raw_headers = faraday_response.headers
      @raw_status  = faraday_response.status
    end

    def body
      @raw_body
    end

    def headers
      @headers ||= @raw_headers.inject({}) do |result, (key, value)|
        result.merge(key.split('-').map(&:capitalize).join('-') => value)
      end
    end

    def status
      @raw_status
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ika3-1.1.0 lib/ika3/response.rb
ika3-1.0.0 lib/ika3/response.rb
ika3-0.10.0 lib/ika3/response.rb
ika3-0.9.1 lib/ika3/response.rb
ika3-0.9.0 lib/ika3/response.rb
ika3-0.8.1 lib/ika3/response.rb
ika3-0.8.0 lib/ika3/response.rb
ika3-0.6.0 lib/ika3/response.rb
ika3-0.5.1 lib/ika3/response.rb
ika3-0.5.0 lib/ika3/response.rb
ika3-0.4.1 lib/ika3/response.rb