devise_multiple_token_auth 0.0.16 → 0.0.17

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
  SHA1:
3
- metadata.gz: bb48de57d0a93d9b937bb911a7f3c3ce82079cd7
4
- data.tar.gz: 60d71f9de683fb86c14adfcd7416314bdf2a1cf4
3
+ metadata.gz: 72f253368599738a5a38c09e82166e489fddb2a8
4
+ data.tar.gz: 9124b55ebd5474c53fa829bdbca9e2336edf87eb
5
5
  SHA512:
6
- metadata.gz: 3389410087989337c25fb10574b9d6246b8505b3d09498d4ad7bd3a0413ad5c3059ce2c321dcce03dffb364e0057d86c0025284fc813962674884c519d2793b8
7
- data.tar.gz: a0c412f517b8775356f3843b7c7d1dfbfe09dd5425f132d74bbd877344efef122257f48bd6e6ad5f1a0aa5b9207939b31300474e53679ccba1d33522bd10e257
6
+ metadata.gz: e526e66210dc2bae2e093e32944a57de17b1b407a79ac736f341a8007dbac5447d0f74f4a36e66f7736103e6ed92443360e6c13c316a25a8bf3e5334c145385e
7
+ data.tar.gz: 51cf64cc76b570959c339d72a5ebd9741d4053d6812fa467745dc71b129155f2079720330e93bff39a51dcc755d1194bd8c1b4ff0aaf4cf9d7f7e238ca482d22
@@ -0,0 +1,19 @@
1
+ class DeviseMultipleTokenAuth::DeviceUpdateController < ApplicationController
2
+
3
+ before_filter :authenticate_token_user!
4
+
5
+ respond_to :json
6
+
7
+ def update_push_token
8
+ if @device.update(push_token_params)
9
+ render json: @device
10
+ else
11
+ render json: {error: "Unable to update the device with those params"}, status: :unprocessable_entity
12
+ end
13
+ end
14
+
15
+ private
16
+ def push_token_params
17
+ params.permit(:push_token, :platform)
18
+ end
19
+ end
data/config/routes.rb CHANGED
@@ -2,6 +2,6 @@ Rails.application.routes.draw do
2
2
  namespace :devise_multiple_token_auth do
3
3
  post "auth/login", to: "token_authentication#login", defaults: { format: 'json'}
4
4
  delete "auth/logout", to: "token_authentication#logout", defaults: { format: 'json'}
5
- # put "update_push_token", to: "device_update_controller#update_push_token", defaults: { format: 'json'}
5
+ put "update_push_token", to: "device_update_controller#update_push_token", defaults: { format: 'json'}
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseMultipleTokenAuth
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.17"
3
3
  end
@@ -2,7 +2,7 @@ class CreateDeviseMultipleTokenAuthDevices < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :devise_multiple_token_auth_devices do |t|
4
4
  t.belongs_to :user, index: true
5
- t.string :auth_token
5
+ t.string :auth_token, null:false, index: {unique: true}
6
6
  t.datetime :expires_at
7
7
  t.timestamps null: false
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_multiple_token_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Juncker
@@ -49,6 +49,7 @@ extra_rdoc_files: []
49
49
  files:
50
50
  - MIT-LICENSE
51
51
  - Rakefile
52
+ - app/controllers/devise_multiple_token_auth/device_update_controller.rb
52
53
  - app/controllers/devise_multiple_token_auth/token_authentication_controller.rb
53
54
  - app/models/devise_multiple_token_auth/device.rb
54
55
  - app/models/devise_multiple_token_auth/device/android.rb