Class: Rack::DevInsight::Result::Apis

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/dev_insight/result/apis.rb

Defined Under Namespace

Classes: Api, Header

Instance Method Summary collapse

Constructor Details

#initializeApis

Returns a new instance of Apis.



22
23
24
25
# File 'lib/rack/dev_insight/result/apis.rb', line 22

def initialize
  @id = 0
  @data = []
end

Instance Method Details

#add(method, url, request_headers, request_body, status, response_headers, response_body, backtrace, duration) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rack/dev_insight/result/apis.rb', line 27

def add(
  method,
  url,
  request_headers,
  request_body,
  status,
  response_headers,
  response_body,
  backtrace,
  duration
)
  @data << Api.new(
    @id += 1,
    method,
    url,
    request_headers.map(&:to_h),
    request_body,
    status,
    response_headers.map(&:to_h),
    response_body,
    backtrace.map(&:to_h),
    duration,
  )
end

#attributesObject



52
53
54
# File 'lib/rack/dev_insight/result/apis.rb', line 52

def attributes
  @data.map(&:to_h)
end