Class: Datadog::AppSec::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/appsec/response.rb

Overview

AppSec response

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, headers: {}, body: []) ⇒ Response

Returns a new instance of Response.

[View source]

12
13
14
15
16
# File 'lib/datadog/appsec/response.rb', line 12

def initialize(status:, headers: {}, body: [])
  @status = status
  @headers = headers
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.


10
11
12
# File 'lib/datadog/appsec/response.rb', line 10

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.


10
11
12
# File 'lib/datadog/appsec/response.rb', line 10

def headers
  @headers
end

#statusObject (readonly)

Returns the value of attribute status.


10
11
12
# File 'lib/datadog/appsec/response.rb', line 10

def status
  @status
end

Class Method Details

.from_interrupt_params(interrupt_params, http_accept_header) ⇒ Object

[View source]

23
24
25
26
27
# File 'lib/datadog/appsec/response.rb', line 23

def from_interrupt_params(interrupt_params, http_accept_header)
  return redirect_response(interrupt_params) if interrupt_params['location']

  block_response(interrupt_params, http_accept_header)
end

Instance Method Details

#to_rackObject

[View source]

18
19
20
# File 'lib/datadog/appsec/response.rb', line 18

def to_rack
  [status, headers, body]
end