Class: Pact::InteractionDecorator

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

Instance Method Summary collapse

Constructor Details

#initialize(interaction, decorator_options = {}) ⇒ InteractionDecorator

Returns a new instance of InteractionDecorator.



10
11
12
13
# File 'lib/pact/consumer_contract/interaction_decorator.rb', line 10

def initialize interaction, decorator_options = {}
  @interaction = interaction
  @decorator_options = decorator_options
end

Instance Method Details

#as_json(options = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/pact/consumer_contract/interaction_decorator.rb', line 15

def as_json options = {}
  hash = { :description => interaction.description }
  hash[:providerState] = interaction.provider_state if interaction.provider_state
  hash[:request] = decorate_request.as_json(options)
  hash[:response] = decorate_response.as_json(options)
  fix_all_the_things hash
end

#to_json(options = {}) ⇒ Object



23
24
25
# File 'lib/pact/consumer_contract/interaction_decorator.rb', line 23

def to_json(options = {})
  as_json(options).to_json(options)
end