Class: Pact::MockService::InteractionDecorator

Inherits:
Object
  • Object
show all
Includes:
ActiveSupportSupport
Defined in:
lib/pact/mock_service/interaction_decorator.rb

Instance Method Summary collapse

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 options = {}
  fix_all_the_things to_hash
end

#to_hashObject



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(options = {})
  as_json.to_json(options)
end