Sha256: c58aebef4c7b52aca6a5e5e070a5c0943ef27ebcfc371fc4c2613218c142b176

Contents?: true

Size: 736 Bytes

Versions: 88

Compression:

Stored size: 736 Bytes

Contents

module Pact
  module MockService
    class RequestDecorator

      def initialize request
        @request = request
      end

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

      def as_json options = {}
        to_hash
      end

      def to_hash
        hash = {
          method: request.method,
          path: request.path,
        }

        hash[:query]   = request.query   if request.specified?(:query)
        hash[:headers] = request.headers if request.specified?(:headers)
        hash[:body]    = request.body    if request.specified?(:body)
        hash[:options] = request.options if request.options.any?
        hash
      end

      private

      attr_reader :request

    end
  end
end

Version data entries

88 entries across 88 versions & 2 rubygems

Version Path
pact-mock_service-2.6.3 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.6.2 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.6.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.5.4 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.5.3 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.5.1 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.4.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.3.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.2.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.1.1.pre.alpha.2 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.1.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.0.1 lib/pact/mock_service/request_decorator.rb
pact-mock_service-2.0.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-1.2.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-1.1.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-1.0.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-0.12.1 lib/pact/mock_service/request_decorator.rb
pact-mock_service-0.12.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-0.11.0 lib/pact/mock_service/request_decorator.rb
pact-mock_service-0.10.2 lib/pact/mock_service/request_decorator.rb