Class: Aws::Resources::Documenter::BaseOperationDocumenter

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-resources/documenter/base_operation_documenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_requestSeahorse::Model::Operation? (readonly)

Returns the model of the API operation called. Returns ‘nil` if this operation does not make any API requests.

Returns:

  • (Seahorse::Model::Operation, nil)

    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_nameString? (readonly)

Returns the name of the API operation called on the client. Returns ‘nil` if this operation does not make any API requests.

Returns:

  • (String, nil)

    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_paramsArray<Resources::RequestParams::Base>? (readonly)

Returns the parameters this operation binds to the made request. Returns ‘nil` if this operation does not make a request.

Returns:

  • (Array<Resources::RequestParams::Base>, nil)

    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

#builderBuilder? (readonly)

Returns the resource builder for this operation. Returns ‘nil` if this operation does not build and return resource objects.

Returns:

  • (Builder, nil)

    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_operationString? (readonly)

Returns the ‘Client#operation_name` reference. This is useful for generating `@see` tags and `links`.

Returns:

  • (String, nil)

    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_nameString (readonly)

Returns The name of this resource operation.

Returns:

  • (String)

    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_classClass<Resource> (readonly)

Returns the resource class this operation belongs to.

Returns:

  • (Class<Resource>)

    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_nameString (readonly)

Returns the name of the resource class being documented without the namespace prefix. Example:

  • Aws::S3::Resource => ‘Resource’

  • Aws::S3::Bucket => ‘Bucket’

Returns:

  • (String)

    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

#sourceSource (readonly)

Returns:



81
82
83
# File 'lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 81

def source
  @source
end

#target_resource_classClass<Resource>? (readonly)

Returns the class of the resource returned by invoking this operation. Returns ‘nil` if this operation does not return any resource objects.

Returns:

  • (Class<Resource>, nil)

    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_nameString? (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.

Returns:

  • (String, nil)

    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_classYARD::CodeObject::ClassObject (readonly)

Returns:

  • (YARD::CodeObject::ClassObject)


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_objectYARD::CodeObject::MethodObject

Constructs and returns a new YARD method object for this operation.

Returns:

  • (YARD::CodeObject::MethodObject)


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/.+)')[1]
    m.add_file(filename, nil, true)
  end
  tags.each do |tag|
    m.add_tag(tag)
  end
  m
end