thecore_api 1.3.9 → 1.3.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
  SHA256:
3
- metadata.gz: f46636573d8107e9a55691d97eed4aafc62fc02235d948ed97ee191c3178ada3
4
- data.tar.gz: 7b4dcaf0baf35a53390674910044fbf08389b7955c605a236b113ac580b72c8f
3
+ metadata.gz: 91bfe2280c7f928d37230a916ab8794bf079ae06c77b4f96b0dc5469551c5b04
4
+ data.tar.gz: c84e2dd1771f3ca85b317e22b377e44f61ffd36f15614c533d268f1a668a3980
5
5
  SHA512:
6
- metadata.gz: 37d7f54f28e69f12470d0ca5f717242a7833115b5356671116e514aa88bf74576c4017a453a878fb7820c09786a42aa932ad3c91eb7b235f061b1a89246d97d8
7
- data.tar.gz: b4de76edb203bafea11438b8114810c4bf08819c3792df60b6df6a9560fa45da4ddd494a7c4da3792d024ca9904fec8248e9f9198b00754686319535b8dabd86
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
- # Non sono certo che i request params gli arrivino... Domani da testare
69
- # Il body come glielo passo?
70
- @params = params
71
- create
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
- # Non sono certo che i request params gli arrivino... Domani da testare
74
- # Il body come glielo passo?
75
- @params = params
76
- find_record path.second.to_i
77
- update
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
@@ -1,3 +1,3 @@
1
1
  module ThecoreApi
2
- VERSION = "1.3.9".freeze
2
+ VERSION = "1.3.10".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.9
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-06-20 00:00:00.000000000 Z
11
+ date: 2019-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore