Module: Datadog::AppSec::APISecurity::EndpointCollection::GrapeRouteSerializer

Defined in:
lib/datadog/appsec/api_security/endpoint_collection/grape_route_serializer.rb

Overview

This module serializes Grape routes.

Class Method Summary collapse

Class Method Details

.serialize(route, path_prefix: "") ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/datadog/appsec/api_security/endpoint_collection/grape_route_serializer.rb', line 9

def self.serialize(route, path_prefix: "")
  path = path_prefix + route.pattern.origin

  {
    type: "REST",
    resource_name: "#{route.request_method} #{path}",
    operation_name: "http.request",
    method: route.request_method,
    path: path,
  }
end