haveapi 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/haveapi.gemspec +1 -1
- data/lib/haveapi/actions/paginable.rb +3 -5
- data/lib/haveapi/model_adapters/active_record.rb +15 -1
- data/lib/haveapi/version.rb +1 -1
- 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: f07a08da63c6a6971d962f5de898151b8f1526e8
|
4
|
+
data.tar.gz: 82a118d577b0f0c21585282b6e72733e8dac8857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: babc460201bfb5cff7adfab5017a70570f69c0b484e898b3ca62c2d1c016a1cde2c93c2369edadfc0de2c9ec1a8a392b89c2eb1288863b938fb551e411d54850
|
7
|
+
data.tar.gz: 8f1bea4fc43b85ff52374ac37cab28af42e7a1be75210fafe458f84a6a6f0503495f0b2921596c50b221430150362a33afc63f1a200ab2def908f236db482891
|
data/CHANGELOG
CHANGED
data/haveapi.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'haveapi/version'
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'haveapi'
|
7
7
|
s.version = HaveAPI::VERSION
|
8
|
-
s.date = '2016-
|
8
|
+
s.date = '2016-04-18'
|
9
9
|
s.summary =
|
10
10
|
s.description = 'Framework for creating self-describing APIs'
|
11
11
|
s.authors = 'Jakub Skokan'
|
@@ -2,11 +2,9 @@ module HaveAPI::Actions
|
|
2
2
|
module Paginable
|
3
3
|
def self.included(action)
|
4
4
|
action.input do
|
5
|
-
integer :offset, label: 'Offset', desc: 'The offset of the first object'
|
6
|
-
|
7
|
-
integer :limit, label: 'Limit', desc: 'The number of objects to retrieve',
|
8
|
-
default: 25
|
5
|
+
integer :offset, label: 'Offset', desc: 'The offset of the first object'
|
6
|
+
integer :limit, label: 'Limit', desc: 'The number of objects to retrieve'
|
9
7
|
end
|
10
8
|
end
|
11
9
|
end
|
12
|
-
end
|
10
|
+
end
|
@@ -43,7 +43,21 @@ module HaveAPI::ModelAdapters
|
|
43
43
|
# in an array of symbols and hashes.
|
44
44
|
def ar_parse_includes(raw)
|
45
45
|
return @ar_parsed_includes if @ar_parsed_includes
|
46
|
-
@ar_parsed_includes = ar_inner_includes(raw)
|
46
|
+
@ar_parsed_includes = ar_inner_includes(raw).select do |inc|
|
47
|
+
# Drop associations that are not registered in the AR:
|
48
|
+
# The API resource may have associations that are not based on
|
49
|
+
# associations in AR.
|
50
|
+
if inc.is_a?(::Hash)
|
51
|
+
inc.each_key do |k|
|
52
|
+
next(false) unless self.class.model.reflections.has_key?(k)
|
53
|
+
end
|
54
|
+
|
55
|
+
else
|
56
|
+
next(false) unless self.class.model.reflections.has_key?(inc)
|
57
|
+
end
|
58
|
+
|
59
|
+
true
|
60
|
+
end
|
47
61
|
end
|
48
62
|
|
49
63
|
# Called by ar_parse_includes for recursion purposes.
|
data/lib/haveapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haveapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Skokan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: require_all
|