--- server/libexec/views/docs/collection.xml.haml | 14 ++++++++++++++ server/libexec/views/docs/index.xml.haml | 5 +++++ server/libexec/views/docs/operation.xml.haml | 10 ++++++++++ 3 files changed, 29 insertions(+), 0 deletions(-) create mode 100644 server/libexec/views/docs/collection.xml.haml create mode 100644 server/libexec/views/docs/index.xml.haml create mode 100644 server/libexec/views/docs/operation.xml.haml
diff --git a/server/libexec/views/docs/collection.xml.haml b/server/libexec/views/docs/collection.xml.haml new file mode 100644 index 0000000..275bacc --- /dev/null +++ b/server/libexec/views/docs/collection.xml.haml @@ -0,0 +1,14 @@ +%docs{:status => "unsupported"} + %collection{:url => "/api/docs/#{@collection.name}", :name => "#{@collection.name}"} + %description #{@collection.description} + %operations + - @operations.keys.sort_by { |k| k.to_s }.each do |operation| + %operation{:url => "/api/docs/#{@collection.name.to_s}/#{operation}", :name => "#{operation}", :href => "/api/#{@collection.name.to_s}/#{operation}", :method => "#{@operations[operation].method}"} + %description #{@operations[operation].description} + - @operations[operation].params.each_key do |p| + %parameter{:name => "#{p}", :type => "#{@operations[operation].params[p][:type]}"} + %class #{@operations[operation].params[p][:class]} + - unless @operations[operation].params[p][:options].empty? + %values + - @operations[operation].params[p][:options].each do |v| + %value #{v} diff --git a/server/libexec/views/docs/index.xml.haml b/server/libexec/views/docs/index.xml.haml new file mode 100644 index 0000000..2210c8c --- /dev/null +++ b/server/libexec/views/docs/index.xml.haml @@ -0,0 +1,5 @@ +%docs{:status => "unsupported"} + - collections.keys.sort_by { |k| k.to_s }.each do |collection| + %collection{:url => "/api/docs/#{collection}"} + %name #{collection} + %description #{collections[collection].description} diff --git a/server/libexec/views/docs/operation.xml.haml b/server/libexec/views/docs/operation.xml.haml new file mode 100644 index 0000000..57f9775 --- /dev/null +++ b/server/libexec/views/docs/operation.xml.haml @@ -0,0 +1,10 @@ +%docs{:status => "unsupported"} + %operation{:url => "/api/docs/#{@collection.name.to_s}/#{@operation.name.to_s}", :name => "#{@operation.name.to_s}", :href => "/api/#{@collection.name.to_s}/#{@operation.name.to_s}", :method => "#{@operation.method}"} + %description #{@operation.description} + - @operation.params.each_key do |p| + %parameter{:name => "#{p}", :type => "#{@operation.params[p][:type]}"} + %class #{@operation.params[p][:class]} + - unless @operation.params[p][:options].empty? + %values + - @operation.params[p][:options].each do |v| + %value #{v}