apipie-bindings 0.2.0 → 0.4.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 +5 -5
- data/doc/release_notes.md +20 -0
- data/lib/apipie_bindings/action.rb +2 -2
- data/lib/apipie_bindings/api.rb +7 -4
- data/lib/apipie_bindings/authenticators.rb +1 -0
- data/lib/apipie_bindings/authenticators/token_auth.rb +15 -0
- data/lib/apipie_bindings/example.rb +1 -1
- data/lib/apipie_bindings/rest_client_extensions.rb +1 -1
- data/lib/apipie_bindings/route.rb +2 -2
- data/lib/apipie_bindings/version.rb +1 -1
- data/test/dummy/app/controllers/comments_controller.rb +12 -0
- data/test/dummy/config/routes.rb +2 -0
- data/test/unit/action_test.rb +24 -10
- data/test/unit/api_test.rb +7 -3
- data/test/unit/data/dummy.json +1 -1
- data/test/unit/param_test.rb +2 -2
- data/test/unit/resource_test.rb +1 -1
- data/test/unit/route_test.rb +1 -1
- data/test/unit/test_helper.rb +1 -1
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5c27168a737308891f84a0437f14b21247d4054651f698f888ef3a5e80dced00
|
4
|
+
data.tar.gz: 6d68349f382e9282d5674db0e175280d05952ea35004a6dc525d896b93ae46c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeb6522be945abe8c90588ac382751e4cf0ece7b898ae233def0a73d9d621264ee5bb4494e5da4921a75cde2af8fe078be3aa4875441e54390417b9948ff75b5
|
7
|
+
data.tar.gz: 1ac904b2c5e2ea670246619fe8d1e5b3450cc7567f716692506311e0ce5a0130191862e71e9ef253fcb87437a88fa9213ab3e93b57a902f7d0f6c056c2c18f04
|
data/doc/release_notes.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
Release notes
|
2
2
|
=============
|
3
|
+
### 0.4.0 (2020-05-29)
|
4
|
+
* support Ruby 2.7 ([PR #79](https://github.com/Apipie/apipie-bindings/pull/79))
|
5
|
+
|
6
|
+
### 0.3.0 (2019-10-25)
|
7
|
+
* Add token based auth mechanism ([PR #77](https://github.com/Apipie/apipie-bindings/pull/77))
|
8
|
+
* Throw malformed examples ([PR #78](https://github.com/Apipie/apipie-bindings/pull/78))
|
9
|
+
|
10
|
+
### 0.2.3 (2019-01-16)
|
11
|
+
* Remove error log output from specs ([PR #76](https://github.com/Apipie/apipie-bindings/pull/76))
|
12
|
+
* Update apidoc_cache_name apidoc ([PR #74](https://github.com/Apipie/apipie-bindings/pull/74))
|
13
|
+
* Fix typo in api docs ([PR #75](https://github.com/Apipie/apipie-bindings/pull/75))
|
14
|
+
* Fix typo in param test ([PR #73](https://github.com/Apipie/apipie-bindings/pull/73))
|
15
|
+
|
16
|
+
### 0.2.2 (2018-01-09)
|
17
|
+
* modernize ruby versions ([PR #71](https://github.com/Apipie/apipie-bindings/pull/71))
|
18
|
+
|
19
|
+
### 0.2.1 (2018-01-06)
|
20
|
+
* Do not allow NIL as a route parameter ([PR #70](https://github.com/Apipie/apipie-bindings/pull/70)) ([#22009](http://projects.theforeman.org/issues/22009))
|
21
|
+
* update cache on error responses ([PR #67](https://github.com/Apipie/apipie-bindings/pull/67))
|
22
|
+
* pin oauth to support ruby < 2.0.0 ([PR #69](https://github.com/Apipie/apipie-bindings/pull/69))
|
3
23
|
|
4
24
|
### 0.2.0 (2017-04-24)
|
5
25
|
* Support for overriding exceptions from authorizers ([PR #64](https://github.com/Apipie/apipie-bindings/pull/64))
|
@@ -41,14 +41,14 @@ module ApipieBindings
|
|
41
41
|
def examples
|
42
42
|
apidoc[:examples].map do |example|
|
43
43
|
ApipieBindings::Example.parse(example)
|
44
|
-
end
|
44
|
+
end.compact
|
45
45
|
end
|
46
46
|
|
47
47
|
def find_route(params={})
|
48
48
|
sorted_routes = routes.sort_by { |r| [-1 * r.params_in_path.count, r.path] }
|
49
49
|
|
50
50
|
suitable_route = sorted_routes.find do |route|
|
51
|
-
route.params_in_path.all? { |path_param| params.
|
51
|
+
route.params_in_path.all? { |path_param| !params[path_param.to_sym].nil? || !params[path_param].nil? }
|
52
52
|
end
|
53
53
|
|
54
54
|
suitable_route ||= sorted_routes.last
|
data/lib/apipie_bindings/api.rb
CHANGED
@@ -29,7 +29,7 @@ module ApipieBindings
|
|
29
29
|
# directory for building apidoc_cache_dir
|
30
30
|
# @option config [String] :apidoc_cache_dir (apidoc_cache_base_dir+'/<URI>') where
|
31
31
|
# to cache the JSON description of the API
|
32
|
-
# @option config [String] :apidoc_cache_name ('default
|
32
|
+
# @option config [String] :apidoc_cache_name ('default') name of the cache file.
|
33
33
|
# If there is cache in the :apidoc_cache_dir, it is used.
|
34
34
|
# @option config [String] :apidoc_authenticated (true) whether or not does the call to
|
35
35
|
# obtain API description use authentication. It is useful to avoid unnecessary prompts
|
@@ -135,7 +135,7 @@ module ApipieBindings
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def apidoc
|
138
|
-
@apidoc
|
138
|
+
@apidoc ||= load_apidoc || retrieve_apidoc
|
139
139
|
@apidoc
|
140
140
|
end
|
141
141
|
|
@@ -160,7 +160,7 @@ module ApipieBindings
|
|
160
160
|
|
161
161
|
# Call an action in the API.
|
162
162
|
# It finds most fitting route based on given parameters
|
163
|
-
# with other attributes
|
163
|
+
# with other attributes necessary to do an API call.
|
164
164
|
# If in dry_run mode {#initialize} it finds fake response data in examples
|
165
165
|
# or user provided data. At the end when the response format is JSON it
|
166
166
|
# is parsed and returned as ruby objects. If server supports checksum sending
|
@@ -242,6 +242,9 @@ module ApipieBindings
|
|
242
242
|
rescue => e
|
243
243
|
log.error e.message
|
244
244
|
log.debug inspect_data(e)
|
245
|
+
if e.respond_to?(:response) && e.response.respond_to?(:headers)
|
246
|
+
update_cache(e.response.headers[:apipie_checksum])
|
247
|
+
end
|
245
248
|
override_e = @authenticator.error(e) if authenticate && @authenticator
|
246
249
|
raise override_e.is_a?(StandardError) ? override_e : e
|
247
250
|
end
|
@@ -277,7 +280,7 @@ module ApipieBindings
|
|
277
280
|
end
|
278
281
|
|
279
282
|
def retrieve_apidoc
|
280
|
-
FileUtils.mkdir_p(@apidoc_cache_dir) unless File.
|
283
|
+
FileUtils.mkdir_p(@apidoc_cache_dir) unless File.exist?(@apidoc_cache_dir)
|
281
284
|
if language
|
282
285
|
response = retrieve_apidoc_call("/apidoc/v#{@api_version}.#{language}.json", :safe => true)
|
283
286
|
language_family = language.split('_').first
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'apipie_bindings/authenticators/base'
|
2
|
+
|
3
|
+
module ApipieBindings
|
4
|
+
module Authenticators
|
5
|
+
class TokenAuth < Base
|
6
|
+
def initialize(token)
|
7
|
+
@token = token
|
8
|
+
end
|
9
|
+
|
10
|
+
def authenticate(req, token)
|
11
|
+
req['Authorization'] = "Bearer #{@token}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -16,7 +16,7 @@ module ApipieBindings
|
|
16
16
|
end
|
17
17
|
|
18
18
|
unless RestClient.before_execution_procs.include? RestClient::AUTHENTICATOR_EXTENSION
|
19
|
-
RestClient.add_before_execution_proc
|
19
|
+
RestClient.add_before_execution_proc(&RestClient::AUTHENTICATOR_EXTENSION)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -17,10 +17,10 @@ module ApipieBindings
|
|
17
17
|
def path(params=nil)
|
18
18
|
return @path if params.nil?
|
19
19
|
|
20
|
-
|
20
|
+
params_in_path.inject(@path) do |p, param_name|
|
21
21
|
param_value = (params[param_name.to_sym] or params[param_name.to_s]) or
|
22
22
|
raise ArgumentError, "missing param '#{param_name}' in parameters"
|
23
|
-
p.sub(":#{param_name}",
|
23
|
+
p.sub(":#{param_name}", CGI.escape(param_value.to_s))
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -1,6 +1,18 @@
|
|
1
1
|
class CommentsController < ApplicationController
|
2
2
|
include Concerns::DummyConcern
|
3
3
|
|
4
|
+
api!
|
5
|
+
api :GET, "archive/comments/:id/"
|
6
|
+
api :GET, "archive/users/:user_id/comments/:id/"
|
7
|
+
param :id, Integer, :required => true
|
8
|
+
param :user_id, Integer
|
9
|
+
param :post_id, Integer
|
10
|
+
def archive
|
11
|
+
params[:user_id] ||= 1
|
12
|
+
params[:post_id] ||= 1
|
13
|
+
render :json => Dummy::Store.show(base_path)
|
14
|
+
end
|
15
|
+
|
4
16
|
protected
|
5
17
|
|
6
18
|
def base_path
|
data/test/dummy/config/routes.rb
CHANGED
data/test/unit/action_test.rb
CHANGED
@@ -2,8 +2,9 @@ require File.join(File.dirname(__FILE__), 'test_helper')
|
|
2
2
|
|
3
3
|
describe ApipieBindings::Action do
|
4
4
|
|
5
|
-
let(:
|
6
|
-
:apidoc_cache_name => 'dummy'})
|
5
|
+
let(:dummy_api) { ApipieBindings::API.new({:apidoc_cache_dir => 'test/unit/data',
|
6
|
+
:apidoc_cache_name => 'dummy'}) }
|
7
|
+
let(:resource) { dummy_api.resource(:users)}
|
7
8
|
|
8
9
|
it "should allow user to call the action" do
|
9
10
|
params = { :a => 1 }
|
@@ -16,8 +17,21 @@ describe ApipieBindings::Action do
|
|
16
17
|
resource.action(:index).routes.first.must_be_kind_of ApipieBindings::Route
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
-
resource.action(:
|
20
|
+
describe "#find_route" do
|
21
|
+
let(:archive_action) { dummy_api.resource(:comments).action(:archive) }
|
22
|
+
|
23
|
+
it "should find suitable route" do
|
24
|
+
resource.action(:index).find_route.path.must_equal "/users"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should find longest matching route" do
|
28
|
+
archive_action.find_route(:id => 1, :user_id => 1).path.must_equal "/archive/users/:user_id/comments/:id"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should find longest matching route ignoring nil params in the path" do
|
32
|
+
archive_action.find_route(:id => 1, :user_id => nil).path.must_equal "/archive/comments/:id"
|
33
|
+
end
|
34
|
+
|
21
35
|
end
|
22
36
|
|
23
37
|
it "should return params" do
|
@@ -46,7 +60,7 @@ describe ApipieBindings::Action do
|
|
46
60
|
e = proc do
|
47
61
|
resource.action(:create).validate!({ :user => { :vip => true } })
|
48
62
|
end.must_raise(ApipieBindings::MissingArgumentsError)
|
49
|
-
e.message.must_match
|
63
|
+
e.message.must_match(/: user\[name\]$/)
|
50
64
|
end
|
51
65
|
|
52
66
|
it "should raise on missing nested required params (hash)" do
|
@@ -60,7 +74,7 @@ describe ApipieBindings::Action do
|
|
60
74
|
}
|
61
75
|
})
|
62
76
|
end.must_raise(ApipieBindings::MissingArgumentsError)
|
63
|
-
e.message.must_match
|
77
|
+
e.message.must_match(/: user\[address\]\[city\]$/)
|
64
78
|
end
|
65
79
|
|
66
80
|
it "should raise on missing nested required params (array)" do
|
@@ -74,7 +88,7 @@ describe ApipieBindings::Action do
|
|
74
88
|
}
|
75
89
|
})
|
76
90
|
end.must_raise(ApipieBindings::MissingArgumentsError)
|
77
|
-
e.message.must_match
|
91
|
+
e.message.must_match(/: user\[contacts\]\[0\]\[contact\]$/)
|
78
92
|
end
|
79
93
|
|
80
94
|
it "should raise on invalid param format" do
|
@@ -89,8 +103,8 @@ describe ApipieBindings::Action do
|
|
89
103
|
}
|
90
104
|
})
|
91
105
|
end.must_raise(ApipieBindings::InvalidArgumentTypesError)
|
92
|
-
e.message.must_match
|
93
|
-
e.message.must_match
|
106
|
+
e.message.must_match(/user\[contacts\]\[0\] - Hash was expected/)
|
107
|
+
e.message.must_match(/user\[contacts\]\[1\] - Hash was expected/)
|
94
108
|
end
|
95
109
|
|
96
110
|
it "should accept minimal correct params" do
|
@@ -117,7 +131,7 @@ describe ApipieBindings::Action do
|
|
117
131
|
end
|
118
132
|
|
119
133
|
it "should have name visible in puts" do
|
120
|
-
out,
|
134
|
+
out, _err = capture_io { puts resource.action(:index) }
|
121
135
|
out.must_equal "<Action users:index>\n"
|
122
136
|
end
|
123
137
|
|
data/test/unit/api_test.rb
CHANGED
@@ -76,7 +76,7 @@ describe ApipieBindings::API do
|
|
76
76
|
request_args = RestClient.version >= '1.8.0' ? args.last.args : args.last
|
77
77
|
request_args[:method] == :post && request_args[:params] == {:file => s} && request_args[:headers] == headers
|
78
78
|
end
|
79
|
-
|
79
|
+
api.http_call(:post, '/api/path', {:file => s}, headers, {:response => :raw})
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should process nil response safely" do
|
@@ -229,7 +229,8 @@ describe ApipieBindings::API do
|
|
229
229
|
:uri => 'http://example.com',
|
230
230
|
:api_version => 2,
|
231
231
|
:apidoc_cache_base_dir => cache_dir,
|
232
|
-
:authenticator => authenticator
|
232
|
+
:authenticator => authenticator,
|
233
|
+
:logger => Logger.new(File::NULL)
|
233
234
|
}
|
234
235
|
base_params.merge(params)
|
235
236
|
end
|
@@ -371,7 +372,10 @@ describe ApipieBindings::API do
|
|
371
372
|
it "should call clear_credentials when doing authenticated call and auth error is raised" do
|
372
373
|
Dir.mktmpdir do |dir|
|
373
374
|
credentials = ApipieBindings::AbstractCredentials.new
|
374
|
-
api = ApipieBindings::API.new({:uri => 'http://example.com',
|
375
|
+
api = ApipieBindings::API.new({:uri => 'http://example.com',
|
376
|
+
:logger => Logger.new(File::NULL),
|
377
|
+
:apidoc_cache_base_dir => dir,
|
378
|
+
:api_version => 2,
|
375
379
|
:credentials => credentials})
|
376
380
|
credentials.expects(:clear)
|
377
381
|
api.stubs(:call_client).raises(RestClient::Unauthorized)
|
data/test/unit/data/dummy.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"docs":{"name":"Dummy","info":"
|
1
|
+
{"docs":{"name":"Dummy","info":"\n\u003cp\u003eAnother API description\u003c/p\u003e\n","copyright":null,"doc_url":"./apipie/1.0","api_url":"/","resources":{"posts":{"doc_url":"./apipie/1.0/posts","api_url":"/","name":"Posts","short_description":null,"full_description":null,"version":"1.0","formats":null,"metadata":null,"methods":[{"doc_url":"./apipie/1.0/posts/index","name":"index","apis":[{"api_url":"/users/:user_id/posts","http_method":"GET","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/posts/show","name":"show","apis":[{"api_url":"/users/:user_id/posts/:id","http_method":"GET","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/posts/create","name":"create","apis":[{"api_url":"/users/:user_id/posts","http_method":"POST","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/posts/update","name":"update","apis":[{"api_url":"/users/:user_id/posts/:id","http_method":"PATCH","short_description":null,"deprecated":null},{"api_url":"/users/:user_id/posts/:id","http_method":"PUT","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/posts/destroy","name":"destroy","apis":[{"api_url":"/users/:user_id/posts/:id","http_method":"DELETE","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true}],"headers":null,"deprecated":null},"users":{"doc_url":"./apipie/1.0/users","api_url":"/","name":"Users","short_description":null,"full_description":null,"version":"1.0","formats":null,"metadata":null,"methods":[{"doc_url":"./apipie/1.0/users/index","name":"index","apis":[{"api_url":"/users","http_method":"GET","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":["GET /users\n200\n[ {\"user\":{\"name\":\"John Doe\" }} ]\n"],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/users/show","name":"show","apis":[{"api_url":"/users/:id","http_method":"GET","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/users/create","name":"create","apis":[{"api_url":"/users","http_method":"POST","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[{"name":"user","full_name":"user","description":"","required":false,"allow_nil":false,"allow_blank":false,"validator":"Must be a Hash","expected_type":"hash","metadata":null,"show":true,"validations":[],"params":[{"name":"name","full_name":"user[name]","description":"","required":true,"allow_nil":false,"allow_blank":false,"validator":"Must be a String","expected_type":"string","metadata":null,"show":true,"validations":[]},{"name":"vip","full_name":"user[vip]","description":"","required":false,"allow_nil":false,"allow_blank":false,"validator":"Must be one of: \u003ccode\u003etrue\u003c/code\u003e, \u003ccode\u003efalse\u003c/code\u003e, \u003ccode\u003e1\u003c/code\u003e, \u003ccode\u003e0\u003c/code\u003e","expected_type":"boolean","metadata":null,"show":true,"validations":[]},{"name":"address","full_name":"user[address]","description":"","required":false,"allow_nil":false,"allow_blank":false,"validator":"Must be a Hash","expected_type":"hash","metadata":null,"show":true,"validations":[],"params":[{"name":"city","full_name":"user[address][city]","description":"","required":true,"allow_nil":false,"allow_blank":false,"validator":"Must be a String","expected_type":"string","metadata":null,"show":true,"validations":[]},{"name":"street","full_name":"user[address][street]","description":"","required":false,"allow_nil":false,"allow_blank":false,"validator":"Must be a String","expected_type":"string","metadata":null,"show":true,"validations":[]}]},{"name":"contacts","full_name":"user[contacts]","description":"","required":false,"allow_nil":false,"allow_blank":false,"validator":"Must be an Array of nested elements","expected_type":"array","metadata":null,"show":true,"validations":[],"params":[{"name":"contact","full_name":"user[contacts][contact]","description":"","required":true,"allow_nil":false,"allow_blank":false,"validator":"Must be a String","expected_type":"string","metadata":null,"show":true,"validations":[]},{"name":"kind","full_name":"user[contacts][kind]","description":"","required":false,"allow_nil":false,"allow_blank":false,"validator":"Must be a String","expected_type":"string","metadata":null,"show":true,"validations":[]}]}]}],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/users/update","name":"update","apis":[{"api_url":"/users/:id","http_method":"PATCH","short_description":null,"deprecated":null},{"api_url":"/users/:id","http_method":"PUT","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/users/destroy","name":"destroy","apis":[{"api_url":"/users/:id","http_method":"DELETE","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/users/create_unnested","name":"create_unnested","apis":[{"api_url":"/users/create_unnested","http_method":"POST","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[{"name":"name","full_name":"name","description":"","required":true,"allow_nil":false,"allow_blank":false,"validator":"Must be a String","expected_type":"string","metadata":null,"show":true,"validations":[]}],"examples":[],"metadata":null,"see":[],"headers":[],"show":true}],"headers":null,"deprecated":null},"comments":{"doc_url":"./apipie/1.0/comments","api_url":"/","name":"Comments","short_description":null,"full_description":null,"version":"1.0","formats":null,"metadata":null,"methods":[{"doc_url":"./apipie/1.0/comments/index","name":"index","apis":[{"api_url":"/users/:user_id/posts/:post_id/comments","http_method":"GET","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/comments/show","name":"show","apis":[{"api_url":"/users/:user_id/posts/:post_id/comments/:id","http_method":"GET","short_description":null,"deprecated":null},{"api_url":"/archive/users/:user_id/comment/:id","http_method":"GET","short_description":null,"deprecated":null},{"api_url":"/archive/comment/:id","http_method":"GET","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/comments/create","name":"create","apis":[{"api_url":"/users/:user_id/posts/:post_id/comments","http_method":"POST","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/comments/update","name":"update","apis":[{"api_url":"/users/:user_id/posts/:post_id/comments/:id","http_method":"PATCH","short_description":null,"deprecated":null},{"api_url":"/users/:user_id/posts/:post_id/comments/:id","http_method":"PUT","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/comments/destroy","name":"destroy","apis":[{"api_url":"/users/:user_id/posts/:post_id/comments/:id","http_method":"DELETE","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[],"examples":[],"metadata":null,"see":[],"headers":[],"show":true},{"doc_url":"./apipie/1.0/comments/archive","name":"archive","apis":[{"api_url":"/archive/comments/:id","http_method":"GET","short_description":null,"deprecated":null},{"api_url":"/archive/users/:user_id/comments/:id","http_method":"GET","short_description":null,"deprecated":null}],"formats":null,"full_description":"","errors":[],"params":[{"name":"id","full_name":"id","description":"","required":true,"allow_nil":false,"allow_blank":false,"validator":"Must be a Integer","expected_type":"numeric","metadata":null,"show":true,"validations":[]},{"name":"user_id","full_name":"user_id","description":"","required":false,"allow_nil":false,"allow_blank":false,"validator":"Must be a Integer","expected_type":"numeric","metadata":null,"show":true,"validations":[]},{"name":"post_id","full_name":"post_id","description":"","required":false,"allow_nil":false,"allow_blank":false,"validator":"Must be a Integer","expected_type":"numeric","metadata":null,"show":true,"validations":[]}],"examples":[],"metadata":null,"see":[],"headers":[],"show":true}],"headers":null,"deprecated":null}},"link_extension":".html"}}
|
data/test/unit/param_test.rb
CHANGED
@@ -32,7 +32,7 @@ describe ApipieBindings::Param do
|
|
32
32
|
param.expected_type.must_equal :hash
|
33
33
|
end
|
34
34
|
|
35
|
-
it "should have description
|
35
|
+
it "should have description that strip html tags" do
|
36
36
|
param.description.must_equal "Architecture"
|
37
37
|
end
|
38
38
|
|
@@ -46,7 +46,7 @@ describe ApipieBindings::Param do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should have full name, type and required visible in puts" do
|
49
|
-
out,
|
49
|
+
out, _err = capture_io { puts param }
|
50
50
|
out.must_equal "<Param *architecture (Hash)>\n"
|
51
51
|
end
|
52
52
|
|
data/test/unit/resource_test.rb
CHANGED
data/test/unit/route_test.rb
CHANGED
data/test/unit/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-bindings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Bačovský
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -62,16 +62,16 @@ dependencies:
|
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: 12.3.3
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - "
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: 12.3.3
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: thor
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,16 +118,16 @@ dependencies:
|
|
118
118
|
name: simplecov
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - "
|
121
|
+
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: 0
|
123
|
+
version: '0'
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- - "
|
128
|
+
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: 0
|
130
|
+
version: '0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
name: mocha
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/apipie_bindings/authenticators/basic_auth.rb
|
186
186
|
- lib/apipie_bindings/authenticators/credentials_legacy.rb
|
187
187
|
- lib/apipie_bindings/authenticators/oauth.rb
|
188
|
+
- lib/apipie_bindings/authenticators/token_auth.rb
|
188
189
|
- lib/apipie_bindings/credentials.rb
|
189
190
|
- lib/apipie_bindings/example.rb
|
190
191
|
- lib/apipie_bindings/exceptions.rb
|
@@ -248,7 +249,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
248
249
|
requirements:
|
249
250
|
- - ">="
|
250
251
|
- !ruby/object:Gem::Version
|
251
|
-
version:
|
252
|
+
version: 2.0.0
|
252
253
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
254
|
requirements:
|
254
255
|
- - ">="
|
@@ -256,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
257
|
version: '0'
|
257
258
|
requirements: []
|
258
259
|
rubyforge_project:
|
259
|
-
rubygems_version: 2.
|
260
|
+
rubygems_version: 2.7.6.2
|
260
261
|
signing_key:
|
261
262
|
specification_version: 4
|
262
263
|
summary: The Ruby bindings for Apipie documented APIs
|