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

Inherits:
Object
  • Object
show all
Defined in:
aws-sdk-resources/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


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'aws-sdk-resources/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)


64
65
66
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 64

def api_request
  @api_request
end

#api_request_nameString? (readonly)


59
60
61
# File 'aws-sdk-resources/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)


69
70
71
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 69

def api_request_params
  @api_request_params
end

#builderBuilder? (readonly)


78
79
80
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 78

def builder
  @builder
end

#called_operationString? (readonly)


73
74
75
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 73

def called_operation
  @called_operation
end

#operation_nameString (readonly)


35
36
37
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 35

def operation_name
  @operation_name
end

#resource_classClass<Resource> (readonly)


32
33
34
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 32

def resource_class
  @resource_class
end

#resource_class_nameString (readonly)


43
44
45
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 43

def resource_class_name
  @resource_class_name
end

#sourceSource (readonly)


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

def source
  @source
end

#target_resource_classClass<Resource>? (readonly)


48
49
50
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 48

def target_resource_class
  @target_resource_class
end

#target_resource_class_nameString? (readonly)


54
55
56
# File 'aws-sdk-resources/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)


28
29
30
# File 'aws-sdk-resources/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.


85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'aws-sdk-resources/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
  tags.each do |tag|
    m.add_tag(tag)
  end
  m
end