Class: Dox::Entities::Example
- Inherits:
-
Object
- Object
- Dox::Entities::Example
- Extended by:
- Forwardable
- Defined in:
- lib/dox/entities/example.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#request_schema ⇒ Object
readonly
Returns the value of attribute request_schema.
-
#response_schema_fail ⇒ Object
readonly
Returns the value of attribute response_schema_fail.
-
#response_schema_success ⇒ Object
readonly
Returns the value of attribute response_schema_success.
Instance Method Summary collapse
-
#initialize(details, request, response) ⇒ Example
constructor
A new instance of Example.
- #request_body ⇒ Object
-
#request_content_type ⇒ Object
Rails 7 changes content_type result.
-
#request_fullpath ⇒ Object
Rails 4 includes the body params in the request_fullpath.
- #request_headers ⇒ Object
- #request_identifier ⇒ Object
- #response_body ⇒ Object
- #response_content_type ⇒ Object
- #response_headers ⇒ Object
- #response_success? ⇒ Boolean
Constructor Details
#initialize(details, request, response) ⇒ Example
Returns a new instance of Example.
15 16 17 18 19 20 21 22 23 |
# File 'lib/dox/entities/example.rb', line 15 def initialize(details, request, response) @desc = details[:description] @name = details[:resource_name].downcase @request_schema = details[:action_request_schema] @response_schema_success = details[:action_response_schema_success] @response_schema_fail = details[:action_response_schema_fail] @request = request @response = response end |
Instance Attribute Details
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
6 7 8 |
# File 'lib/dox/entities/example.rb', line 6 def desc @desc end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/dox/entities/example.rb', line 7 def name @name end |
#request_schema ⇒ Object (readonly)
Returns the value of attribute request_schema.
8 9 10 |
# File 'lib/dox/entities/example.rb', line 8 def request_schema @request_schema end |
#response_schema_fail ⇒ Object (readonly)
Returns the value of attribute response_schema_fail.
10 11 12 |
# File 'lib/dox/entities/example.rb', line 10 def response_schema_fail @response_schema_fail end |
#response_schema_success ⇒ Object (readonly)
Returns the value of attribute response_schema_success.
9 10 11 |
# File 'lib/dox/entities/example.rb', line 9 def response_schema_success @response_schema_success end |
Instance Method Details
#request_body ⇒ Object
25 26 27 |
# File 'lib/dox/entities/example.rb', line 25 def request_body @request_body ||= format_content(request, request_content_type) end |
#request_content_type ⇒ Object
Rails 7 changes content_type result
59 60 61 |
# File 'lib/dox/entities/example.rb', line 59 def request_content_type request.respond_to?(:media_type) ? request.media_type : request.content_type end |
#request_fullpath ⇒ Object
Rails 4 includes the body params in the request_fullpath
50 51 52 53 54 55 56 |
# File 'lib/dox/entities/example.rb', line 50 def request_fullpath if request.query_parameters.present? "#{request_path}?#{request_url_query_parameters}" else request_path end end |
#request_headers ⇒ Object
41 42 43 |
# File 'lib/dox/entities/example.rb', line 41 def request_headers @request_headers ||= filter_headers(request) end |
#request_identifier ⇒ Object
33 34 35 |
# File 'lib/dox/entities/example.rb', line 33 def request_identifier @desc end |
#response_body ⇒ Object
29 30 31 |
# File 'lib/dox/entities/example.rb', line 29 def response_body @response_body ||= format_content(response, response_content_type) end |
#response_content_type ⇒ Object
63 64 65 |
# File 'lib/dox/entities/example.rb', line 63 def response_content_type response.respond_to?(:media_type) ? response.media_type : response.content_type end |
#response_headers ⇒ Object
37 38 39 |
# File 'lib/dox/entities/example.rb', line 37 def response_headers @response_headers ||= filter_headers(response) end |
#response_success? ⇒ Boolean
45 46 47 |
# File 'lib/dox/entities/example.rb', line 45 def response_success? response.successful? end |