apipie-rails 0.5.4 → 0.5.5
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.rst +4 -0
- data/app/controllers/apipie/apipies_controller.rb +1 -0
- data/app/views/apipie/apipies/index.html.erb +5 -1
- data/app/views/apipie/apipies/resource.html.erb +3 -0
- data/lib/apipie/dsl_definition.rb +7 -1
- data/lib/apipie/method_description.rb +1 -1
- data/lib/apipie/resource_description.rb +5 -2
- data/lib/apipie/version.rb +1 -1
- data/spec/lib/method_description_spec.rb +7 -0
- 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: 8915141fab6f8b930ebe4890f87cad11794dc480
|
4
|
+
data.tar.gz: 8e1fe85abcdc7e18817d6e03f0b0566b2d2bac2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a312452202fa6f494703fc5a4949b928bbc40bf541072b49f1107302cd96563d5351f6a0986a6c7406f1e7eaabda680da5f84b609108b3df1c3ec4c8245602f
|
7
|
+
data.tar.gz: 38bcb49374e3046661a2a4f5ce479e52225a0f1cd880388c069eb00dd2f9c4bf514a0e72cb5cfd1e38d2166ccf458639510026871fe5fad2254b4779d9f55d04
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Changelog
|
2
2
|
===========
|
3
3
|
|
4
|
+
v0.5.5
|
5
|
+
------
|
6
|
+
|
7
|
+
- prevent lang in url when config.translate is false [\##562](https://github.com/Apipie/apipie-rails/pull/562) ([markmoser](https://github.com/markmoser))
|
8
|
+
- Allow for resource-level deprecations [\##567](https://github.com/Apipie/apipie-rails/pull/567) ([cross-p6](https://github.com/cross-p6))
|
9
|
+
|
4
10
|
v0.5.4
|
5
11
|
------
|
6
12
|
|
data/README.rst
CHANGED
@@ -136,6 +136,9 @@ app_info
|
|
136
136
|
meta
|
137
137
|
Hash or array with custom metadata.
|
138
138
|
|
139
|
+
deprecated
|
140
|
+
Boolean value indicating if the resource is marked as deprecated. (Default false)
|
141
|
+
|
139
142
|
Example:
|
140
143
|
~~~~~~~~
|
141
144
|
|
@@ -154,6 +157,7 @@ Example:
|
|
154
157
|
error 500, "Server crashed for some <%= reason %>", :meta => {:anything => "you can think of"}
|
155
158
|
error :unprocessable_entity, "Could not save the entity."
|
156
159
|
meta :author => {:name => 'John', :surname => 'Doe'}
|
160
|
+
deprecated false
|
157
161
|
description <<-EOS
|
158
162
|
== Long description
|
159
163
|
Example resource for rest api documentation
|
@@ -16,7 +16,11 @@
|
|
16
16
|
<h2>
|
17
17
|
<a href='<%= api[:doc_url] %><%= @doc[:link_extension] %>'>
|
18
18
|
<%= api[:name] %>
|
19
|
-
</a
|
19
|
+
</a>
|
20
|
+
<% if api[:deprecated] %>
|
21
|
+
<code>DEPRECATED</code>
|
22
|
+
<% end %>
|
23
|
+
<br>
|
20
24
|
<small><%= api[:short_description] %></small>
|
21
25
|
</h2>
|
22
26
|
<table class='table'>
|
@@ -42,7 +42,8 @@ module Apipie
|
|
42
42
|
:formats => nil,
|
43
43
|
:api_versions => [],
|
44
44
|
:meta => nil,
|
45
|
-
:show => true
|
45
|
+
:show => true,
|
46
|
+
:deprecated => false
|
46
47
|
}
|
47
48
|
end
|
48
49
|
end
|
@@ -76,6 +77,11 @@ module Apipie
|
|
76
77
|
def app_info(app_info)
|
77
78
|
_apipie_dsl_data[:app_info] = app_info
|
78
79
|
end
|
80
|
+
|
81
|
+
def deprecated(value)
|
82
|
+
_apipie_dsl_data[:deprecated] = value
|
83
|
+
end
|
84
|
+
|
79
85
|
end
|
80
86
|
|
81
87
|
module Action
|
@@ -129,7 +129,7 @@ module Apipie
|
|
129
129
|
:api_url => create_api_url(api),
|
130
130
|
:http_method => api.http_method.to_s,
|
131
131
|
:short_description => Apipie.app.translate(api.short_description, lang),
|
132
|
-
:deprecated => api.options[:deprecated]
|
132
|
+
:deprecated => resource._deprecated || api.options[:deprecated]
|
133
133
|
}
|
134
134
|
end
|
135
135
|
end
|
@@ -10,11 +10,12 @@ module Apipie
|
|
10
10
|
# id - resouce name
|
11
11
|
# formats - acceptable request/response format types
|
12
12
|
# headers - array of headers
|
13
|
+
# deprecated - boolean indicating if resource is deprecated
|
13
14
|
class ResourceDescription
|
14
15
|
|
15
16
|
attr_reader :controller, :_short_description, :_full_description, :_methods, :_id,
|
16
17
|
:_path, :_name, :_params_args, :_errors_args, :_formats, :_parent, :_metadata,
|
17
|
-
:_headers
|
18
|
+
:_headers, :_deprecated
|
18
19
|
|
19
20
|
def initialize(controller, resource_name, dsl_data = nil, version = nil, &block)
|
20
21
|
|
@@ -42,6 +43,7 @@ module Apipie
|
|
42
43
|
@_metadata = dsl_data[:meta]
|
43
44
|
@_api_base_url = dsl_data[:api_base_url]
|
44
45
|
@_headers = dsl_data[:headers]
|
46
|
+
@_deprecated = dsl_data[:deprecated] || false
|
45
47
|
|
46
48
|
if dsl_data[:app_info]
|
47
49
|
Apipie.configuration.app_info[_version] = dsl_data[:app_info]
|
@@ -109,7 +111,8 @@ module Apipie
|
|
109
111
|
:formats => @_formats,
|
110
112
|
:metadata => @_metadata,
|
111
113
|
:methods => methods,
|
112
|
-
:headers => _headers
|
114
|
+
:headers => _headers,
|
115
|
+
:deprecated => @_deprecated
|
113
116
|
}
|
114
117
|
end
|
115
118
|
|
data/lib/apipie/version.rb
CHANGED
@@ -36,6 +36,13 @@ describe Apipie::MethodDescription do
|
|
36
36
|
method = Apipie::MethodDescription.new(:a, @resource, dsl_data)
|
37
37
|
expect(method.method_apis_to_json.first[:deprecated]).to eq(true)
|
38
38
|
end
|
39
|
+
|
40
|
+
it "should return the deprecated flag if resource is deprecated" do
|
41
|
+
@resource.instance_variable_set("@_deprecated", true)
|
42
|
+
dsl_data[:api_args] = [[:GET, "/foo/bar", "description", {}]]
|
43
|
+
method = Apipie::MethodDescription.new(:a, @resource, dsl_data)
|
44
|
+
expect(method.method_apis_to_json.first[:deprecated]).to eq(true)
|
45
|
+
end
|
39
46
|
end
|
40
47
|
|
41
48
|
describe "params descriptions" do
|
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.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pokorny
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|