Sha256: 260abf005db3c2f790cf725771c3cbeeede75b7498962f761d45fe77c636493b

Contents?: true

Size: 542 Bytes

Versions: 6

Compression:

Stored size: 542 Bytes

Contents

module Pact
  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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pact-mock_service-0.2.3.pre.rc2 lib/pact/consumer_contract/response_decorator.rb
pact-mock_service-0.2.3.pre.rc1 lib/pact/consumer_contract/response_decorator.rb
pact-mock_service-0.2.2 lib/pact/consumer_contract/response_decorator.rb
pact-mock_service-0.2.1 lib/pact/consumer_contract/response_decorator.rb
pact-mock_service-0.2.0 lib/pact/consumer_contract/response_decorator.rb
pact-mock_service-0.1.0 lib/pact/consumer_contract/response_decorator.rb