58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/sbmt/pact/consumer/grpc_interaction_builder.rb', line 58
def with_service(proto_path, method, include_dirs = [])
raise InteractionBuilderError.new("invalid grpc method: cannot be blank") if method.blank?
service_name, method_name = method.split("/") || []
raise InteractionBuilderError.new("invalid grpc method: #{method}, should be like service/SomeMethod") if service_name.blank? || method_name.blank?
absolute_path = File.expand_path(proto_path)
raise InteractionBuilderError.new("proto file #{proto_path} does not exist") unless File.exist?(absolute_path)
@proto_path = absolute_path
@service_name = service_name
@method_name = method_name
@proto_include_dirs = include_dirs.map { |dir| File.expand_path(dir) }
self
end
|