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



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

def 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