Class: Swagger::V2::Operation
- Inherits:
-
SwaggerObject
- Object
- Hashie::Dash
- SwaggerObject
- Swagger::V2::Operation
- Extended by:
- Forwardable
- Defined in:
- lib/swagger/v2/operation.rb
Overview
Class representing a Swagger “Operation Object”.
Constant Summary
Constants inherited from SwaggerObject
SwaggerObject::CUSTOM_PROPERTY_PREFIX
Instance Attribute Summary
Attributes inherited from SwaggerObject
Attributes included from Attachable
Instance Method Summary collapse
- #api_title ⇒ Object
- #default_response ⇒ Object
-
#each_parameter ⇒ Object
Iterates over each parameter defined directly on the operation, excluding parameters defined at the API level.
- #full_name ⇒ Object
- #signature ⇒ Object
-
#verb ⇒ Object
The HTTP verb for the operation.
Methods inherited from SwaggerObject
field, #initialize, property?, required_field
Methods included from Attachable
#attach_parent, #attach_to_children, #root
Constructor Details
This class inherits a constructor from Swagger::SwaggerObject
Instance Method Details
#api_title ⇒ Object
28 29 30 |
# File 'lib/swagger/v2/operation.rb', line 28 def api_title root.info.title end |
#default_response ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/swagger/v2/operation.rb', line 45 def default_response return nil if responses.nil? || responses.values.nil? # FIXME: Swagger isn't very clear on "normal response codes" # In the examples, default is actually an error responses['200'] || responses['201'] || responses['default'] || responses.values.first end |
#each_parameter ⇒ Object
Iterates over each parameter defined directly on the operation, excluding parameters defined at the API level.
55 56 57 58 59 60 |
# File 'lib/swagger/v2/operation.rb', line 55 def each_parameter return if parameters.nil? parameters.each do |parameter| yield parameter end end |
#full_name ⇒ Object
32 33 34 |
# File 'lib/swagger/v2/operation.rb', line 32 def full_name "#{api_title} - #{summary}" end |
#signature ⇒ Object
41 42 43 |
# File 'lib/swagger/v2/operation.rb', line 41 def signature "#{verb.to_s.upcase} #{parent.uri_template}" end |
#verb ⇒ Object
The HTTP verb for the operation.
37 38 39 |
# File 'lib/swagger/v2/operation.rb', line 37 def verb parent.operations.key self end |