Sha256: 54eca8a1e7b21e99e3242e3b85283084c0070887a80d691476a8cf36d0afe2eb

Contents?: true

Size: 609 Bytes

Versions: 88

Compression:

Stored size: 609 Bytes

Contents

module Pact
  module MockService
    class ResponseDecorator

      def initialize response
        @response = response
      end

      def to_json(options = {})
        as_json.to_json(options)
      end

      def as_json options = {}
        to_hash
      end

      def to_hash
        hash = {}
        hash[:status]  = response.status  if response.specified?(:status)
        hash[:headers] = response.headers if response.specified?(:headers)
        hash[:body]    = response.body    if response.specified?(:body)
        hash
      end

      private

      attr_reader :response

    end
  end
end

Version data entries

88 entries across 88 versions & 2 rubygems

Version Path
pact-mock_service-0.10.1 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.10.0 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.9.0 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.8.2 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.8.1 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.8.0 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.7.2 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.7.1 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.7.0 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.6.0 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.5.5 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.5.4 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.5.3 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.5.2 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.5.1 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.5.0 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.4.2 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.4.1 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.4.0 lib/pact/mock_service/response_decorator.rb
pact-mock_service-0.3.0 lib/pact/mock_service/response_decorator.rb