thecore_api 1.3.6 → 1.3.7
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 +6 -3
- 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: ee66014623dc5c8dc795ff7599ca71904b793647974a9bf203a01914a59ccac4
|
4
|
+
data.tar.gz: c919762df62045495d03c6f25dd5b08ce04ff0e061a2c79055e19cda426b17e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64eb416b1b1d3f6c1cbcd59956ffcbe1d506c6ef46b8536ad33afea9b1ab4a897a5a9b8ff54f20d4121aad7a11497355e37b733ec6390c7ba20f478e74151f93
|
7
|
+
data.tar.gz: 821d7f5e3c50ab1789f5da0823cad904b022222f66b00b4b40209d1310e19dc03711cbea810382dd5dd70f241e2b3a2c6e632003e9602c37ce557b394070ddbd
|
@@ -53,14 +53,16 @@ class Api::V1::BaseController < ActionController::API
|
|
53
53
|
elsif path.second.to_i.zero?
|
54
54
|
# String, so it's a custom action I must find in the @model (as an singleton method)
|
55
55
|
# Like: :controller/:custom_action
|
56
|
-
|
56
|
+
result = MultiJson.dump(@model.send(path.second, params))
|
57
|
+
return render json: result, status: result.blank? ? 404 : 200
|
57
58
|
elsif !path.second.to_i.zero? && path.third.blank?
|
58
59
|
# Integer, so it's an ID, I must show it
|
59
60
|
find_record path.second.to_i
|
60
61
|
show
|
61
62
|
elsif !path.second.to_i.zero? && !path.third.blank?
|
62
63
|
# Like :controller/:id/:custom_action
|
63
|
-
|
64
|
+
result = MultiJson.dump(@model.send(path.third, path.second.to_i, params))
|
65
|
+
return render json: result, status: result.blank? ? 404 : 200
|
64
66
|
end
|
65
67
|
elsif request.post?
|
66
68
|
# Non sono certo che i request params gli arrivino... Domani da testare
|
@@ -124,7 +126,8 @@ class Api::V1::BaseController < ActionController::API
|
|
124
126
|
end
|
125
127
|
|
126
128
|
def show
|
127
|
-
|
129
|
+
result = @record.to_json(json_attrs)
|
130
|
+
render json: result, status: result.blank? ? 404 : 200
|
128
131
|
end
|
129
132
|
|
130
133
|
def create
|
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.7
|
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-06-
|
11
|
+
date: 2019-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore
|