thecore_api 1.3.6 → 1.3.7

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
  SHA256:
3
- metadata.gz: 2e2eb252c14d1e5b35e80c286ae80db58acf3f07fcec1169ed41d7639ef5e810
4
- data.tar.gz: 4cd74f5b7c8c3772f1a2dcbcb78baf135a45b447953fb221c79b5749515934b3
3
+ metadata.gz: ee66014623dc5c8dc795ff7599ca71904b793647974a9bf203a01914a59ccac4
4
+ data.tar.gz: c919762df62045495d03c6f25dd5b08ce04ff0e061a2c79055e19cda426b17e8
5
5
  SHA512:
6
- metadata.gz: b2b72defdb59f07216a06e6b4df240811374b87b9012d508bfc93575d7bfea1eff09d78663117e956de34f5f21b9cac236c3601f2ebd9eaf3011d893440e53d9
7
- data.tar.gz: a8d441aede32758e8fbf71992bf9ea9a6bcab4c50aacd6132b21b0ac772837d1de519b71a234566f59785d30fbc968cf369b135d1a69f24fe34007508750fb6c
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
- return render json: MultiJson.dump(@model.send(path.second, params))
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
- return render json: MultiJson.dump(@model.send(path.third, path.second.to_i, params))
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
- render json: @record.to_json(json_attrs), status: 200
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
@@ -1,3 +1,3 @@
1
1
  module ThecoreApi
2
- VERSION = "1.3.6".freeze
2
+ VERSION = "1.3.7".freeze
3
3
  end
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.6
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-17 00:00:00.000000000 Z
11
+ date: 2019-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore