apipie-rails 0.4.0 → 0.5.0
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/.travis.yml +5 -4
- data/CHANGELOG.md +10 -0
- data/{Gemfile.rails40 → Gemfile.rails51} +2 -2
- data/apipie-rails.gemspec +2 -3
- data/app/controllers/apipie/apipies_controller.rb +7 -3
- data/config/locales/ja.yml +31 -0
- data/lib/apipie-rails.rb +1 -0
- data/lib/apipie/application.rb +2 -2
- data/lib/apipie/dsl_definition.rb +1 -1
- data/lib/apipie/extractor.rb +1 -1
- data/lib/apipie/extractor/recorder.rb +2 -6
- data/lib/apipie/extractor/writer.rb +18 -13
- data/lib/apipie/version.rb +1 -1
- data/spec/controllers/concerns_controller_spec.rb +1 -1
- data/spec/controllers/users_controller_spec.rb +27 -23
- data/spec/dummy/app/controllers/concerns/sample_controller.rb +5 -5
- data/spec/dummy/app/controllers/users_controller.rb +10 -10
- data/spec/dummy/config/initializers/apipie.rb +1 -1
- data/spec/spec_helper.rb +3 -8
- metadata +7 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f1836e9d470aab5a5fd2592c5bd020670d7644f
|
|
4
|
+
data.tar.gz: 915e53c2aed478f60375817066e059dc0b955e66
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc7d88e8c09ada1e11c86ce87e2535876c9c553532eb4ef07b66b862583308352e80ca47c2e656a43e85a9764725cea834c46bc20e5eae6321364509b5f9e21f
|
|
7
|
+
data.tar.gz: c6580080b5dc965477997baba13787948d2c749657156a02ab771a2890adab3195f04791fa736f832cdc4c1c20b6f4157edddace1441e7e453a87fe23c2126d2
|
data/.travis.yml
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
sudo: false
|
|
3
3
|
rvm:
|
|
4
|
-
- 1.9.3
|
|
5
4
|
- 2.0.0
|
|
6
5
|
- 2.1.7
|
|
7
6
|
- 2.2.3
|
|
8
7
|
- 2.3.3
|
|
9
8
|
gemfile:
|
|
10
|
-
- Gemfile.rails40
|
|
11
9
|
- Gemfile.rails41
|
|
12
10
|
- Gemfile.rails42
|
|
13
11
|
- Gemfile.rails50 # Min ruby 2.2.2
|
|
12
|
+
- Gemfile.rails51 # Min ruby 2.2.2
|
|
14
13
|
matrix:
|
|
15
14
|
exclude:
|
|
16
|
-
- rvm: 1.9.3
|
|
17
|
-
gemfile: Gemfile.rails50
|
|
18
15
|
- rvm: 2.0.0
|
|
19
16
|
gemfile: Gemfile.rails50
|
|
17
|
+
- rvm: 2.0.0
|
|
18
|
+
gemfile: Gemfile.rails51
|
|
20
19
|
- rvm: 2.1.7
|
|
21
20
|
gemfile: Gemfile.rails50
|
|
21
|
+
- rvm: 2.1.7
|
|
22
|
+
gemfile: Gemfile.rails51
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
Changelog
|
|
3
3
|
===========
|
|
4
4
|
|
|
5
|
+
v0.5.0
|
|
6
|
+
------
|
|
7
|
+
|
|
8
|
+
- Fix Rails 5.1 deprecations [\#530](https://github.com/Apipie/apipie-rails/pull/530) ([@Onumis](https://github.com/Onumis) [@sedx](https://github.com/sedx))
|
|
9
|
+
- **This release is no longer compatible with Ruby 1.9.x**
|
|
10
|
+
- Do not mutate strings passed as config options, fixes \#461 [\#537](https://github.com/Apipie/apipie-rails/pull/537) ([samphilipd](https://github.com/samphilipd))
|
|
11
|
+
- Added recursion for documentation, fixed bug in examples with paperclip [\#531](https://github.com/Apipie/apipie-rails/pull/531) ([blddmnd](https://github.com/blddmnd))
|
|
12
|
+
- Added locales/ja.yml for Japanese [\#529](https://github.com/Apipie/apipie-rails/pull/529) ([kikuchi0808](https://github.com/kikuchi0808))
|
|
13
|
+
|
|
14
|
+
|
|
5
15
|
v0.4.0
|
|
6
16
|
------
|
|
7
17
|
|
data/apipie-rails.gemspec
CHANGED
|
@@ -10,14 +10,13 @@ Gem::Specification.new do |s|
|
|
|
10
10
|
s.homepage = "http://github.com/Apipie/apipie-rails"
|
|
11
11
|
s.summary = %q{Rails REST API documentation tool}
|
|
12
12
|
s.description = %q{Rails REST API documentation tool}
|
|
13
|
-
|
|
13
|
+
s.required_ruby_version = '>= 2.0.0'
|
|
14
14
|
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
17
17
|
s.require_paths = ["lib"]
|
|
18
18
|
|
|
19
|
-
s.add_dependency "rails", ">= 4.
|
|
20
|
-
s.add_dependency 'json'
|
|
19
|
+
s.add_dependency "rails", ">= 4.1"
|
|
21
20
|
s.add_development_dependency "rspec-rails", "~> 3.0"
|
|
22
21
|
s.add_development_dependency "sqlite3"
|
|
23
22
|
s.add_development_dependency "minitest"
|
|
@@ -114,9 +114,13 @@ module Apipie
|
|
|
114
114
|
|
|
115
115
|
def get_format
|
|
116
116
|
[:resource, :method, :version].each do |par|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
next unless params[par]
|
|
118
|
+
[:html, :json].each do |format|
|
|
119
|
+
extension = ".#{format}"
|
|
120
|
+
if params[par].include?(extension)
|
|
121
|
+
params[par] = params[par].sub(extension, '')
|
|
122
|
+
params[:format] = format
|
|
123
|
+
end
|
|
120
124
|
end
|
|
121
125
|
end
|
|
122
126
|
request.format = params[:format] if params[:format]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
ja:
|
|
2
|
+
apipie:
|
|
3
|
+
resources: "リソース"
|
|
4
|
+
resource: "リソース"
|
|
5
|
+
description: "記述"
|
|
6
|
+
no_docs_found: "ドキュメントが見つかりませんでした。"
|
|
7
|
+
no_docs_found_descr: "あなたのAPIにあう資料が見つかりませんでした。"
|
|
8
|
+
follow_instructions_html: "コントローラーをどう説明するのか%{href}を参考にしてください。"
|
|
9
|
+
follow_instructions_href: "具体的な説明"
|
|
10
|
+
oops: "おっと!"
|
|
11
|
+
resource_not_found_html: "リソース%{resource}が見つかりませんでした。"
|
|
12
|
+
method_not_found_html: "リソース%{resource}のためのメソッド%{method}が見つかりませんでした。 ."
|
|
13
|
+
goto_homepage_html: "%{href}へ移ります。"
|
|
14
|
+
goto_homepage_href: "%{app_name}APIドキュメントのホームページ"
|
|
15
|
+
required: "必須"
|
|
16
|
+
optional: "任意"
|
|
17
|
+
nil_allowed: "nil可"
|
|
18
|
+
param_name: "パラメーター名"
|
|
19
|
+
params: "パラメーター"
|
|
20
|
+
examples: "例"
|
|
21
|
+
metadata: "メタデータ"
|
|
22
|
+
errors: "エラー"
|
|
23
|
+
error_code: "エラーコード"
|
|
24
|
+
error_description: "エラー説明"
|
|
25
|
+
error_metadata: "エラーメタデータ"
|
|
26
|
+
supported_formats: "サポートフォーマット"
|
|
27
|
+
enable_javascript_html: "%{comments_href}のJavaScriptをオンにしてください。"
|
|
28
|
+
comments_powered_by_disqus: "%{disqus}によるコメント"
|
|
29
|
+
api_documentation: "APIドキュメント"
|
|
30
|
+
headers: "ヘッダー"
|
|
31
|
+
header_name: "ヘッダー名"
|
data/lib/apipie-rails.rb
CHANGED
data/lib/apipie/application.rb
CHANGED
|
@@ -424,10 +424,10 @@ module Apipie
|
|
|
424
424
|
# as this would break loading of the controllers.
|
|
425
425
|
def rails_mark_classes_for_reload
|
|
426
426
|
unless Rails.application.config.cache_classes
|
|
427
|
-
|
|
427
|
+
Rails.application.reloader.reload!
|
|
428
428
|
init_env
|
|
429
429
|
reload_examples
|
|
430
|
-
|
|
430
|
+
Rails.application.reloader.prepare!
|
|
431
431
|
end
|
|
432
432
|
end
|
|
433
433
|
|
|
@@ -237,7 +237,7 @@ module Apipie
|
|
|
237
237
|
# Only allow params passed in that are defined keys in the api
|
|
238
238
|
# Auto skip the default params (format, controller, action)
|
|
239
239
|
if Apipie.configuration.validate_key?
|
|
240
|
-
params.reject{|k,_| %w[format controller action].include?(k.to_s) }.
|
|
240
|
+
params.reject{|k,_| %w[format controller action].include?(k.to_s) }.each_pair do |param, _|
|
|
241
241
|
# params allowed
|
|
242
242
|
raise UnknownParam.new(param) if method_params.select {|_,p| p.name.to_s == param.to_s}.empty?
|
|
243
243
|
end
|
data/lib/apipie/extractor.rb
CHANGED
|
@@ -17,7 +17,7 @@ class Apipie::Railtie
|
|
|
17
17
|
end
|
|
18
18
|
app.middleware.use ::Apipie::Extractor::Recorder::Middleware
|
|
19
19
|
ActionController::TestCase::Behavior.instance_eval do
|
|
20
|
-
|
|
20
|
+
prepend Apipie::Extractor::Recorder::FunctionalTestRecording
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
|
@@ -145,12 +145,8 @@ module Apipie
|
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
module FunctionalTestRecording
|
|
148
|
-
def
|
|
149
|
-
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
def process_with_api_recording(*args) # action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
|
|
153
|
-
ret = process_without_api_recording(*args)
|
|
148
|
+
def process(*args) # action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
|
|
149
|
+
ret = super(*args)
|
|
154
150
|
if Apipie.configuration.record
|
|
155
151
|
Apipie::Extractor.call_recorder.analyze_functional_test(self)
|
|
156
152
|
Apipie::Extractor.call_finished
|
|
@@ -78,21 +78,26 @@ module Apipie
|
|
|
78
78
|
%w[title verb path versions query request_data response_data code show_in_doc recorded].each do |k|
|
|
79
79
|
next unless call.has_key?(k)
|
|
80
80
|
ordered_call[k] = case call[k]
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
end
|
|
88
|
-
JSON.parse(call[k].to_json) # to_hash doesn't work recursively and I'm too lazy to write the recursion:)
|
|
89
|
-
else
|
|
90
|
-
call[k]
|
|
91
|
-
end
|
|
92
|
-
end
|
|
81
|
+
when ActiveSupport::HashWithIndifferentAccess
|
|
82
|
+
convert_file_value(call[k]).to_hash
|
|
83
|
+
else
|
|
84
|
+
call[k]
|
|
85
|
+
end
|
|
86
|
+
end
|
|
93
87
|
return ordered_call
|
|
94
88
|
end
|
|
95
89
|
|
|
90
|
+
def convert_file_value hash
|
|
91
|
+
hash.each do |k, v|
|
|
92
|
+
if (v.is_a?(Rack::Test::UploadedFile) || v.is_a?(ActionDispatch::Http::UploadedFile))
|
|
93
|
+
hash[k] = "<FILE CONTENT '#{v.original_filename}'>"
|
|
94
|
+
elsif v.is_a?(Hash)
|
|
95
|
+
hash[k] = convert_file_value(v)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
hash
|
|
99
|
+
end
|
|
100
|
+
|
|
96
101
|
def load_recorded_examples
|
|
97
102
|
self.class.load_recorded_examples
|
|
98
103
|
end
|
|
@@ -131,7 +136,7 @@ module Apipie
|
|
|
131
136
|
new_example[:title] ||= old_example["title"] if old_example["title"].present?
|
|
132
137
|
end
|
|
133
138
|
new_example
|
|
134
|
-
end
|
|
139
|
+
end
|
|
135
140
|
end
|
|
136
141
|
|
|
137
142
|
def load_new_examples
|
data/lib/apipie/version.rb
CHANGED
|
@@ -13,7 +13,7 @@ describe ConcernsController do
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it "should pass if required parameter is missing" do
|
|
16
|
-
expect { get :show, :id => '5' }.not_to raise_error
|
|
16
|
+
expect { get :show, :params => { :id => '5' } }.not_to raise_error
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
it "peserved the order of methods being defined in file" do
|
|
@@ -71,7 +71,7 @@ describe UsersController do
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
it "should pass if required parameter is missing" do
|
|
74
|
-
expect { get :show, :id => 5 }.not_to raise_error
|
|
74
|
+
expect { get :show, :params => { :id => 5 } }.not_to raise_error
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
end
|
|
@@ -205,7 +205,7 @@ describe UsersController do
|
|
|
205
205
|
end
|
|
206
206
|
|
|
207
207
|
it "should work with Hash validator" do
|
|
208
|
-
post :create, :user => { :name => "root", :pass => "12345", :membership => "standard" }
|
|
208
|
+
post :create, params: { :user => { :name => "root", :pass => "12345", :membership => "standard" } }
|
|
209
209
|
assert_response :success
|
|
210
210
|
|
|
211
211
|
a = Apipie[UsersController, :create]
|
|
@@ -219,18 +219,18 @@ describe UsersController do
|
|
|
219
219
|
hash_params[2].name == :membership
|
|
220
220
|
|
|
221
221
|
expect {
|
|
222
|
-
post :create, :user => { :name => "root", :pass => "12345", :membership => "____" }
|
|
222
|
+
post :create, :params => { :user => { :name => "root", :pass => "12345", :membership => "____" } }
|
|
223
223
|
}.to raise_error(Apipie::ParamInvalid, /membership/)
|
|
224
224
|
|
|
225
225
|
expect {
|
|
226
|
-
post :create, :user => { :name => "root" }
|
|
226
|
+
post :create, :params => { :user => { :name => "root" } }
|
|
227
227
|
}.to raise_error(Apipie::ParamMissing, /pass/)
|
|
228
228
|
|
|
229
229
|
expect {
|
|
230
|
-
post :create, :user => "a string is not a hash"
|
|
230
|
+
post :create, :params => { :user => "a string is not a hash" }
|
|
231
231
|
}.to raise_error(Apipie::ParamInvalid, /user/)
|
|
232
232
|
|
|
233
|
-
post :create, :user => { :name => "root", :pass => "pwd" }
|
|
233
|
+
post :create, :params => { :user => { :name => "root", :pass => "pwd" } }
|
|
234
234
|
assert_response :success
|
|
235
235
|
end
|
|
236
236
|
|
|
@@ -251,23 +251,27 @@ describe UsersController do
|
|
|
251
251
|
|
|
252
252
|
it "should allow nil when allow_nil is set to true" do
|
|
253
253
|
post :create,
|
|
254
|
-
:
|
|
255
|
-
:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
254
|
+
:params => {
|
|
255
|
+
:user => {
|
|
256
|
+
:name => "root",
|
|
257
|
+
:pass => "12345",
|
|
258
|
+
:membership => "standard",
|
|
259
|
+
},
|
|
260
|
+
:facts => { :test => 'test' }
|
|
261
|
+
}
|
|
260
262
|
assert_response :success
|
|
261
263
|
end
|
|
262
264
|
|
|
263
265
|
it "should allow blank when allow_blank is set to true" do
|
|
264
266
|
post :create,
|
|
265
|
-
:
|
|
266
|
-
:
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
267
|
+
:params => {
|
|
268
|
+
:user => {
|
|
269
|
+
:name => "root",
|
|
270
|
+
:pass => "12345",
|
|
271
|
+
:membership => "standard"
|
|
272
|
+
},
|
|
273
|
+
:age => ""
|
|
274
|
+
}
|
|
271
275
|
assert_response :success
|
|
272
276
|
end
|
|
273
277
|
|
|
@@ -276,7 +280,7 @@ describe UsersController do
|
|
|
276
280
|
context "with valid input" do
|
|
277
281
|
it "should succeed" do
|
|
278
282
|
put :update,
|
|
279
|
-
{
|
|
283
|
+
:params => {
|
|
280
284
|
:id => 5,
|
|
281
285
|
:user => {
|
|
282
286
|
:name => "root",
|
|
@@ -319,7 +323,7 @@ describe UsersController do
|
|
|
319
323
|
end
|
|
320
324
|
it "should work with empty array" do
|
|
321
325
|
put :update,
|
|
322
|
-
{
|
|
326
|
+
:params => {
|
|
323
327
|
:id => 5,
|
|
324
328
|
:user => {
|
|
325
329
|
:name => "root",
|
|
@@ -567,7 +571,7 @@ describe UsersController do
|
|
|
567
571
|
:expected_type=>"string"},
|
|
568
572
|
{:required=>true,
|
|
569
573
|
:allow_nil => false,
|
|
570
|
-
:allow_blank => false,
|
|
574
|
+
:allow_blank => false,
|
|
571
575
|
:validator=>"Must be a String",
|
|
572
576
|
:description=>"\n<p>Password for login</p>\n",
|
|
573
577
|
:name=>"apassword", :full_name=>"resource_param[apassword]",
|
|
@@ -709,13 +713,13 @@ EOS2
|
|
|
709
713
|
end
|
|
710
714
|
|
|
711
715
|
it "process correctly the parameters" do
|
|
712
|
-
post :create, :user => {:name => 'dummy', :pass => 'dummy', :membership => 'standard' }, :facts => {:test => 'test'}
|
|
716
|
+
post :create, :params => {:user => {:name => 'dummy', :pass => 'dummy', :membership => 'standard' }, :facts => {:test => 'test'}}
|
|
713
717
|
|
|
714
718
|
expect(assigns(:api_params).with_indifferent_access).to eq({:user => {:name=>"dummy", :pass=>"dummy", :membership=>"standard"}, :facts => {:test => 'test'}}.with_indifferent_access)
|
|
715
719
|
end
|
|
716
720
|
|
|
717
721
|
it "ignore not described parameters" do
|
|
718
|
-
post :create, {:user => {:name => 'dummy', :pass => 'dummy', :membership => 'standard', :id => 0}}
|
|
722
|
+
post :create, :params => {:user => {:name => 'dummy', :pass => 'dummy', :membership => 'standard', :id => 0}}
|
|
719
723
|
|
|
720
724
|
expect(assigns(:api_params).with_indifferent_access).to eq({:user => {:name=>"dummy", :pass=>"dummy", :membership=>"standard"}}.with_indifferent_access)
|
|
721
725
|
end
|
|
@@ -4,13 +4,13 @@ module Concerns
|
|
|
4
4
|
|
|
5
5
|
api!
|
|
6
6
|
def index
|
|
7
|
-
render :
|
|
7
|
+
render :plain => "OK #{params.inspect}"
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
api :GET, '/:resource_id/:id'
|
|
11
11
|
param :id, String
|
|
12
12
|
def show
|
|
13
|
-
render :
|
|
13
|
+
render :plain => "OK #{params.inspect}"
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def_param_group :concern do
|
|
@@ -23,19 +23,19 @@ module Concerns
|
|
|
23
23
|
api :POST, '/:resource_id', "Create a :concern"
|
|
24
24
|
param_group :concern
|
|
25
25
|
def create
|
|
26
|
-
render :
|
|
26
|
+
render :plain => "OK #{params.inspect}"
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
api :PUT, '/:resource_id/:id'
|
|
30
30
|
param :id, String
|
|
31
31
|
param_group :concern
|
|
32
32
|
def update
|
|
33
|
-
render :
|
|
33
|
+
render :plain => "OK #{params.inspect}"
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
api :GET, '/:resource_id/:custom_subst'
|
|
37
37
|
def custom
|
|
38
|
-
render :
|
|
38
|
+
render :plain => "OK #{params.inspect}"
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -192,15 +192,15 @@ class UsersController < ApplicationController
|
|
|
192
192
|
end
|
|
193
193
|
def show
|
|
194
194
|
unless params[:session] == "secret_hash"
|
|
195
|
-
render :
|
|
195
|
+
render :plain => "Not authorized", :status => 401
|
|
196
196
|
return
|
|
197
197
|
end
|
|
198
198
|
|
|
199
199
|
unless params[:id].to_i == 5
|
|
200
|
-
render :
|
|
200
|
+
render :plain => "Not Found", :status => 404 and return
|
|
201
201
|
end
|
|
202
202
|
|
|
203
|
-
render :
|
|
203
|
+
render :plain => "OK"
|
|
204
204
|
end
|
|
205
205
|
|
|
206
206
|
def_param_group :credentials do
|
|
@@ -223,7 +223,7 @@ class UsersController < ApplicationController
|
|
|
223
223
|
param :facts, Hash, :desc => "Additional optional facts about the user", :allow_nil => true
|
|
224
224
|
param :age, :number, :desc => "Age is just a number", :allow_blank => true
|
|
225
225
|
def create
|
|
226
|
-
render :
|
|
226
|
+
render :plain => "OK #{params.inspect}"
|
|
227
227
|
end
|
|
228
228
|
|
|
229
229
|
api :PUT, "/users/:id", "Update an user"
|
|
@@ -232,13 +232,13 @@ class UsersController < ApplicationController
|
|
|
232
232
|
param :comment, String
|
|
233
233
|
end
|
|
234
234
|
def update
|
|
235
|
-
render :
|
|
235
|
+
render :plain => "OK #{params.inspect}"
|
|
236
236
|
end
|
|
237
237
|
|
|
238
238
|
api :POST, "/users/admin", "Create admin user"
|
|
239
239
|
param_group :user, :as => :create
|
|
240
240
|
def admin_create
|
|
241
|
-
render :
|
|
241
|
+
render :plain => "OK #{params.inspect}"
|
|
242
242
|
end
|
|
243
243
|
|
|
244
244
|
api :GET, "/users", "List users"
|
|
@@ -248,14 +248,14 @@ class UsersController < ApplicationController
|
|
|
248
248
|
param :oauth, nil,
|
|
249
249
|
:desc => "Hide this global param (eg dont need auth here)"
|
|
250
250
|
def index
|
|
251
|
-
render :
|
|
251
|
+
render :plain => "List of users"
|
|
252
252
|
end
|
|
253
253
|
|
|
254
254
|
api :GET, '/company_users', 'Get company users'
|
|
255
255
|
api :GET, '/company/:id/users', 'Get users working in given company'
|
|
256
256
|
param :id, Integer, :desc => "Company ID"
|
|
257
257
|
def two_urls
|
|
258
|
-
render :
|
|
258
|
+
render :plain => 'List of users'
|
|
259
259
|
end
|
|
260
260
|
|
|
261
261
|
api :GET, '/users/see_another', 'Boring method'
|
|
@@ -264,14 +264,14 @@ class UsersController < ApplicationController
|
|
|
264
264
|
see 'development#users#index', "very interesting method reference"
|
|
265
265
|
desc 'This method is boring, look at users#create. It is hidden from documentation.'
|
|
266
266
|
def see_another
|
|
267
|
-
render :
|
|
267
|
+
render :plain => 'This is very similar to create action'
|
|
268
268
|
end
|
|
269
269
|
|
|
270
270
|
|
|
271
271
|
api :GET, '/users/desc_from_file', 'desc from file'
|
|
272
272
|
document 'users/desc_from_file.md'
|
|
273
273
|
def desc_from_file
|
|
274
|
-
render :
|
|
274
|
+
render :plain => 'document from file action'
|
|
275
275
|
end
|
|
276
276
|
|
|
277
277
|
api! 'Create user'
|
|
@@ -6,7 +6,7 @@ Apipie.configure do |config|
|
|
|
6
6
|
# can be overriden in resource_description
|
|
7
7
|
# by default is it 1.0 if not specified anywhere
|
|
8
8
|
# this must be defined before api_base_url and app_info
|
|
9
|
-
config.default_version = "development"
|
|
9
|
+
config.default_version = "development".freeze
|
|
10
10
|
|
|
11
11
|
config.doc_base_url = "/apidoc"
|
|
12
12
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -11,12 +11,8 @@ require 'apipie-rails'
|
|
|
11
11
|
|
|
12
12
|
module Rails4Compatibility
|
|
13
13
|
module Testing
|
|
14
|
-
def
|
|
15
|
-
compatible_request(*args) { |*new_args|
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def self.included(base)
|
|
19
|
-
base.alias_method_chain :process, :rails4_compat
|
|
14
|
+
def process(*args)
|
|
15
|
+
compatible_request(*args) { |*new_args| super(*new_args) }
|
|
20
16
|
end
|
|
21
17
|
|
|
22
18
|
def compatible_request(method, action, hash = {})
|
|
@@ -71,5 +67,4 @@ RSpec.configure do |config|
|
|
|
71
67
|
end
|
|
72
68
|
|
|
73
69
|
require 'action_controller/test_case.rb'
|
|
74
|
-
|
|
75
|
-
ActionController::TestCase::Behavior.send(:include, Rails4Compatibility::Testing)
|
|
70
|
+
ActionController::TestCase::Behavior.send(:prepend, Rails4Compatibility::Testing)
|
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.
|
|
4
|
+
version: 0.5.0
|
|
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-04-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|
|
@@ -17,28 +17,14 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - ">="
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '4.
|
|
20
|
+
version: '4.1'
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
25
|
- - ">="
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: '4.
|
|
28
|
-
- !ruby/object:Gem::Dependency
|
|
29
|
-
name: json
|
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
|
31
|
-
requirements:
|
|
32
|
-
- - ">="
|
|
33
|
-
- !ruby/object:Gem::Version
|
|
34
|
-
version: '0'
|
|
35
|
-
type: :runtime
|
|
36
|
-
prerelease: false
|
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
-
requirements:
|
|
39
|
-
- - ">="
|
|
40
|
-
- !ruby/object:Gem::Version
|
|
41
|
-
version: '0'
|
|
27
|
+
version: '4.1'
|
|
42
28
|
- !ruby/object:Gem::Dependency
|
|
43
29
|
name: rspec-rails
|
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -151,10 +137,10 @@ files:
|
|
|
151
137
|
- APACHE-LICENSE-2.0
|
|
152
138
|
- CHANGELOG.md
|
|
153
139
|
- Gemfile
|
|
154
|
-
- Gemfile.rails40
|
|
155
140
|
- Gemfile.rails41
|
|
156
141
|
- Gemfile.rails42
|
|
157
142
|
- Gemfile.rails50
|
|
143
|
+
- Gemfile.rails51
|
|
158
144
|
- MIT-LICENSE
|
|
159
145
|
- NOTICE
|
|
160
146
|
- README.rst
|
|
@@ -192,6 +178,7 @@ files:
|
|
|
192
178
|
- config/locales/en.yml
|
|
193
179
|
- config/locales/es.yml
|
|
194
180
|
- config/locales/it.yml
|
|
181
|
+
- config/locales/ja.yml
|
|
195
182
|
- config/locales/pl.yml
|
|
196
183
|
- config/locales/pt-BR.yml
|
|
197
184
|
- config/locales/ru.yml
|
|
@@ -304,7 +291,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
304
291
|
requirements:
|
|
305
292
|
- - ">="
|
|
306
293
|
- !ruby/object:Gem::Version
|
|
307
|
-
version:
|
|
294
|
+
version: 2.0.0
|
|
308
295
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
309
296
|
requirements:
|
|
310
297
|
- - ">="
|