model_driven_api 2.4.4 → 2.5.1

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: fe7f4f3089407a7bdb2a1f4174c9c134599fbe2a3ffd7c4bd1fa8d45424fabfe
4
- data.tar.gz: 1a863a98f07a3311782c8b6d4c8123ba6318ffa1476a056f35ed62fd75b25f3c
3
+ metadata.gz: 73cfe08fc31b7f30f5fa957336815aac4a3e50ecc087d112e229788726544367
4
+ data.tar.gz: 94627de57118c1469e0831c4bd76f6f777ead4f75954108dc27578d1754e6cff
5
5
  SHA512:
6
- metadata.gz: 79cf4fd763c17311165ada17fa4067f9151914e62aaa494eb9661dfbe5c41a7d2248c92caf1803518c430eba6d1dd77692a4148db3a18b681618775a51151f59
7
- data.tar.gz: 38b734d317dbb08b3b7bfce009b5636e38d1647cfd3bf40dea78703dfec89356fe09bcdbd2013a096b4c06a9456c10a9bc5419b512d125a757d1e588e77fab52
6
+ metadata.gz: e1563f942781fa8f6f42421b6140cc2696b3e54be822413309d4b56e7435295398347b09c3ad86e81a5ade4ba018a1e9ecc4d9e430a3101e540b1d805f013e36
7
+ data.tar.gz: 31314a903fbd5d88e31954d3303c0602e9d697532e6d723fe9ee1d7a4910137b574c6a30ea11c7d0e54a7505c7af6aa718cb0ebb4957bd32a089e4715c651dd1
@@ -16,8 +16,8 @@ class Api::V2::ApplicationController < ActionController::API
16
16
  authorize! :index, @model
17
17
 
18
18
  # Custom Action
19
- status, result = check_for_custom_action
20
- return render json: result, status: 200 if status == true
19
+ status, result, status_number = check_for_custom_action
20
+ return render json: result, status: (status_number.presence || 200) if status == true
21
21
 
22
22
  # Normal Index Action with Ransack querying
23
23
  # Keeping this automation can be too dangerous and lead to unpredicted results
@@ -52,8 +52,8 @@ class Api::V2::ApplicationController < ActionController::API
52
52
  authorize! :show, @record_id
53
53
 
54
54
  # Custom Show Action
55
- status, result = check_for_custom_action
56
- return render json: result, status: 200 if status == true
55
+ status, result, status_number = check_for_custom_action
56
+ return render json: result, status: (status_number.presence || 200) if status == true
57
57
 
58
58
  # Normal Show
59
59
  result = @record.to_json(json_attrs)
@@ -65,8 +65,8 @@ class Api::V2::ApplicationController < ActionController::API
65
65
  authorize! :create, @record
66
66
 
67
67
  # Custom Action
68
- status, result = check_for_custom_action
69
- return render json: result, status: 200 if status == true
68
+ status, result, status_number = check_for_custom_action
69
+ return render json: result, status: (status_number.presence || 200) if status == true
70
70
 
71
71
  # Normal Create Action
72
72
  # Keeping this automation can be too dangerous and lead to unpredicted results
@@ -80,8 +80,8 @@ class Api::V2::ApplicationController < ActionController::API
80
80
  authorize! :update, @record
81
81
 
82
82
  # Custom Action
83
- status, result = check_for_custom_action
84
- return render json: result, status: 200 if status == true
83
+ status, result, status_number = check_for_custom_action
84
+ return render json: result, status: (status_number.presence || 200) if status == true
85
85
 
86
86
  # Normal Update Action
87
87
  # Raisl 6 vs Rails 6.1
@@ -93,8 +93,8 @@ class Api::V2::ApplicationController < ActionController::API
93
93
  authorize! :destroy, @record
94
94
 
95
95
  # Custom Action
96
- status, result = check_for_custom_action
97
- return render json: result, status: 200 if status == true
96
+ status, result, status_number = check_for_custom_action
97
+ return render json: result, status: (status_number.presence || 200) if status == true
98
98
 
99
99
  # Normal Destroy Action
100
100
  return api_error(status: 500) unless @record.destroy
@@ -114,8 +114,9 @@ class Api::V2::ApplicationController < ActionController::API
114
114
  resource = "custom_action_#{params[:do]}"
115
115
  raise NoMethodError unless @model.respond_to?(resource)
116
116
  # return true, MultiJson.dump(params[:id].blank? ? @model.send(resource, params) : @model.send(resource, params[:id].to_i, params))
117
- puts json_attrs
118
- return true, @model.send(resource, params).to_json(json_attrs)
117
+ # puts json_attrs
118
+ body, status = @model.send(resource, params)
119
+ return true, body.to_json(json_attrs), status
119
120
  end
120
121
  # if it's here there is no custom action in the request querystring
121
122
  return false
@@ -1,4 +1,4 @@
1
- require 'model_driven_api/version'
1
+ # require 'model_driven_api/version'
2
2
  class Api::V2::InfoController < Api::V2::ApplicationController
3
3
  # Info uses a different auth method: username and password
4
4
  skip_before_action :authenticate_request, only: [:version], raise: false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model_driven_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.4
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-10 00:00:00.000000000 Z
11
+ date: 2022-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_backend_commons
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.1'
19
+ version: '2.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.1'
26
+ version: '2.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jwt
29
29
  requirement: !ruby/object:Gem::Requirement