notifiable-rails 0.15.0 → 0.15.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb5eab29cc6539244ece34f9f2b108e97981d1cf
4
- data.tar.gz: 65042149c18b114e5fd5a51a4a71563ae9596936
3
+ metadata.gz: 517b2ed6174e9bd62e6e780f4f83b4e8615a33df
4
+ data.tar.gz: e6d16036d447f3ce4e252bd5338fab1ca86e7384
5
5
  SHA512:
6
- metadata.gz: afd76004ab58afdd3fbf8530ca0af6d58a16c20099430a501bccadd8b580514a222b9b0732e1fc1e5668292e5c5a97a0d2ca8bff86ad985487fc4d5718179eb1
7
- data.tar.gz: d1daec32f88873a4ccbad00cd2ae0f29ea637ccdeef5fe3032a5d81d3dc802a0f6ade0d5525f3bc8673e20f6bb1bde644094ba2834e1b82fea24ad86df6bb113
6
+ metadata.gz: abe080484c13af1cff08c15ebf90ebcde24204180061ff91222a2336e4f97329d3aee1830d623d248be179f220b5983b1524e9d952505cfd18e97cca2a24a46a
7
+ data.tar.gz: 26d5b31cf9d864c182cdaf9088c5f9a83ab8bdd6c09ef6da254c9cd3f5b14fe5e14c41b513fa36d9c681e1003a52c99b58b5b37e77360e430364ef8751d3bca0
@@ -13,11 +13,19 @@ module Notifiable
13
13
  @device_token = DeviceToken.find_by(:token => params[:token])
14
14
  @device_token = DeviceToken.new unless @device_token
15
15
 
16
- perform_update(device_token_params)
16
+ if @device_token.update_attributes(device_token_params)
17
+ render :json => { :id => @device_token.id }, :status => :ok
18
+ else
19
+ render :json => { :errors => @device_token.errors.full_messages }, :status => :unprocessable_entity
20
+ end
17
21
  end
18
22
 
19
23
  def update
20
- perform_update(device_token_params)
24
+ if @device_token.update_attributes(device_token_params)
25
+ head :status => :ok
26
+ else
27
+ render :json => { :errors => @device_token.errors.full_messages }, :status => :unprocessable_entity
28
+ end
21
29
  end
22
30
 
23
31
  def destroy
@@ -28,15 +36,7 @@ module Notifiable
28
36
  end
29
37
  end
30
38
 
31
- private
32
- def perform_update(params)
33
- if @device_token.update_attributes(params)
34
- render :json => @device_token, :status => :ok
35
- else
36
- render :json => { :errors => @device_token.errors.full_messages }, :status => :unprocessable_entity
37
- end
38
- end
39
-
39
+ private
40
40
  def device_token_params
41
41
  device_token_params = params.permit(Notifiable.api_device_token_params)
42
42
 
@@ -1,3 +1,3 @@
1
1
  module Notifiable
2
- VERSION = "0.15.0"
2
+ VERSION = "0.15.1"
3
3
  end