Class: Dox::Entities::Example

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/dox/entities/example.rb

Instance Method Summary collapse

Constructor Details

#initialize(details, request, response) ⇒ Example



12
13
14
15
16
# File 'lib/dox/entities/example.rb', line 12

def initialize(details, request, response)
  @desc = details[:description]
  @request = request
  @response = response
end

Instance Method Details

#request_bodyObject



18
19
20
# File 'lib/dox/entities/example.rb', line 18

def request_body
  @request_body ||= request.body.read
end

#request_fullpathObject

Rails 4 includes the body params in the request_fullpath



35
36
37
38
39
40
41
# File 'lib/dox/entities/example.rb', line 35

def request_fullpath
  if request.query_parameters.present?
    "#{request_path}?#{request_url_query_parameters}"
  else
    request_path
  end
end

#request_headersObject



30
31
32
# File 'lib/dox/entities/example.rb', line 30

def request_headers
  @request_headers ||= filter_headers(request)
end

#request_identifierObject



22
23
24
# File 'lib/dox/entities/example.rb', line 22

def request_identifier
  @desc
end

#response_headersObject



26
27
28
# File 'lib/dox/entities/example.rb', line 26

def response_headers
  @response_headers ||= filter_headers(response)
end