class Aws::Api::Docs::OperationDocumenter
Public Class Methods
new(service_name, namespace)
click to toggle source
# File lib/aws-sdk-core/api/docs/operation_documenter.rb, line 9 def initialize(service_name, namespace) @service_name = service_name @namespace = namespace @optname = 'options' end
Public Instance Methods
document(method_name, operation)
click to toggle source
@param [Symbol] method_name @param [Seahorse::Model::Opeation] operation
# File lib/aws-sdk-core/api/docs/operation_documenter.rb, line 17 def document(method_name, operation) m = YARD::CodeObjects::MethodObject.new(@namespace, method_name) m.group = 'API Operations' m.scope = :instance m.parameters << [@optname, '{}'] m.docstring = operation.documentation tags(method_name, operation).each do |tag| m.add_tag(tag) end end
Private Instance Methods
examples_from_disk(method_name, operation)
click to toggle source
# File lib/aws-sdk-core/api/docs/operation_documenter.rb, line 101 def examples_from_disk(method_name, operation) dir = "examples/#{@service_name.downcase}/client/#{method_name}/*.rb" Dir.glob(dir).map do |path| title = File.basename(path).split(/\./).first title = title.sub(/^\d+_/, '').gsub(/_/, ' ') title = title[0].upcase + title[1..-1] tag("@example #{title}\n\n " + File.read(path).lines.join(' ')) end end
request_syntax_example(method_name, operation)
click to toggle source
# File lib/aws-sdk-core/api/docs/operation_documenter.rb, line 111 def request_syntax_example(method_name, operation) example = RequestSyntaxExample.new(method_name, operation).to_str parts = [] parts << "@example Request syntax with placeholder values\n\n" parts += example.lines.map { |line| " " + line } tag(parts.join) end
response_structure_example(method_name, operation)
click to toggle source
# File lib/aws-sdk-core/api/docs/operation_documenter.rb, line 119 def response_structure_example(method_name, operation) if example = ResponseStructureExample.new(method_name, operation).to_str parts = [] parts << "@example Response structure\n\n" parts += example.lines.map { |line| " " + line } tag(parts.join) end end