api_me 0.11.1 → 0.12.0

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: 264fa08f13ef6151a2412ba5b5c817f5803bd0f1085f9ca648d6a43f144c3107
4
- data.tar.gz: 9fc7b20414e3184c40161a64a9042461ed4ec8eea9cc16e882e0e2d63fad9938
3
+ metadata.gz: ed39f052b8ffaff2339bce75592a4ba2ee371c451e496411333e3b472711be9d
4
+ data.tar.gz: d24e777c24e9df8348937da77af6251f1e5a03e85e080cf48639a0e7a2ed0e1b
5
5
  SHA512:
6
- metadata.gz: df859338d2d110c7eb6a5027f936b577f32fe8659e18e1c3af0c7c54dd7db5e9450843ed6e2f67150871b9a404839a426264c00534007009b095d8de3ddd515a
7
- data.tar.gz: 6b2fa6645b7f949ca2c685d6367de355260f9e0a66c21676bc34534d1542a4dd2aadcf3755b69813f4562c08afecd51e391a3d6be4f188becddcddef7a45e12b
6
+ metadata.gz: 4fef805b6c67b1d45e623e95386cda60de7ec62dd71cfb5590b4f7bd3c00b65e9ece521686e7c2a18d03eeb42fc0b91ae61b0e3c49fc7e69951d75b404142a95
7
+ data.tar.gz: 60ace944bf79b1c168c32f471335f72a997b8bf3c868e2198a45a3cadbc8080eb2a85de09624e29d2edb97736f18c97b022adc7bf7537be476a80652a18be6dc
@@ -95,7 +95,7 @@ module ApiMe
95
95
  end
96
96
 
97
97
  def new
98
- render_errors(['new endpoint not supported'], 404)
98
+ render_errors(['new endpoint not supported'], :not_found)
99
99
  end
100
100
 
101
101
  def create
@@ -103,11 +103,11 @@ module ApiMe
103
103
  authorize_resource @object
104
104
  create_resource!
105
105
 
106
- render status: 201, json: @object, root: singular_root_key, serializer: serializer_klass
106
+ render status: :created, json: @object, root: singular_root_key, serializer: serializer_klass
107
107
  end
108
108
 
109
109
  def edit
110
- render_errors(['edit endpoint not supported'], 404)
110
+ render_errors(['edit endpoint not supported'], :not_found)
111
111
  end
112
112
 
113
113
  def update
@@ -116,7 +116,7 @@ module ApiMe
116
116
  authorize_resource @object
117
117
  update_resource!
118
118
 
119
- head 204
119
+ render status: :ok, json: @object, root: singular_root_key, serializer: serializer_klass
120
120
  end
121
121
 
122
122
  def destroy
@@ -124,7 +124,7 @@ module ApiMe
124
124
  authorize_resource @object
125
125
  destroy_resource!
126
126
 
127
- head 204
127
+ head :no_content
128
128
  end
129
129
 
130
130
  protected
@@ -149,7 +149,7 @@ module ApiMe
149
149
  params[:sort]
150
150
  end
151
151
 
152
- def render_errors(errors, status = 422)
152
+ def render_errors(errors, status = :unprocessable_entity)
153
153
  render(json: { errors: errors }, status: status)
154
154
  end
155
155
 
@@ -161,11 +161,11 @@ module ApiMe
161
161
 
162
162
  def user_not_authorized
163
163
  payload = { message: "User is not allowed to access #{params[:action]} on this resource" }
164
- render json: payload, status: 403
164
+ render json: payload, status: :forbidden
165
165
  end
166
166
 
167
167
  def resource_not_found
168
- head 404
168
+ head :not_found
169
169
  end
170
170
 
171
171
  def model_klass
@@ -227,7 +227,7 @@ module ApiMe
227
227
  end
228
228
 
229
229
  def find_resource
230
- @find_resource ||= model_klass.find_by_id!(params[:id])
230
+ @find_resource ||= model_klass.find_by!(id: params[:id])
231
231
  end
232
232
 
233
233
  def build_resource
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApiMe
4
- VERSION = '0.11.1'
4
+ VERSION = '0.12.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Clopton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-09 00:00:00.000000000 Z
12
+ date: 2020-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails