api_canon 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/app/views/api_canon/_api_canon.html.erb +4 -1
- data/lib/api_canon/document.rb +4 -1
- data/lib/api_canon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c187459fb3312f6a298e12416a51499ce9f5c60a
|
4
|
+
data.tar.gz: 88a9d06fddf3b3f413dce2e93c93ce5922927fe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1347370f6ee8ae03530a0c343100b3ea2cc5a92e6cd9b3ba2016744f735db4b6069c247ae254213051bb2e5559c7e44b08be4f1ff8ba16ea099009bd0e80874a
|
7
|
+
data.tar.gz: de9d214e7053256806977ca2e73a4b3a89263fb59baf030b35cccf0a959e8d77078f66df2e3ca5af7f76155472a457312b23769bb2d30453c225aaa8ce6aa71f
|
data/README.md
CHANGED
@@ -6,9 +6,11 @@ Because API documentation should show you, not tell you.
|
|
6
6
|
|
7
7
|
## Introduction
|
8
8
|
API Canon is a tool for programatically documenting Ruby on Rails APIs with example usage.
|
9
|
-
It supports Rails 2, 3 and 4. You can see a real live example at
|
9
|
+
It supports Rails 2 (see the Rails2 branch, api_canon versions less than 0.4), 3 and 4. You can see a real live example at
|
10
10
|
[http://www.westfield.com.au/api/product/latest/categories](http://www.westfield.com.au/api/product/latest/categories)
|
11
11
|
|
12
|
+
As of 0.4.1, api_canon now supports [https://developers.helloreverb.com/swagger/](Swagger) json output, but only supports Rails 3+.
|
13
|
+
|
12
14
|
## Installation and usage
|
13
15
|
If you're using bundler, then put this in your Gemfile:
|
14
16
|
|
@@ -30,6 +32,7 @@ include ApiCanon
|
|
30
32
|
|
31
33
|
```ruby
|
32
34
|
document_controller :as => 'optional_rename' do
|
35
|
+
link_path '/foo' #Optionally override the sidebar link.
|
33
36
|
describe %Q{The actions here are awesome, they allow you to get a list of
|
34
37
|
awesome things, and make awesome things, too!}
|
35
38
|
end
|
@@ -144,3 +147,6 @@ Right now, api_canon is changing a lot. I plan to support the following feature
|
|
144
147
|
3. Pull request
|
145
148
|
4. ???
|
146
149
|
5. Profit.
|
150
|
+
|
151
|
+
# License
|
152
|
+
See MIT-LICENSE.
|
@@ -65,7 +65,10 @@
|
|
65
65
|
<% content_for :sidebar do %>
|
66
66
|
<ul class='nav nav-list'>
|
67
67
|
<% ApiCanon::DocumentationStore.instance.docos.each do |key, doco| %>
|
68
|
-
<li
|
68
|
+
<li>
|
69
|
+
<%- doco_link = doco.sidebar_link || url_for(:controller => doco.controller_path, :action => :index, :format => :html) -%>
|
70
|
+
<%= link_to doco.display_name, doco_link %>
|
71
|
+
</li>
|
69
72
|
<% end %>
|
70
73
|
</ul>
|
71
74
|
<% end %>
|
data/lib/api_canon/document.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module ApiCanon
|
2
2
|
class Document
|
3
3
|
include ActiveModel::Serialization
|
4
|
-
attr_reader :description, :controller_path, :controller_name, :version
|
4
|
+
attr_reader :description, :controller_path, :controller_name, :version, :sidebar_link
|
5
5
|
attr_accessor :documented_actions
|
6
6
|
def initialize(controller_path, controller_name, opts={})
|
7
7
|
@controller_path = controller_path
|
@@ -17,6 +17,9 @@ module ApiCanon
|
|
17
17
|
def describe(desc)
|
18
18
|
@description = desc
|
19
19
|
end
|
20
|
+
def link_path(link)
|
21
|
+
@sidebar_link = link
|
22
|
+
end
|
20
23
|
def display_name
|
21
24
|
@display_name || @controller_name.titleize
|
22
25
|
end
|
data/lib/api_canon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_canon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Walsh
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|