Sha256: d8a292581ad20c74f7e174330365d3e5bce23dfa9ec134cbae84680c28151133

Contents?: true

Size: 498 Bytes

Versions: 20

Compression:

Stored size: 498 Bytes

Contents

require 'backlog_kit/resource'

module BacklogKit
  class Response
    attr_reader(:headers, :status, :body)

    def initialize(response)
      @headers = process(response.headers)
      @status  = process(response.status)
      @body    = process(response.body)
    end

    private

    def process(raw)
      case raw
      when Hash   then Resource.new(raw)
      when Array  then raw.map { |hash| process(hash) }
      when String then Resource.new
      else raw
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
backlog_kit-0.19.0 lib/backlog_kit/response.rb
backlog_kit-0.18.0 lib/backlog_kit/response.rb
backlog_kit-0.17.0 lib/backlog_kit/response.rb
backlog_kit-0.16.0 lib/backlog_kit/response.rb
backlog_kit-0.15.0 lib/backlog_kit/response.rb
backlog_kit-0.14.0 lib/backlog_kit/response.rb
backlog_kit-0.13.0 lib/backlog_kit/response.rb
backlog_kit-0.12.1 lib/backlog_kit/response.rb
backlog_kit-0.12.0 lib/backlog_kit/response.rb
backlog_kit-0.11.0 lib/backlog_kit/response.rb
backlog_kit-0.10.0 lib/backlog_kit/response.rb
backlog_kit-0.9.0 lib/backlog_kit/response.rb
backlog_kit-0.8.0 lib/backlog_kit/response.rb
backlog_kit-0.7.0 lib/backlog_kit/response.rb
backlog_kit-0.6.0 lib/backlog_kit/response.rb
backlog_kit-0.5.0 lib/backlog_kit/response.rb
backlog_kit-0.4.0 lib/backlog_kit/response.rb
backlog_kit-0.3.0 lib/backlog_kit/response.rb
backlog_kit-0.2.0 lib/backlog_kit/response.rb
backlog_kit-0.1.0 lib/backlog_kit/response.rb