Method: Sbmt::Pact::Consumer::GrpcInteractionBuilder#interaction_json

Defined in:
lib/sbmt/pact/consumer/grpc_interaction_builder.rb

#interaction_jsonObject



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/sbmt/pact/consumer/grpc_interaction_builder.rb', line 100

def interaction_json
  result = {
    "pact:proto": @proto_path,
    "pact:proto-service": "#{@service_name}/#{@method_name}",
    "pact:content-type": CONTENT_TYPE,
    request: @request
  }

  result["pact:protobuf-config"] = {additionalIncludes: @proto_include_dirs} if @proto_include_dirs.present?

  result[:response] = @response if @response.is_a?(Hash)
  result[:responseMetadata] = @response_meta if @response_meta.is_a?(Hash)

  JSON.dump(result)
end