Class: Pact::ResponseDecorator
- Inherits:
-
Object
- Object
- Pact::ResponseDecorator
- Defined in:
- lib/pact/consumer_contract/response_decorator.rb
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(response) ⇒ ResponseDecorator
constructor
A new instance of ResponseDecorator.
- #to_hash ⇒ Object
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(response) ⇒ ResponseDecorator
Returns a new instance of ResponseDecorator.
4 5 6 |
# File 'lib/pact/consumer_contract/response_decorator.rb', line 4 def initialize response @response = response end |
Instance Method Details
#as_json(options = {}) ⇒ Object
12 13 14 |
# File 'lib/pact/consumer_contract/response_decorator.rb', line 12 def as_json = {} to_hash end |
#to_hash ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/pact/consumer_contract/response_decorator.rb', line 16 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 |
#to_json(options = {}) ⇒ Object
8 9 10 |
# File 'lib/pact/consumer_contract/response_decorator.rb', line 8 def to_json( = {}) as_json.to_json() end |