Class: Pact::RequestDecorator
- Inherits:
-
Object
- Object
- Pact::RequestDecorator
- Defined in:
- lib/pact/consumer_contract/request_decorator.rb
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(request, decorator_options = {}) ⇒ RequestDecorator
constructor
A new instance of RequestDecorator.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(request, decorator_options = {}) ⇒ RequestDecorator
Returns a new instance of RequestDecorator.
6 7 8 9 |
# File 'lib/pact/consumer_contract/request_decorator.rb', line 6 def initialize request, = {} @request = request @decorator_options = end |
Instance Method Details
#as_json(options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pact/consumer_contract/request_decorator.rb', line 15 def as_json = {} hash = { method: request.method, path: path } hash[:query] = query if request.specified?(:query) hash[:headers] = headers if request.specified?(:headers) hash[:body] = body if request.specified?(:body) hash end |
#to_json(options = {}) ⇒ Object
11 12 13 |
# File 'lib/pact/consumer_contract/request_decorator.rb', line 11 def to_json( = {}) as_json.to_json() end |