Sha256: 32c51bfe0176a5322fd7aa42ee8cb3ce8ae651dc73627969599a3c0beb2464fe

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

module CassetteRack
  module Decorator
    class Response
      def initialize(response)
        @response = response
      end

      def to_liquid
        {
          'status_code' => status_code,
          'status_message' => status_message,
          'body' => body,
        }
      end

      def status_code
        @response.status.code
      end

      def status_message
        @response.status.message
      end

      def body
        JSON.pretty_generate JSON.parse(@response.body)
      rescue
        @response.body
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cassette-rack-0.4.0 lib/cassette-rack/decorator/response.rb