api_canon 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -15,7 +15,12 @@ If you're using bundler, then put this in your Gemfile:
15
15
  ```ruby
16
16
  gem 'api_canon'
17
17
  ```
18
- Then, in each controller you want to document, add the line
18
+ Add this to your routes.rb file:
19
+
20
+ ```ruby
21
+ ApiCanon::Routes.draw(self) # Or 'map' instead of 'self' for Rails 2
22
+ ```
23
+ Then, in each controller you want to document, add the line:
19
24
 
20
25
  ```ruby
21
26
  include ApiCanon
@@ -30,7 +35,7 @@ document_controller :as => 'optional_rename' do
30
35
  end
31
36
  ```
32
37
 
33
- That is optional, but reccomended, as it gives context to users of your API.
38
+ That is optional, but recommended, as it gives context to users of your API.
34
39
 
35
40
  More usefully you can document all the actions you want like this:
36
41
 
@@ -45,12 +50,6 @@ end
45
50
 
46
51
  To view the api documentation, visit the documented controller's index action with '.html' as the format.
47
52
 
48
- To enable the 'test' button on the generated documentation pages, you'll need to add this to your config/routes.rb file:
49
-
50
- ```ruby
51
- ApiCanon::Routes.draw(self) # Or 'map' instead of 'self' for Rails 2
52
- ```
53
-
54
53
  ## Examples
55
54
 
56
55
  ### Standard Rails actions
@@ -1,6 +1,6 @@
1
1
  module ApiCanon
2
2
  module ApiCanonViewHelper
3
- if Rails.version.starts_with?('2')
3
+ if ::Rails.version.starts_with?('2')
4
4
  def content_for?(content_partial_name)
5
5
  instance_variable_get("@content_for_#{content_partial_name}")
6
6
  end
@@ -28,7 +28,7 @@ module ApiCanon
28
28
  # which renders the ApiCanon documentation if params[:format] is html, and defaults
29
29
  # to the existing method otherwise.
30
30
  def index
31
- if params[:format].blank? || params[:format] == 'html'
31
+ if request.format.html?
32
32
  api_canon_docs
33
33
  else
34
34
  super
@@ -1,3 +1,3 @@
1
1
  module ApiCanon
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
File without changes
@@ -1,6 +1,12 @@
1
1
  # Configure Rails Environment
2
2
  ENV["RAILS_ENV"] = "test"
3
- require 'rails'
3
+ require 'bundler'
4
+ Bundler.setup
5
+ class Rails
6
+ def self.version
7
+ '2.3.17'
8
+ end
9
+ end
4
10
  require 'singleton'
5
11
  require 'action_controller'
6
12
  require 'api_canon'
metadata CHANGED
@@ -1,82 +1,95 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: api_canon
3
- version: !ruby/object:Gem::Version
4
- version: 0.3.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 1
10
+ version: 0.3.1
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - Cameron Walsh
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
- date: 2013-05-30 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-07-22 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
14
21
  name: rails
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: 2.3.17
20
- type: :runtime
21
22
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: 2.3.17
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
31
26
  - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 2.13.0
34
- type: :development
27
+ - !ruby/object:Gem::Version
28
+ hash: 5
29
+ segments:
30
+ - 2
31
+ - 3
32
+ version: "2.3"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: rspec
35
37
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
38
41
  - - ~>
39
- - !ruby/object:Gem::Version
42
+ - !ruby/object:Gem::Version
43
+ hash: 59
44
+ segments:
45
+ - 2
46
+ - 13
47
+ - 0
40
48
  version: 2.13.0
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
49
  type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: rake
49
53
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: yard
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
62
63
  type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: yard
63
67
  prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ type: :development
78
+ version_requirements: *id004
69
79
  description: |-
70
80
  api_canon is a declarative documentation generator
71
81
  for APIs. Declare the parameters and response codes,
72
82
  describe them, and give some example values. api_canon
73
83
  handles the rest for you.
74
- email:
84
+ email:
75
85
  - cameron.walsh@gmail.com
76
86
  executables: []
87
+
77
88
  extensions: []
89
+
78
90
  extra_rdoc_files: []
79
- files:
91
+
92
+ files:
80
93
  - app/views/api_canon/api_canon.html.erb
81
94
  - app/views/api_canon/_form.html.erb
82
95
  - app/views/api_canon/_api_canon.html.erb
@@ -101,35 +114,45 @@ files:
101
114
  - spec/lib/api_canon/documented_param_spec.rb
102
115
  - spec/lib/api_canon/documented_action_spec.rb
103
116
  - spec/lib/api_canon_spec.rb
104
- - spec/dummy/log/test.log
117
+ - spec/internal/log/test.log
105
118
  homepage: http://github.com/cwalsh/api_canon
106
- licenses:
119
+ licenses:
107
120
  - MIT
108
- metadata: {}
109
121
  post_install_message:
110
122
  rdoc_options: []
111
- require_paths:
123
+
124
+ require_paths:
112
125
  - app
113
126
  - lib
114
- required_ruby_version: !ruby/object:Gem::Requirement
115
- requirements:
116
- - - '>='
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- required_rubygems_version: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - '>='
122
- - !ruby/object:Gem::Version
123
- version: '0'
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
135
+ version: "0"
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ hash: 3
142
+ segments:
143
+ - 0
144
+ version: "0"
124
145
  requirements: []
146
+
125
147
  rubyforge_project:
126
- rubygems_version: 2.0.3
148
+ rubygems_version: 1.8.24
127
149
  signing_key:
128
- specification_version: 4
150
+ specification_version: 3
129
151
  summary: Declarative documentation generator for APIs.
130
- test_files:
152
+ test_files:
131
153
  - spec/spec_helper.rb
132
154
  - spec/lib/api_canon/documented_param_spec.rb
133
155
  - spec/lib/api_canon/documented_action_spec.rb
134
156
  - spec/lib/api_canon_spec.rb
135
- - spec/dummy/log/test.log
157
+ - spec/internal/log/test.log
158
+ has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 015c10ce864e09df6f0aafddd61441588d89c016
4
- data.tar.gz: 283d2444de9b879f4f435a466ddeb8ff9f8e7cd3
5
- SHA512:
6
- metadata.gz: 43326d08ee1eeb4aaa3705672114b1421bb566f33dfb5992651a21b2473cd7a54bf82626b2a8a6594f3f0950cdf808d977f706078e8cea7ab48cef2b5614e5d0
7
- data.tar.gz: 4c5cfb283e87a533c01b39d7c00cc6b4a49859f4809a24abbda6a1c43016dbffb42016f02f38a20760fd8826fc2fd1d2db7f48ed3c7500e7e335cdd8f546fc61