Class: Pact::MockService::RequestDecorator
- Inherits:
-
Object
- Object
- Pact::MockService::RequestDecorator
- Defined in:
- lib/pact/mock_service/request_decorator.rb
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(request) ⇒ RequestDecorator
constructor
A new instance of RequestDecorator.
- #to_hash ⇒ Object
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(request) ⇒ RequestDecorator
Returns a new instance of RequestDecorator.
5 6 7 |
# File 'lib/pact/mock_service/request_decorator.rb', line 5 def initialize request @request = request end |
Instance Method Details
#as_json(options = {}) ⇒ Object
13 14 15 |
# File 'lib/pact/mock_service/request_decorator.rb', line 13 def as_json = {} to_hash end |
#to_hash ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pact/mock_service/request_decorator.rb', line 17 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. if request..any? hash end |
#to_json(options = {}) ⇒ Object
9 10 11 |
# File 'lib/pact/mock_service/request_decorator.rb', line 9 def to_json( = {}) as_json.to_json() end |