Class: Aws::Resources::Documenter::BaseOperationDocumenter
- Inherits:
-
Object
- Object
- Aws::Resources::Documenter::BaseOperationDocumenter
- Defined in:
- lib/aws-sdk-resources/documenter/base_operation_documenter.rb
Direct Known Subclasses
DataOperationDocumenter, HasManyOperationDocumenter, HasOperationDocumenter, OperationDocumenter, ResourceOperationDocumenter, WaiterOperationDocumenter
Instance Attribute Summary collapse
-
#api_request ⇒ Seahorse::Model::Operation?
readonly
Returns the model of the API operation called.
-
#api_request_name ⇒ String?
readonly
Returns the name of the API operation called on the client.
-
#api_request_params ⇒ Array<Resources::RequestParams::Base>?
readonly
Returns the parameters this operation binds to the made request.
-
#builder ⇒ Builder?
readonly
Returns the resource builder for this operation.
-
#called_operation ⇒ String?
readonly
Returns the ‘Client#operation_name` reference.
-
#operation_name ⇒ String
readonly
The name of this resource operation.
-
#resource_class ⇒ Class<Resource>
readonly
Returns the resource class this operation belongs to.
-
#resource_class_name ⇒ String
readonly
Returns the name of the resource class being documented without the namespace prefix.
- #source ⇒ Source readonly
-
#target_resource_class ⇒ Class<Resource>?
readonly
Returns the class of the resource returned by invoking this operation.
-
#target_resource_class_name ⇒ String?
readonly
Returns the name of the resource class returned by this operation.
- #yard_class ⇒ YARD::CodeObject::ClassObject readonly
Instance Method Summary collapse
-
#initialize(yard_class, resource_class, operation_name, operation) ⇒ BaseOperationDocumenter
constructor
A new instance of BaseOperationDocumenter.
-
#method_object ⇒ YARD::CodeObject::MethodObject
Constructs and returns a new YARD method object for this operation.
Constructor Details
#initialize(yard_class, resource_class, operation_name, operation) ⇒ BaseOperationDocumenter
Returns a new instance of BaseOperationDocumenter.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 6 def initialize(yard_class, resource_class, operation_name, operation) @yard_class = yard_class @resource_class = resource_class @resource_class_name = @resource_class.name.split('::').last @operation_name = operation_name.to_s @operation = operation @source = @operation.source if @operation.respond_to?(:request) @api_request_name = @operation.request.method_name @api_request = @resource_class.client_class.api.operation(@api_request_name) @api_request_params = @operation.request.params @request_operation_name = @operation.request.method_name.to_s @called_operation = "Client##{@api_request_name}" end if @operation.respond_to?(:builder) @builder = @operation.builder @target_resource_class = @builder.resource_class @target_resource_class_name = @target_resource_class.name.split('::').last end end |
Instance Attribute Details
#api_request ⇒ Seahorse::Model::Operation? (readonly)
Returns the model of the API operation called. Returns ‘nil` if this operation does not make any API requests.
64 65 66 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 64 def api_request @api_request end |
#api_request_name ⇒ String? (readonly)
Returns the name of the API operation called on the client. Returns ‘nil` if this operation does not make any API requests.
59 60 61 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 59 def api_request_name @api_request_name end |
#api_request_params ⇒ Array<Resources::RequestParams::Base>? (readonly)
Returns the parameters this operation binds to the made request. Returns ‘nil` if this operation does not make a request.
69 70 71 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 69 def api_request_params @api_request_params end |
#builder ⇒ Builder? (readonly)
Returns the resource builder for this operation. Returns ‘nil` if this operation does not build and return resource objects.
78 79 80 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 78 def builder @builder end |
#called_operation ⇒ String? (readonly)
Returns the ‘Client#operation_name` reference. This is useful for generating `@see` tags and `links`.
73 74 75 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 73 def called_operation @called_operation end |
#operation_name ⇒ String (readonly)
Returns The name of this resource operation.
35 36 37 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 35 def operation_name @operation_name end |
#resource_class ⇒ Class<Resource> (readonly)
Returns the resource class this operation belongs to.
32 33 34 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 32 def resource_class @resource_class end |
#resource_class_name ⇒ String (readonly)
Returns the name of the resource class being documented without the namespace prefix. Example:
-
Aws::S3::Resource => ‘Resource’
-
Aws::S3::Bucket => ‘Bucket’
43 44 45 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 43 def resource_class_name @resource_class_name end |
#source ⇒ Source (readonly)
81 82 83 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 81 def source @source end |
#target_resource_class ⇒ Class<Resource>? (readonly)
Returns the class of the resource returned by invoking this operation. Returns ‘nil` if this operation does not return any resource objects.
48 49 50 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 48 def target_resource_class @target_resource_class end |
#target_resource_class_name ⇒ String? (readonly)
Returns the name of the resource class returned by this operation. This is the base name of the class without a namespace prefix. Returns ‘nil` if this operation does not return any resource objects.
54 55 56 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 54 def target_resource_class_name @target_resource_class_name end |
#yard_class ⇒ YARD::CodeObject::ClassObject (readonly)
28 29 30 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 28 def yard_class @yard_class end |
Instance Method Details
#method_object ⇒ YARD::CodeObject::MethodObject
Constructs and returns a new YARD method object for this operation.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 85 def method_object if m = YARD::Registry[@resource_class.name + "##{operation_name}"] else m = YARD::CodeObjects::MethodObject.new(yard_class, operation_name) m.docstring = docstring m.parameters = parameters end m.scope = :instance if source m.source_type = :json m.source = source.format filename = source.file filename = filename.match('(aws-sdk-core/apis/.+\.resources\.json)')[1] m.add_file(filename, nil, true) end .each do |tag| m.add_tag(tag) end m end |