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”.
Instance Attribute Summary
Attributes inherited from SwaggerObject
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, 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
27 28 29 |
# File 'lib/swagger/v2/operation.rb', line 27 def api_title root.info.title end |
#default_response ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/swagger/v2/operation.rb', line 44 def default_response return nil if 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.
54 55 56 57 58 59 |
# File 'lib/swagger/v2/operation.rb', line 54 def each_parameter return if parameters.nil? parameters.each do | parameter | yield parameter end end |
#full_name ⇒ Object
31 32 33 |
# File 'lib/swagger/v2/operation.rb', line 31 def full_name "#{api_title} - #{summary}" end |
#signature ⇒ Object
40 41 42 |
# File 'lib/swagger/v2/operation.rb', line 40 def signature "#{verb.to_s.upcase} #{parent.uri_template}" end |
#verb ⇒ Object
The HTTP verb for the operation.
36 37 38 |
# File 'lib/swagger/v2/operation.rb', line 36 def verb parent.operations.key self end |