thecore_api 1.3.9 → 1.3.10
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/app/controllers/api/v1/base_controller.rb +16 -10
- data/lib/thecore_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91bfe2280c7f928d37230a916ab8794bf079ae06c77b4f96b0dc5469551c5b04
|
4
|
+
data.tar.gz: c84e2dd1771f3ca85b317e22b377e44f61ffd36f15614c533d268f1a668a3980
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 618fcbaa57524b6f8ff96a15fa56e524619d95de1afc4bc4a262e525b7b23a0908a43238cfbb3dbcb9926206872ea1a85cd6f93e8e7c91eff2b841f55b60024f
|
7
|
+
data.tar.gz: c93655052f3636be0deb17379af1ea0689f739649f901b5e236fe65e54ba7dbba642e82042b71a559efd4c74145d4918f54e74c2002cd9dcde19e4b56cca1dd9
|
@@ -65,16 +65,22 @@ class Api::V1::BaseController < ActionController::API
|
|
65
65
|
return render json: result, status: result.blank? ? 404 : 200
|
66
66
|
end
|
67
67
|
elsif request.post?
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
if path.second.blank?
|
69
|
+
@params = params
|
70
|
+
create
|
71
|
+
elsif path.second.to_i.zero?
|
72
|
+
result = MultiJson.dump(@model.send(path.second, params))
|
73
|
+
return render json: result, status: result.blank? ? 404 : 200
|
74
|
+
end
|
72
75
|
elsif request.put?
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
if !path.second.to_i.zero? && path.third.blank?
|
77
|
+
@params = params
|
78
|
+
find_record path.second.to_i
|
79
|
+
update
|
80
|
+
elsif !path.second.to_i.zero? && !path.third.blank?
|
81
|
+
result = MultiJson.dump(@model.send(path.third, path.second.to_i, params))
|
82
|
+
return render json: result, status: result.blank? ? 404 : 200
|
83
|
+
end
|
78
84
|
elsif request.delete?
|
79
85
|
find_record path.second.to_i
|
80
86
|
destroy
|
@@ -257,6 +263,6 @@ class Api::V1::BaseController < ActionController::API
|
|
257
263
|
end
|
258
264
|
|
259
265
|
def json_attrs
|
260
|
-
@model.json_attrs.presence || @json_attrs.presence || {}
|
266
|
+
((@model.json_attrs.presence || @json_attrs.presence || {}) rescue {})
|
261
267
|
end
|
262
268
|
end
|
data/lib/thecore_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore
|