apipie-rails 0.2.3 → 0.2.4
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/.travis.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
+
- 1.8.7
|
3
4
|
- 1.9.3
|
4
5
|
- 2.0.0
|
5
6
|
- 2.1.1
|
@@ -7,3 +8,9 @@ gemfile:
|
|
7
8
|
- Gemfile.rails32
|
8
9
|
- Gemfile.rails40
|
9
10
|
- Gemfile.rails41
|
11
|
+
matrix:
|
12
|
+
exclude:
|
13
|
+
- rvm: 1.8.7
|
14
|
+
gemfile: Gemfile.rails40
|
15
|
+
- rvm: 1.8.7
|
16
|
+
gemfile: Gemfile.rails41
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,21 @@
|
|
2
2
|
Changelog
|
3
3
|
===========
|
4
4
|
|
5
|
+
|
6
|
+
THE FURTHER SUPPORT FOR RUBY 1.8.7 WILL NOT BE ENSURED IN THE MASTER
|
7
|
+
AND THE `>= 0.3.0` RELAEASES. We discourage anyone to keep using ruby
|
8
|
+
1.8.7 for anything. If you're aware of the issues and still willing to
|
9
|
+
take the risk, we are willing to keep the v0.2.x releases based on the
|
10
|
+
v0.2.x branch. However, we will not actively develop or backport any
|
11
|
+
new features to this branch neither will we accept there features that
|
12
|
+
are not in the master branch.
|
13
|
+
|
14
|
+
v0.2.4
|
15
|
+
------
|
16
|
+
|
17
|
+
* fix ruby 1.8.7 compatibility
|
18
|
+
[#272](https://github.com/Apipie/apipie-rails/pull/272) [@domcleal][]
|
19
|
+
|
5
20
|
v0.2.3
|
6
21
|
------
|
7
22
|
|
@@ -186,3 +201,4 @@ v0.0.15
|
|
186
201
|
[@komidore64]: https://github.com/komidore64
|
187
202
|
[@exAspArk]: https://github.com/exAspArk
|
188
203
|
[@mourad-ifeelgoods]: https://github.com/mourad-ifeelgoods
|
204
|
+
[@domcleal]: https://github.com/domcleal
|
data/lib/apipie/validator.rb
CHANGED
@@ -163,7 +163,7 @@ module Apipie
|
|
163
163
|
end
|
164
164
|
|
165
165
|
def validate(values)
|
166
|
-
return false unless process_value(values).respond_to?(:each)
|
166
|
+
return false unless process_value(values).respond_to?(:each) && !process_value(values).is_a?(String)
|
167
167
|
process_value(values).all? { |v| validate_item(v)}
|
168
168
|
end
|
169
169
|
|
@@ -175,7 +175,7 @@ module Apipie
|
|
175
175
|
"Must be an array of #{items}"
|
176
176
|
end
|
177
177
|
|
178
|
-
def self.build(param_description, argument, options
|
178
|
+
def self.build(param_description, argument, options, block)
|
179
179
|
if argument == Array && !block.is_a?(Proc)
|
180
180
|
self.new(param_description, argument, options)
|
181
181
|
end
|
data/lib/apipie/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Apipie::Extractor::Recorder::Middleware do
|
4
|
-
let(:app) {
|
4
|
+
let(:app) { lambda { |env| [200, env, "app"] } }
|
5
5
|
let(:stack) { Apipie::Extractor::Recorder::Middleware.new(app) }
|
6
6
|
let(:request) { Rack::MockRequest.new(stack) }
|
7
7
|
let(:response) { request.get('/') }
|
@@ -32,7 +32,7 @@ describe Apipie::MethodDescription do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should return the deprecated flag when provided" do
|
35
|
-
dsl_data[:api_args] = [[:GET, "/foo/bar", "description", :deprecated => true]]
|
35
|
+
dsl_data[:api_args] = [[:GET, "/foo/bar", "description", {:deprecated => true}]]
|
36
36
|
method = Apipie::MethodDescription.new(:a, @resource, dsl_data)
|
37
37
|
method.method_apis_to_json.first[:deprecated].should == true
|
38
38
|
end
|
@@ -24,7 +24,7 @@ module Apipie::Validator
|
|
24
24
|
end
|
25
25
|
|
26
26
|
context "with a constraint on items type" do
|
27
|
-
let(:validator) { ArrayValidator.new(param_desc, Array, of
|
27
|
+
let(:validator) { ArrayValidator.new(param_desc, Array, :of => String) }
|
28
28
|
|
29
29
|
it "accepts array of specified type" do
|
30
30
|
expect(validator.validate(['string1', 'string2'])).to eq(true)
|
@@ -40,7 +40,7 @@ module Apipie::Validator
|
|
40
40
|
end
|
41
41
|
|
42
42
|
context "with a constraint on items value" do
|
43
|
-
let(:validator) { ArrayValidator.new(param_desc, Array, in
|
43
|
+
let(:validator) { ArrayValidator.new(param_desc, Array, :in => [42, 'string', true]) }
|
44
44
|
|
45
45
|
it "accepts array of valid values" do
|
46
46
|
expect(validator.validate([42, 'string'])).to eq(true)
|
@@ -55,7 +55,7 @@ module Apipie::Validator
|
|
55
55
|
end
|
56
56
|
|
57
57
|
it "accepts a proc as list of valid values" do
|
58
|
-
validator = ArrayValidator.new(param_desc, Array, in
|
58
|
+
validator = ArrayValidator.new(param_desc, Array, :in => lambda { [42, 'string', true] })
|
59
59
|
expect(validator.validate([42, 'string'])).to eq(true)
|
60
60
|
expect(validator.validate([42, 'string', 'foo'])).to eq(false)
|
61
61
|
end
|
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.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-08-
|
13
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|