apipie-rails 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +11 -0
- data/Gemfile.lock +4 -9
- data/README.rst +16 -14
- data/app/controllers/apipie/apipies_controller.rb +6 -1
- data/app/views/apipie/apipies/getting_started.html.erb +4 -0
- data/lib/apipie/application.rb +2 -2
- data/lib/apipie/extractor.rb +9 -8
- data/lib/apipie/resource_description.rb +4 -0
- data/lib/apipie/version.rb +1 -1
- metadata +18 -16
data/CHANGELOG
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
apipie-rails (0.0.
|
4
|
+
apipie-rails (0.0.14)
|
5
|
+
rails (>= 3.0.10)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: http://rubygems.org/
|
@@ -51,7 +52,6 @@ GEM
|
|
51
52
|
mime-types (1.19)
|
52
53
|
minitest (3.2.0)
|
53
54
|
multi_json (1.3.6)
|
54
|
-
oauth (0.4.6)
|
55
55
|
polyglot (0.3.3)
|
56
56
|
rack (1.4.1)
|
57
57
|
rack-cache (1.2)
|
@@ -78,8 +78,6 @@ GEM
|
|
78
78
|
rake (0.9.2.2)
|
79
79
|
rdoc (3.12)
|
80
80
|
json (~> 1.4)
|
81
|
-
rest-client (1.6.7)
|
82
|
-
mime-types (>= 1.16)
|
83
81
|
rspec (2.11.0)
|
84
82
|
rspec-core (~> 2.11.0)
|
85
83
|
rspec-expectations (~> 2.11.0)
|
@@ -101,10 +99,10 @@ GEM
|
|
101
99
|
syntax (1.0.0)
|
102
100
|
thor (0.15.4)
|
103
101
|
tilt (1.3.3)
|
104
|
-
treetop (1.4.
|
102
|
+
treetop (1.4.12)
|
105
103
|
polyglot
|
106
104
|
polyglot (>= 0.3.1)
|
107
|
-
tzinfo (0.3.
|
105
|
+
tzinfo (0.3.35)
|
108
106
|
|
109
107
|
PLATFORMS
|
110
108
|
ruby
|
@@ -114,9 +112,6 @@ DEPENDENCIES
|
|
114
112
|
apipie-rails!
|
115
113
|
maruku
|
116
114
|
minitest
|
117
|
-
oauth
|
118
|
-
rails (>= 3.0.10)
|
119
115
|
rake
|
120
|
-
rest-client
|
121
116
|
rspec-rails
|
122
117
|
sqlite3
|
data/README.rst
CHANGED
@@ -9,12 +9,12 @@ API. Instead of traditional use of ``#comments``, Apipie let's you
|
|
9
9
|
describe the code by code. This brings advantages like:
|
10
10
|
|
11
11
|
* no need to learn yet another syntax, you already know Ruby, right?
|
12
|
-
* possibility reuse the doc for other purposes (
|
12
|
+
* possibility reuse the doc for other purposes (such as validation)
|
13
13
|
* easier to extend and maintain (no string parsing involved)
|
14
14
|
* possibility to use other sources for documentation purposes (such as
|
15
15
|
routes etc.)
|
16
16
|
|
17
|
-
The
|
17
|
+
The documentation is available right in your app (by default under
|
18
18
|
``/apipie`` path. In development mode, you can see the changes as you
|
19
19
|
go. It's markup language agnostic and even provides an API for reusing
|
20
20
|
the documentation data in form of JSON.
|
@@ -48,7 +48,7 @@ use ``http://localhost:3000/apipie.json``.
|
|
48
48
|
|
49
49
|
For more comprehensive getting started guide, see
|
50
50
|
`this demo <https://github.com/iNecas/apipie-demo>`_, that includes
|
51
|
-
features
|
51
|
+
features such as generating documenation from tests, recording examples etc.
|
52
52
|
|
53
53
|
Screenshots
|
54
54
|
-----------
|
@@ -85,16 +85,16 @@ Apipie-rails is released under the `MIT License <http://opensource.org/licenses/
|
|
85
85
|
Resource Description
|
86
86
|
--------------------
|
87
87
|
|
88
|
-
You can describe a resource on controller level. The description is
|
89
|
-
``
|
88
|
+
You can describe a resource on controller level. The description is introduced by calling
|
89
|
+
``resource_description do ... end``.
|
90
90
|
|
91
|
-
Inheritance is supported, so you can specify common params for group of
|
91
|
+
Inheritance is supported, so you can specify common params for group of controllers in their parent
|
92
92
|
class.
|
93
93
|
|
94
94
|
The following keywords are available (all are optional):
|
95
95
|
|
96
96
|
resource_id
|
97
|
-
How will
|
97
|
+
How will the resource be referenced in Apipie (paths, ``see`` command etc.), by default `controller_name.downcase` is used.
|
98
98
|
|
99
99
|
name
|
100
100
|
Human readable name of resource. By default ``class.name.humanize`` is used.
|
@@ -103,10 +103,10 @@ short (also short_description)
|
|
103
103
|
Short description of the resource (it's shown on both list of resources and resource details)
|
104
104
|
|
105
105
|
desc (also description and full_description)
|
106
|
-
Full description of the resource (shown only
|
106
|
+
Full description of the resource (shown only in resource details)
|
107
107
|
|
108
108
|
param
|
109
|
-
Common params for all
|
109
|
+
Common params for all methods defined in controller/child controllers.
|
110
110
|
|
111
111
|
api_base_url
|
112
112
|
What url is the resource available under.
|
@@ -118,11 +118,11 @@ formats
|
|
118
118
|
request / response formats.
|
119
119
|
|
120
120
|
error
|
121
|
-
Describe
|
122
|
-
methods
|
121
|
+
Describe every possible error that can happen what calling all
|
122
|
+
methods defined in controller. HTTP response code and description can be provided.
|
123
123
|
|
124
124
|
app_info
|
125
|
-
In case of versioning, this
|
125
|
+
In case of versioning, this sets app info description on per_version basis.
|
126
126
|
|
127
127
|
Example:
|
128
128
|
~~~~~~~~
|
@@ -312,7 +312,9 @@ markup
|
|
312
312
|
processor.
|
313
313
|
|
314
314
|
layout
|
315
|
-
Name of a layout template to use instead of Apipie's layout. You can use
|
315
|
+
Name of a layout template to use instead of Apipie's layout. You can use
|
316
|
+
Apipie.include_stylesheets and Apipie.include_javascripts helpers to include
|
317
|
+
Apipie's stylesheets and javascripts.
|
316
318
|
|
317
319
|
ignored
|
318
320
|
An array of controller names (strings) (might include actions as well)
|
@@ -333,7 +335,7 @@ Example:
|
|
333
335
|
config.markup = Apipie::Markup::Markdown.new
|
334
336
|
config.reload_controllers = true
|
335
337
|
config.api_controllers_matcher = File.join(Rails.root, "app", "controllers", "**","*.rb")
|
336
|
-
config.app_info =
|
338
|
+
config.app_info = "
|
337
339
|
This is where you can inform user about your application and API
|
338
340
|
in general.
|
339
341
|
", '1.0'
|
@@ -13,7 +13,8 @@ module Apipie
|
|
13
13
|
respond_to do |format|
|
14
14
|
|
15
15
|
if Apipie.configuration.use_cache?
|
16
|
-
render_from_cache
|
16
|
+
render_from_cache
|
17
|
+
return
|
17
18
|
end
|
18
19
|
|
19
20
|
Apipie.reload_documentation if Apipie.configuration.reload_controllers?
|
@@ -24,6 +25,10 @@ module Apipie
|
|
24
25
|
end
|
25
26
|
|
26
27
|
format.html do
|
28
|
+
if @doc[:resources].blank?
|
29
|
+
render "getting_started" and return
|
30
|
+
end
|
31
|
+
|
27
32
|
@versions = Apipie.available_versions
|
28
33
|
@doc = @doc[:docs]
|
29
34
|
@resource = @doc[:resources].first if params[:resource].present?
|
data/lib/apipie/application.rb
CHANGED
@@ -281,8 +281,6 @@ module Apipie
|
|
281
281
|
Apipie.configuration.validate? || ! Apipie.configuration.use_cache? || Apipie.configuration.force_dsl?
|
282
282
|
end
|
283
283
|
|
284
|
-
private
|
285
|
-
|
286
284
|
def get_resource_name(klass)
|
287
285
|
if klass.class == String
|
288
286
|
klass
|
@@ -296,6 +294,8 @@ module Apipie
|
|
296
294
|
end
|
297
295
|
end
|
298
296
|
|
297
|
+
private
|
298
|
+
|
299
299
|
def get_resource_version(resource_description)
|
300
300
|
if resource_description.respond_to? :_version
|
301
301
|
resource_description._version
|
data/lib/apipie/extractor.rb
CHANGED
@@ -98,18 +98,19 @@ module Apipie
|
|
98
98
|
end
|
99
99
|
@apis_from_routes
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
:
|
101
|
+
resource_descriptions = Apipie.resource_descriptions.values.map(&:values).flatten
|
102
|
+
method_descriptions = resource_descriptions.map(&:method_descriptions).flatten
|
103
|
+
apis_from_docs = method_descriptions.reduce({}) do |h, desc|
|
104
|
+
apis = desc.method_apis_to_json.map do |api|
|
105
|
+
{ :method => api[:http_method],
|
106
|
+
:path => api[:api_url],
|
107
|
+
:desc => api[:short_description] }
|
107
108
|
end
|
108
|
-
h.update(
|
109
|
+
h.update(desc.id => apis)
|
109
110
|
end
|
110
111
|
|
111
112
|
@apis_from_routes.each do |(controller, action), new_apis|
|
112
|
-
method_key = "#{controller.constantize
|
113
|
+
method_key = "#{Apipie.get_resource_name(controller.constantize)}##{action}"
|
113
114
|
old_apis = apis_from_docs[method_key] || []
|
114
115
|
new_apis.each do |new_api|
|
115
116
|
new_api[:path].sub!(/\(\.:format\)$/,"")
|
data/lib/apipie/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-02-06 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &18498540 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.0.10
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *18498540
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rspec-rails
|
28
|
-
requirement: &
|
28
|
+
requirement: &18498120 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *18498120
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: sqlite3
|
39
|
-
requirement: &
|
39
|
+
requirement: &18497660 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *18497660
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: minitest
|
50
|
-
requirement: &
|
50
|
+
requirement: &18528000 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *18528000
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: maruku
|
61
|
-
requirement: &
|
61
|
+
requirement: &18527580 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *18527580
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: RedCloth
|
72
|
-
requirement: &
|
72
|
+
requirement: &18527160 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *18527160
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: rake
|
83
|
-
requirement: &
|
83
|
+
requirement: &18526740 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ! '>='
|
@@ -88,7 +88,7 @@ dependencies:
|
|
88
88
|
version: '0'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *18526740
|
92
92
|
description: Maintain your API documentation up to date!
|
93
93
|
email:
|
94
94
|
- pajkycz@gmail.com
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- .rvmrc
|
103
103
|
- .travis.yml
|
104
104
|
- APACHE-LICENSE-2.0
|
105
|
+
- CHANGELOG
|
105
106
|
- Gemfile
|
106
107
|
- Gemfile.lock
|
107
108
|
- MIT-LICENSE
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- app/views/apipie/apipies/_params.html.erb
|
124
125
|
- app/views/apipie/apipies/_params_plain.html.erb
|
125
126
|
- app/views/apipie/apipies/apipie_404.html.erb
|
127
|
+
- app/views/apipie/apipies/getting_started.html.erb
|
126
128
|
- app/views/apipie/apipies/index.html.erb
|
127
129
|
- app/views/apipie/apipies/method.html.erb
|
128
130
|
- app/views/apipie/apipies/plain.html.erb
|