Method: Minitest::OpenAPI::Webhook.build

Defined in:
lib/minitest/openapi/webhook.rb

.build(metadata, test_case) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/minitest/openapi/webhook.rb', line 6

def self.build(, test_case)
  export_file_path = Minitest::OpenAPI.path.yield_self { |p| p.is_a?(Proc) ? p.call(test_case) : p }
  file_path_data = Minitest::OpenAPI.webhooks[export_file_path]

  if file_path_data[[:endpoint]]
    if file_path_data[[:endpoint]][[:method]]
      file_path_data[[:endpoint]][[:method]][:responses].merge!({ [:status] => {} })
    else
      file_path_data[[:endpoint]].merge! self.format_endpoint()
    end
  else
    file_path_data.merge!([:endpoint] => self.format_endpoint())
  end
end