Skip to content

Commit

Permalink
Now documenting the default API version for each service client inste…
Browse files Browse the repository at this point in the history
…ad of the oldest.

Fixes #490
  • Loading branch information
trevorrowe committed Apr 2, 2014
1 parent 2f94b46 commit 3ae27d4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions doc-src/api_docs_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.


require 'aws-sdk'
require 'yaml'

YARD::Templates::Engine.register_template_path(File.dirname(__FILE__) + '/templates')
Expand All @@ -21,7 +21,7 @@
if klass.name =~ /V\d{8}/
add_methods(klass, "doc-src/#{svc(klass)}/#{klass.name}.yml")
elsif klass.name == :Client && klass.path != 'AWS::Core::Client'
if doc_src = oldest_api_version(klass)
if doc_src = default_api_version(klass)
add_methods(klass, doc_src)
end
end
Expand All @@ -44,6 +44,8 @@ def svc(klass)
klass.path.split('::')[1]
end

def oldest_api_version(klass)
Dir.glob("doc-src/#{svc(klass)}/*.yml").sort.first
def default_api_version(klass)
klass_obj = klass.path.split('::').inject(Kernel) { |mod,const| mod.const_get(const) }
api_version = klass_obj::API_VERSION
"doc-src/#{svc(klass)}/V#{api_version.gsub('-', '')}.yml"
end

0 comments on commit 3ae27d4

Please sign in to comment.