model_driven_api 3.5.5 → 3.5.6
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/v2/application_controller.rb +12 -13
- data/lib/model_driven_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 394acca44589bd5e704f0cbf966eab8eded237d1aafdcbc0f2a14318b78ceadc
|
|
4
|
+
data.tar.gz: 302dfcc51da16d380148f5fc1953065a0cf537657bb713bc705dab5184a8a4d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7da1bbd9f1f565296c34479faefba15d9ba77036cea33904740e2c74c646b7aef9c90681e8fdcec8b254efea20818c0719188271f135d58dccac4064100e0c90
|
|
7
|
+
data.tar.gz: 10702aeed1e9c0c925faa0214c01f0e2ed12187c09a23b559e5f9b1af89ce25cbe268883508bd7c9f75911aba49a2177190177eceb24c6e1947331420f0985dd
|
|
@@ -40,7 +40,7 @@ class Api::V2::ApplicationController < ActionController::API
|
|
|
40
40
|
response.set_header("Content-Range", "#{@model.table_name} #{range_start}-#{range_end}/#{@records.total_count}")
|
|
41
41
|
|
|
42
42
|
# puts "ALL RECORDS FOUND: #{@records_all.inspect}"
|
|
43
|
-
status = @records_count.zero? ? 404 : 200
|
|
43
|
+
status = @records_count.zero? && params[:always_ok].blank? ? 404 : 200
|
|
44
44
|
# puts "If it's asked for page number, then paginate"
|
|
45
45
|
return render json: @records.as_json(json_attrs), status: status if !page.blank? # (@json_attrs || {})
|
|
46
46
|
#puts "if you ask for count, then return a json object with just the number of objects"
|
|
@@ -140,18 +140,17 @@ class Api::V2::ApplicationController < ActionController::API
|
|
|
140
140
|
# or
|
|
141
141
|
# [GET|PUT|POST|DELETE] :controller/custom_action/:custom_action/:id
|
|
142
142
|
def check_for_custom_action
|
|
143
|
-
|
|
144
143
|
custom_action, token = if !params[:do].blank?
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
144
|
+
# This also responds to custom actions which have the bearer token in the custom action name. A workaround to remove for some IoT devices
|
|
145
|
+
# Which don't support token in header or in querystring
|
|
146
|
+
# This is for backward compatibility and in future it can ben removed
|
|
147
|
+
params[:do].split("-")
|
|
148
|
+
elsif request.url.include? "/custom_action/"
|
|
149
|
+
[params[:action_name], nil]
|
|
150
|
+
else
|
|
151
|
+
# Not a custom action call
|
|
152
|
+
false
|
|
153
|
+
end
|
|
155
154
|
return false unless custom_action
|
|
156
155
|
# Poor man's solution to avoid the possibility to
|
|
157
156
|
# call an unwanted method in the AR Model.
|
|
@@ -176,7 +175,7 @@ class Api::V2::ApplicationController < ActionController::API
|
|
|
176
175
|
# Custom endpoint does not exist or cannot be called
|
|
177
176
|
raise NoMethodError
|
|
178
177
|
end
|
|
179
|
-
|
|
178
|
+
|
|
180
179
|
return true, body.to_json(json_attrs), status
|
|
181
180
|
end
|
|
182
181
|
|