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_fullpath ⇒ Object
Rails 4 includes the body params in the request_fullpath.
- #request_headers ⇒ Object
- #request_identifier ⇒ Object
- #response_body ⇒ Object
- #response_headers ⇒ Object
- #response_success? ⇒ Boolean
Constructor Details
#initialize(details, request, response) ⇒ Example
Returns a new instance of Example.
13 14 15 16 17 18 19 20 21 |
# File 'lib/dox/entities/example.rb', line 13 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.
6 7 8 |
# File 'lib/dox/entities/example.rb', line 6 def name @name end |
#request_schema ⇒ Object (readonly)
Returns the value of attribute request_schema.
6 7 8 |
# File 'lib/dox/entities/example.rb', line 6 def request_schema @request_schema end |
#response_schema_fail ⇒ Object (readonly)
Returns the value of attribute response_schema_fail.
6 7 8 |
# File 'lib/dox/entities/example.rb', line 6 def response_schema_fail @response_schema_fail end |
#response_schema_success ⇒ Object (readonly)
Returns the value of attribute response_schema_success.
6 7 8 |
# File 'lib/dox/entities/example.rb', line 6 def response_schema_success @response_schema_success end |
Instance Method Details
#request_body ⇒ Object
23 24 25 |
# File 'lib/dox/entities/example.rb', line 23 def request_body @request_body ||= format_content(request, request_content_type) end |
#request_fullpath ⇒ Object
Rails 4 includes the body params in the request_fullpath
48 49 50 51 52 53 54 |
# File 'lib/dox/entities/example.rb', line 48 def request_fullpath if request.query_parameters.present? "#{request_path}?#{request_url_query_parameters}" else request_path end end |
#request_headers ⇒ Object
39 40 41 |
# File 'lib/dox/entities/example.rb', line 39 def request_headers @request_headers ||= filter_headers(request) end |
#request_identifier ⇒ Object
31 32 33 |
# File 'lib/dox/entities/example.rb', line 31 def request_identifier @desc end |
#response_body ⇒ Object
27 28 29 |
# File 'lib/dox/entities/example.rb', line 27 def response_body @response_body ||= format_content(response, response_content_type) end |
#response_headers ⇒ Object
35 36 37 |
# File 'lib/dox/entities/example.rb', line 35 def response_headers @response_headers ||= filter_headers(response) end |
#response_success? ⇒ Boolean
43 44 45 |
# File 'lib/dox/entities/example.rb', line 43 def response_success? response.successful? end |