Class: Pact::MockService::InteractionDecorator
- Inherits:
-
Object
- Object
- Pact::MockService::InteractionDecorator
- Includes:
- ActiveSupportSupport
- Defined in:
- lib/pact/mock_service/interaction_decorator.rb
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(interaction) ⇒ InteractionDecorator
constructor
A new instance of InteractionDecorator.
- #to_hash ⇒ Object
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(interaction) ⇒ InteractionDecorator
Returns a new instance of InteractionDecorator.
14 15 16 |
# File 'lib/pact/mock_service/interaction_decorator.rb', line 14 def initialize interaction @interaction = interaction end |
Instance Method Details
#as_json(options = {}) ⇒ Object
18 19 20 |
# File 'lib/pact/mock_service/interaction_decorator.rb', line 18 def as_json = {} fix_all_the_things to_hash end |
#to_hash ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/pact/mock_service/interaction_decorator.rb', line 26 def to_hash hash = { :description => interaction.description } hash[:providerState] = interaction.provider_state if interaction.provider_state hash[:request] = decorate_request.as_json hash[:response] = decorate_response.as_json hash[:metadata] = interaction. hash end |
#to_json(options = {}) ⇒ Object
22 23 24 |
# File 'lib/pact/mock_service/interaction_decorator.rb', line 22 def to_json( = {}) as_json.to_json() end |