apicasso 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16f579b7e6f224222ad10d35efc087d99c2ff04e
|
4
|
+
data.tar.gz: b31b8cf77845d01fd00885c1a4f516f2d582d902
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6722df9eca40fb953717fbe36039f810b76b0d11c16c71002fa7533243aa7f8d1e14f4e3526c5f8d23d2c09e16ca254b6c1935540298d1b2acc7ac816f054215
|
7
|
+
data.tar.gz: f5c6f9d92296e40ef83207552f489a47e25805ae03016e1e79da3e8ffb0475a225fa2fbd95873c1035ead75884f2ebfc4ce06efaaa5d202f1891e47358ea7637
|
@@ -24,12 +24,15 @@ module Apicasso
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# GET /:resource/1
|
27
|
+
# Common behavior for showing a record, with an addition of
|
28
|
+
# relation/methods including on response
|
27
29
|
def show
|
28
30
|
set_access_control_headers
|
29
31
|
render json: @object.to_json(include: parsed_include)
|
30
32
|
end
|
31
33
|
|
32
34
|
# PATCH/PUT /:resource/1
|
35
|
+
# Common behavior for an update API endpoint
|
33
36
|
def update
|
34
37
|
authorize_for(action: :update,
|
35
38
|
resource: resource.name.underscore.to_sym,
|
@@ -42,12 +45,13 @@ module Apicasso
|
|
42
45
|
end
|
43
46
|
|
44
47
|
# DELETE /:resource/1
|
48
|
+
# Common behavior for an destroy API endpoint
|
45
49
|
def destroy
|
46
50
|
authorize_for(action: :destroy,
|
47
51
|
resource: resource.name.underscore.to_sym,
|
48
52
|
object: @object)
|
49
53
|
if @object.destroy
|
50
|
-
|
54
|
+
head :no_content, status: :ok
|
51
55
|
else
|
52
56
|
render json: @object.errors, status: :unprocessable_entity
|
53
57
|
end
|
@@ -157,7 +161,7 @@ module Apicasso
|
|
157
161
|
|
158
162
|
# Parsing of `paginated_records` with pagination variables metadata
|
159
163
|
def built_paginated
|
160
|
-
{ entries:
|
164
|
+
{ entries: paginated_records }.merge(pagination_metadata_for(paginated_records))
|
161
165
|
end
|
162
166
|
|
163
167
|
# All records matching current query and it's total
|
@@ -170,6 +174,7 @@ module Apicasso
|
|
170
174
|
@records = JSON.parse(included_collection.to_json(include: parsed_include))
|
171
175
|
end
|
172
176
|
|
177
|
+
# A way to SQL-include if available for current param[:include]
|
173
178
|
def included_collection
|
174
179
|
if @records.try(:includes, parsed_include).present?
|
175
180
|
@records.includes(parsed_include)
|
data/lib/apicasso/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apicasso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Bellincanta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cancancan
|