fwt_push_notification_server 0.0.7 → 0.1.0.b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/fwt_push_notification_server/device_tokens_controller.rb +11 -5
- data/app/models/fwt_push_notification_server/device_token.rb +5 -3
- data/lib/fwt_push_notification_server/version.rb +1 -1
- data/lib/fwt_push_notification_server.rb +2 -4
- data/lib/generators/fwt_push_notification_server/install/templates/initializer.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaeff25a08d2805b6ea4dd798c57d06e1caa6bb3
|
4
|
+
data.tar.gz: a46320c2146997d72d5dd5a208312fce3b3fd5b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db71a20b67a6cb9807ed33af8d35bb591bac702f09308540cc523d50bd50b661f24cd5ac209876ba782b38f249c32224b3530d0096087f7d2eab37ae9d574131
|
7
|
+
data.tar.gz: 63fe879b2bb6628299ef9ba2cf5b43a23cb929ed6e272f10ac78aeeb96843c547f7fe0c27431ff7ebcc59e44a42bbddc279c4ebf2cbe78cdcb428b7172145fb5
|
@@ -11,13 +11,15 @@ module FwtPushNotificationServer
|
|
11
11
|
:user_id => params[:user_id],
|
12
12
|
:provider => params[:provider]
|
13
13
|
})
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
|
15
|
+
user = @device_token.user
|
16
|
+
user.update_attributes(user_info_params) if user_info_params
|
17
|
+
|
18
|
+
if @device_token.save
|
19
|
+
render :json => { :status => 0 }
|
17
20
|
else
|
18
|
-
|
21
|
+
render :json => { :errors => @device_token.errors.full_messages }
|
19
22
|
end
|
20
|
-
render :json => { :status => status }
|
21
23
|
end
|
22
24
|
|
23
25
|
private
|
@@ -25,6 +27,10 @@ module FwtPushNotificationServer
|
|
25
27
|
params.permit(:token, :user_id, :provider)
|
26
28
|
end
|
27
29
|
|
30
|
+
def user_info_params
|
31
|
+
params[:user].permit(FwtPushNotificationServer.permitted_user_attributes)
|
32
|
+
end
|
33
|
+
|
28
34
|
end
|
29
35
|
|
30
36
|
end
|
@@ -3,15 +3,17 @@ module FwtPushNotificationServer
|
|
3
3
|
class DeviceToken < ActiveRecord::Base
|
4
4
|
|
5
5
|
validates_uniqueness_of :token
|
6
|
+
validates_presence_of :token
|
7
|
+
validates_presence_of :provider
|
6
8
|
|
7
9
|
def user
|
8
|
-
user_id.blank? ? nil : FwtPushNotificationServer.user_class.
|
10
|
+
user_id.blank? ? nil : FwtPushNotificationServer.user_class.find_or_create_by(FwtPushNotificationServer.user_key => user_id)
|
9
11
|
end
|
10
12
|
|
11
13
|
def notifier
|
12
14
|
return nil if provider.nil?
|
13
|
-
|
14
|
-
|
15
|
+
FwtPushNotificationServer.notifiers[provider.to_sym]
|
16
|
+
end
|
15
17
|
|
16
18
|
end
|
17
19
|
|
@@ -7,11 +7,10 @@ module FwtPushNotificationServer
|
|
7
7
|
|
8
8
|
mattr_accessor :api_controller_class
|
9
9
|
|
10
|
-
mattr_accessor :authentication_filter
|
11
|
-
@@authentication_filter = :authenticate_user!
|
12
|
-
|
13
10
|
mattr_accessor :user_class
|
14
11
|
|
12
|
+
mattr_accessor :permitted_user_attributes
|
13
|
+
|
15
14
|
mattr_accessor :user_key
|
16
15
|
@@user_key = :user_id
|
17
16
|
|
@@ -22,7 +21,6 @@ module FwtPushNotificationServer
|
|
22
21
|
|
23
22
|
mattr_accessor :apns_passphrase
|
24
23
|
|
25
|
-
|
26
24
|
mattr_accessor :gcm_api_key
|
27
25
|
|
28
26
|
def self.configure
|
@@ -11,8 +11,8 @@ FwtPushNotificationServer.configure do |config|
|
|
11
11
|
|
12
12
|
# Devise integration
|
13
13
|
config.api_controller_class = ApplicationController
|
14
|
-
config.authentication_filter = :authenticate_user!
|
15
14
|
config.user_class = User
|
16
15
|
config.user_key = :user_id
|
16
|
+
config.permitted_user_attributes = :first_name, :last_name
|
17
17
|
|
18
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fwt_push_notification_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.1.0.b1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kamil Kocemba
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -135,9 +135,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- - '
|
138
|
+
- - '>'
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version:
|
140
|
+
version: 1.3.1
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
143
|
rubygems_version: 2.0.7
|