devise-onesignal 3.0.2 → 3.1.0
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 +4 -4
- data/.gitignore +0 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +10 -1
- data/Gemfile.lock +113 -0
- data/INSTALL.md +7 -2
- data/README.md +18 -4
- data/Rakefile +9 -2
- data/devise-onesignal.gemspec +3 -3
- data/lib/devise-onesignal/owner.rb +27 -0
- data/lib/devise-onesignal/version.rb +1 -1
- data/lib/devise-onesignal.rb +26 -25
- metadata +26 -20
- data/init.rb +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d9e5ad1ce6da31b0de146c77e22e4b289a60818ce44961b0a1b7854c2d23818
|
|
4
|
+
data.tar.gz: 00e096d150dbc640a0a88d7ec17322fe521cecc2a512cc31f99d90bc26abbe49
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e359e72bf1879b7c6d23c367bdec8337c3c123e4cd789f2dd3b0da683fd086f74e0312e3c8cc11a2bc87cf5ccde386e8450e66d5b3277d0799322dabb1aa01d0
|
|
7
|
+
data.tar.gz: ce6e1d15266790c543abf6647c997c7e73cf82b62289e41e4493af0f929f31aceb72e0d7f7b98feba7ba56c536381e5edc7c569345e5814d36a2d8de37251a3f
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
source '
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
3
|
git_source :github do |repo_name|
|
|
4
4
|
"https://github.com/#{repo_name}"
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
gemspec
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Travis CI
|
|
11
|
+
gem 'rspec-rails', '~> 3.7'
|
|
12
|
+
|
|
13
|
+
# Development
|
|
14
|
+
group :development do
|
|
15
|
+
gem 'rubocop', '~> 0.52', require: false
|
|
16
|
+
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
devise-onesignal (3.1.0)
|
|
5
|
+
railties (>= 5.0)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
actionpack (5.1.4)
|
|
11
|
+
actionview (= 5.1.4)
|
|
12
|
+
activesupport (= 5.1.4)
|
|
13
|
+
rack (~> 2.0)
|
|
14
|
+
rack-test (>= 0.6.3)
|
|
15
|
+
rails-dom-testing (~> 2.0)
|
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
17
|
+
actionview (5.1.4)
|
|
18
|
+
activesupport (= 5.1.4)
|
|
19
|
+
builder (~> 3.1)
|
|
20
|
+
erubi (~> 1.4)
|
|
21
|
+
rails-dom-testing (~> 2.0)
|
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
23
|
+
activesupport (5.1.4)
|
|
24
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
25
|
+
i18n (~> 0.7)
|
|
26
|
+
minitest (~> 5.1)
|
|
27
|
+
tzinfo (~> 1.1)
|
|
28
|
+
ast (2.3.0)
|
|
29
|
+
builder (3.2.3)
|
|
30
|
+
concurrent-ruby (1.0.5)
|
|
31
|
+
crass (1.0.3)
|
|
32
|
+
diff-lcs (1.3)
|
|
33
|
+
erubi (1.7.0)
|
|
34
|
+
i18n (0.9.1)
|
|
35
|
+
concurrent-ruby (~> 1.0)
|
|
36
|
+
loofah (2.1.1)
|
|
37
|
+
crass (~> 1.0.2)
|
|
38
|
+
nokogiri (>= 1.5.9)
|
|
39
|
+
method_source (0.9.0)
|
|
40
|
+
mini_portile2 (2.3.0)
|
|
41
|
+
minitest (5.10.3)
|
|
42
|
+
nokogiri (1.8.1)
|
|
43
|
+
mini_portile2 (~> 2.3.0)
|
|
44
|
+
nokogiri (1.8.1-x86-mingw32)
|
|
45
|
+
mini_portile2 (~> 2.3.0)
|
|
46
|
+
parallel (1.12.1)
|
|
47
|
+
parser (2.4.0.2)
|
|
48
|
+
ast (~> 2.3)
|
|
49
|
+
powerpack (0.1.1)
|
|
50
|
+
rack (2.0.3)
|
|
51
|
+
rack-test (0.8.2)
|
|
52
|
+
rack (>= 1.0, < 3)
|
|
53
|
+
rails-dom-testing (2.0.3)
|
|
54
|
+
activesupport (>= 4.2.0)
|
|
55
|
+
nokogiri (>= 1.6)
|
|
56
|
+
rails-html-sanitizer (1.0.3)
|
|
57
|
+
loofah (~> 2.0)
|
|
58
|
+
railties (5.1.4)
|
|
59
|
+
actionpack (= 5.1.4)
|
|
60
|
+
activesupport (= 5.1.4)
|
|
61
|
+
method_source
|
|
62
|
+
rake (>= 0.8.7)
|
|
63
|
+
thor (>= 0.18.1, < 2.0)
|
|
64
|
+
rainbow (3.0.0)
|
|
65
|
+
rake (10.5.0)
|
|
66
|
+
rspec (3.7.0)
|
|
67
|
+
rspec-core (~> 3.7.0)
|
|
68
|
+
rspec-expectations (~> 3.7.0)
|
|
69
|
+
rspec-mocks (~> 3.7.0)
|
|
70
|
+
rspec-core (3.7.0)
|
|
71
|
+
rspec-support (~> 3.7.0)
|
|
72
|
+
rspec-expectations (3.7.0)
|
|
73
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
74
|
+
rspec-support (~> 3.7.0)
|
|
75
|
+
rspec-mocks (3.7.0)
|
|
76
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
77
|
+
rspec-support (~> 3.7.0)
|
|
78
|
+
rspec-rails (3.7.2)
|
|
79
|
+
actionpack (>= 3.0)
|
|
80
|
+
activesupport (>= 3.0)
|
|
81
|
+
railties (>= 3.0)
|
|
82
|
+
rspec-core (~> 3.7.0)
|
|
83
|
+
rspec-expectations (~> 3.7.0)
|
|
84
|
+
rspec-mocks (~> 3.7.0)
|
|
85
|
+
rspec-support (~> 3.7.0)
|
|
86
|
+
rspec-support (3.7.0)
|
|
87
|
+
rubocop (0.52.0)
|
|
88
|
+
parallel (~> 1.10)
|
|
89
|
+
parser (>= 2.4.0.2, < 3.0)
|
|
90
|
+
powerpack (~> 0.1)
|
|
91
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
92
|
+
ruby-progressbar (~> 1.7)
|
|
93
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
94
|
+
ruby-progressbar (1.9.0)
|
|
95
|
+
thor (0.20.0)
|
|
96
|
+
thread_safe (0.3.6)
|
|
97
|
+
tzinfo (1.2.4)
|
|
98
|
+
thread_safe (~> 0.1)
|
|
99
|
+
unicode-display_width (1.3.0)
|
|
100
|
+
|
|
101
|
+
PLATFORMS
|
|
102
|
+
ruby
|
|
103
|
+
x86-mingw32
|
|
104
|
+
x86_64-linux
|
|
105
|
+
|
|
106
|
+
DEPENDENCIES
|
|
107
|
+
devise-onesignal!
|
|
108
|
+
rspec (~> 3.7)
|
|
109
|
+
rspec-rails (~> 3.7)
|
|
110
|
+
rubocop (~> 0.52)
|
|
111
|
+
|
|
112
|
+
BUNDLED WITH
|
|
113
|
+
1.16.0
|
data/INSTALL.md
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
**Thank you for installing devise-onesignal!**
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
There are
|
|
4
|
+
There are four wo more steps to take:
|
|
5
5
|
|
|
6
6
|
1) Enter your OneSignal App ID in config/initializers/devise-onesignal.rb
|
|
7
|
-
2) Run `rails g
|
|
7
|
+
2) Run `rails g devise_onesignal` and `rails db:migrate`
|
|
8
8
|
3) Add:
|
|
9
9
|
|
|
10
10
|
//= require OneSignalSDK
|
|
11
11
|
//= require devise-onesignal
|
|
12
12
|
|
|
13
13
|
to your javascript index in app/assets/javascripts/application.js
|
|
14
|
+
4) Add:
|
|
15
|
+
|
|
16
|
+
has_devices
|
|
17
|
+
|
|
18
|
+
to your authentication model
|
|
14
19
|
|
|
15
20
|
|
|
16
21
|
Learn more at https://github.com/jonhue/devise-onesignal
|
data/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/devise-onesignal) <img src="https://travis-ci.org/jonhue/devise-onesignal.svg?branch=master" />
|
|
4
4
|
|
|
5
|
-
Implement user targeted cross-platform notifications with OneSignal & Devise in your Rails app.
|
|
5
|
+
Implement user targeted cross-platform notifications with OneSignal & Devise in your Rails app. Can also be used without Devise, but is primarily intended to be used along with some sort of user-management-system.
|
|
6
6
|
|
|
7
|
-
This gem works well together with [notifications-rails](https://github.com/jonhue/notifications-rails) which introduces a notifications handling & pushing API. To build a cross-platform notification solution also add the [native](https://github.com/NativeGap/native-ruby) gem to your app.
|
|
7
|
+
This gem works well together with [notifications-rails](https://github.com/jonhue/notifications-rails) and its [notification-pusher-onesignal](https://github.com/jonhue/notifications-rails/tree/master/notification-pusher/notification-pusher-onesignal) component which introduces a notifications handling & pushing API. To build a cross-platform notification solution also add the [native](https://github.com/NativeGap/native-ruby) gem to your app.
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -61,7 +61,7 @@ It is time to [create your OneSignal app](https://onesignal.com) if you haven't
|
|
|
61
61
|
Define an association in those models whose objects are supposed to be associated with OneSignal players. For example `User` in `app/models/user.rb`.
|
|
62
62
|
|
|
63
63
|
```ruby
|
|
64
|
-
|
|
64
|
+
has_devices
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
Now let us include the neccessary javascript files in our application (`apps/assets/javascripts/application.js`):
|
|
@@ -127,6 +127,20 @@ d.onesignal_disabled?
|
|
|
127
127
|
d.onesignal_set?
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
+
### has_devices
|
|
131
|
+
|
|
132
|
+
This method makes `devices` available in your models. Let's say you have a user which has multiple devices he has enabled OneSignal on:
|
|
133
|
+
|
|
134
|
+
```ruby
|
|
135
|
+
u = User.first
|
|
136
|
+
|
|
137
|
+
# All devices of a user
|
|
138
|
+
u.devices
|
|
139
|
+
|
|
140
|
+
# All OneSignal Player ID's of a user returned as a hash
|
|
141
|
+
u.onesignal_player_ids
|
|
142
|
+
```
|
|
143
|
+
|
|
130
144
|
### current_device
|
|
131
145
|
|
|
132
146
|
In your controllers and views you can access a `current_device` method that returns the `Device` object of the current OneSignal subscription. If the user browsing your site is not subscribed to OneSignal, `current_device` returns an uncommitted `Device` object with some helpful information, like the `permission` attribute, set.
|
|
@@ -173,7 +187,7 @@ To propose your ideas, initiate the discussion by adding a [new issue](https://g
|
|
|
173
187
|
|
|
174
188
|
## Contributing
|
|
175
189
|
|
|
176
|
-
We hope that you will consider contributing to
|
|
190
|
+
We hope that you will consider contributing to devise-onesignal. Please read this short overview for some information about how to get started:
|
|
177
191
|
|
|
178
192
|
[Learn more about contributing to this repository](https://github.com/jonhue/devise-onesignal/blob/master/CONTRIBUTING.md), [Code of Conduct](https://github.com/jonhue/devise-onesignal/blob/master/CODE_OF_CONDUCT.md)
|
|
179
193
|
|
data/Rakefile
CHANGED
data/devise-onesignal.gemspec
CHANGED
|
@@ -17,9 +17,9 @@ Gem::Specification.new do |gem|
|
|
|
17
17
|
|
|
18
18
|
gem.post_install_message = IO.read('INSTALL.md')
|
|
19
19
|
|
|
20
|
+
gem.add_dependency 'railties', '>= 5.0'
|
|
20
21
|
gem.required_ruby_version = '>= 2.3'
|
|
21
22
|
|
|
22
|
-
gem.add_development_dependency '
|
|
23
|
-
gem.add_development_dependency '
|
|
24
|
-
gem.add_dependency 'rails', '>= 5.0'
|
|
23
|
+
gem.add_development_dependency 'rspec', '~> 3.7'
|
|
24
|
+
gem.add_development_dependency 'rubocop', '~> 0.52'
|
|
25
25
|
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module DeviseOnesignal
|
|
2
|
+
module Owner
|
|
3
|
+
|
|
4
|
+
def self.included base
|
|
5
|
+
base.extend ClassMethods
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module ClassMethods
|
|
9
|
+
def has_devices
|
|
10
|
+
has_many :devices, as: :owner, dependent: :destroy
|
|
11
|
+
include DeviseOnesignal::Owner::InstanceMethods
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
module InstanceMethods
|
|
16
|
+
|
|
17
|
+
def onesignal_player_ids
|
|
18
|
+
onesignal_player_ids = []
|
|
19
|
+
self.devices.each do |device|
|
|
20
|
+
onesignal_player_ids << device.onesignal_id
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
end
|
data/lib/devise-onesignal.rb
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
require 'devise-onesignal/version'
|
|
2
|
-
|
|
3
|
-
module DeviseOnesignal
|
|
4
|
-
|
|
5
|
-
autoload :Configuration, 'devise-onesignal/configuration'
|
|
6
|
-
|
|
7
|
-
class << self
|
|
8
|
-
attr_accessor :configuration
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def self.configure
|
|
12
|
-
self.configuration ||= Configuration.new
|
|
13
|
-
yield configuration
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
autoload :DeviceLib, 'devise-onesignal/device_lib'
|
|
17
|
-
|
|
18
|
-
autoload :
|
|
19
|
-
autoload :
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
require 'devise-onesignal/version'
|
|
2
|
+
|
|
3
|
+
module DeviseOnesignal
|
|
4
|
+
|
|
5
|
+
autoload :Configuration, 'devise-onesignal/configuration'
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
attr_accessor :configuration
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.configure
|
|
12
|
+
self.configuration ||= Configuration.new
|
|
13
|
+
yield configuration
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
autoload :DeviceLib, 'devise-onesignal/device_lib'
|
|
17
|
+
|
|
18
|
+
autoload :Owner, 'devise-onesignal/owner'
|
|
19
|
+
autoload :DeviceConcern, 'devise-onesignal/device_concern'
|
|
20
|
+
autoload :DeviceHelper, 'devise-onesignal/device_helper'
|
|
21
|
+
require 'devise-onesignal/railtie'
|
|
22
|
+
|
|
23
|
+
class Engine < ::Rails::Engine
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
metadata
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: devise-onesignal
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonas Hübotter
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-12-
|
|
11
|
+
date: 2017-12-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: railties
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
20
|
-
type: :
|
|
19
|
+
version: '5.0'
|
|
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: '
|
|
26
|
+
version: '5.0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: rspec
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '3.7'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '3.7'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
42
|
+
name: rubocop
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - "
|
|
45
|
+
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
48
|
-
type: :
|
|
47
|
+
version: '0.52'
|
|
48
|
+
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- - "
|
|
52
|
+
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '0.52'
|
|
55
55
|
description: Implement user targeted cross-platform notifications with OneSignal &
|
|
56
56
|
Devise in your Rails app. This gem can also be used without Devise, but it is primarily
|
|
57
57
|
intended to be used along with some sort of user-management-system.
|
|
@@ -69,17 +69,18 @@ files:
|
|
|
69
69
|
- CONTRIBUTING.md
|
|
70
70
|
- DEPRECATIONS.md
|
|
71
71
|
- Gemfile
|
|
72
|
+
- Gemfile.lock
|
|
72
73
|
- INSTALL.md
|
|
73
74
|
- LICENSE
|
|
74
75
|
- README.md
|
|
75
76
|
- Rakefile
|
|
76
77
|
- devise-onesignal.gemspec
|
|
77
|
-
- init.rb
|
|
78
78
|
- lib/devise-onesignal.rb
|
|
79
79
|
- lib/devise-onesignal/configuration.rb
|
|
80
80
|
- lib/devise-onesignal/device_concern.rb
|
|
81
81
|
- lib/devise-onesignal/device_helper.rb
|
|
82
82
|
- lib/devise-onesignal/device_lib.rb
|
|
83
|
+
- lib/devise-onesignal/owner.rb
|
|
83
84
|
- lib/devise-onesignal/railtie.rb
|
|
84
85
|
- lib/devise-onesignal/version.rb
|
|
85
86
|
- lib/generators/devise_onesignal_generator.rb
|
|
@@ -97,16 +98,21 @@ post_install_message: |
|
|
|
97
98
|
**Thank you for installing devise-onesignal!**
|
|
98
99
|
|
|
99
100
|
|
|
100
|
-
There are
|
|
101
|
+
There are four wo more steps to take:
|
|
101
102
|
|
|
102
103
|
1) Enter your OneSignal App ID in config/initializers/devise-onesignal.rb
|
|
103
|
-
2) Run `rails g
|
|
104
|
+
2) Run `rails g devise_onesignal` and `rails db:migrate`
|
|
104
105
|
3) Add:
|
|
105
106
|
|
|
106
107
|
//= require OneSignalSDK
|
|
107
108
|
//= require devise-onesignal
|
|
108
109
|
|
|
109
110
|
to your javascript index in app/assets/javascripts/application.js
|
|
111
|
+
4) Add:
|
|
112
|
+
|
|
113
|
+
has_devices
|
|
114
|
+
|
|
115
|
+
to your authentication model
|
|
110
116
|
|
|
111
117
|
|
|
112
118
|
Learn more at https://github.com/jonhue/devise-onesignal
|
data/init.rb
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require 'devise-onesignal'
|