notifiable-apns-grocer 0.10.0 → 0.11.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
  SHA1:
3
- metadata.gz: 6a06d78cc911ead79cb82a82ac8d300356103c61
4
- data.tar.gz: a8ab71412ce38e6243ae014a01967033f76c0f99
3
+ metadata.gz: d50ae95d68648f0740d8a4ffb19f080f106c423b
4
+ data.tar.gz: 874fa74a2c4ce892d38fd48c1a4727a61e56f737
5
5
  SHA512:
6
- metadata.gz: 2b58e61ad194010c7893140834ec7a87b1e90a227943cdf9211bf95af62646b25703a18d3316b919169585fbd68dfa7686d7a8fb2155779fbbd24a98af872e28
7
- data.tar.gz: 1ca98ff7c33c18737dca7a9b7b957685c526d9c9da339baae973fc9757a5c989e2f409527bd69d29e2610f16340fd5300978d8ae6beb45509928a0bf5fc1a9ea
6
+ metadata.gz: e740ef4e3559dd85c1a4d7b75e0bf0ae3ddc54e0a6ee11dc9ecb0d215556761d028fbc49151b199733326afa78fbe4b8c7237fb027d2c6005122444e2364c54b
7
+ data.tar.gz: f4f51cdc7842c60f7c17afcfb38905609c805588aa73ff09906ccd73f6d0dfc672e9a2adf0d30f363d3c151b5f9bbe8c657c4ceab6a431dc735e9336dff5b29a
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.0.0-p247
1
+ 2.1.0
data/README.md CHANGED
@@ -1,3 +1,29 @@
1
1
  # Notifiable::Apns::Grocer
2
2
 
3
- Please refer to the [notifiable-rails](https://github.com/FutureWorkshops/notifiable-rails) Readme for further information.
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'notifiable-apns-grocer'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install notifiable-apns-grocer
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -16,12 +16,12 @@ module Notifiable
16
16
  end
17
17
 
18
18
  protected
19
- def enqueue(device_token)
19
+ def enqueue(device_token, localized_notification)
20
20
 
21
21
  grocer_notification = ::Grocer::Notification.new(
22
22
  device_token: device_token.token,
23
- alert: notification.message,
24
- custom: notification.send_params
23
+ alert: localized_notification.message,
24
+ custom: localized_notification.send_params
25
25
  )
26
26
 
27
27
  pusher_pool.with do |pusher|
@@ -59,7 +59,7 @@ module Notifiable
59
59
  {
60
60
  certificate: self.certificate,
61
61
  passphrase: self.passphrase,
62
- gateway: self.test_env? ? "localhost" : self.sandbox? ? "gateway.sandbox.push.apple.com" : "gateway.push.apple.com",
62
+ gateway: self.test_env? ? "localhost" : sandbox? ? "gateway.sandbox.push.apple.com" : "gateway.push.apple.com",
63
63
  port: 2195,
64
64
  retries: 3
65
65
  }
@@ -98,4 +98,4 @@ module Notifiable
98
98
  end
99
99
  end
100
100
  end
101
- end
101
+ end
@@ -1,7 +1,7 @@
1
1
  module Notifiable
2
2
  module Apns
3
3
  module Grocer
4
- VERSION = "0.10.0"
4
+ VERSION = "0.11.0"
5
5
  end
6
6
  end
7
7
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "notifiable-rails", ">=0.19.0"
21
+ spec.add_dependency "notifiable-rails", ">=0.21.0"
22
22
  spec.add_dependency "grocer", '~> 0.5.0'
23
23
  spec.add_dependency "connection_pool", '~> 2.0.0'
24
24
 
data/spec/stream_spec.rb CHANGED
@@ -3,11 +3,12 @@ require 'spec_helper'
3
3
  describe Notifiable::Apns::Grocer::Stream do
4
4
 
5
5
  let(:a) { Notifiable::App.create }
6
- let(:n1) { Notifiable::Notification.create(:message => "Test message", :app => a) }
7
- let(:n1_with_params) { Notifiable::Notification.create(:message => "Test message", :app => a, :params => {:flag => true}) }
8
- let(:d) { Notifiable::DeviceToken.create(:token => "ABC123", :provider => :apns, :app => a) }
6
+ let(:n1) { Notifiable::Notification.create(:app => a) }
7
+ let!(:ln) { Notifiable::LocalizedNotification.create(:message => "Test message", :params => {:flag => true}, :notification => n1, :locale => :en) }
8
+ let(:d) { Notifiable::DeviceToken.create(:token => "ABC123", :provider => :apns, :app => a, :locale => :en) }
9
9
 
10
10
  it "sends a single notification" do
11
+
11
12
  n1.batch do |n|
12
13
  n.add_device_token(d)
13
14
  end
@@ -18,12 +19,12 @@ describe Notifiable::Apns::Grocer::Stream do
18
19
  Timeout.timeout(2) {
19
20
  notification = @grocer.notifications.pop
20
21
  notification.alert.should eql "Test message"
21
- notification.custom[:notification_id].should == n1.id
22
+ notification.custom[:localized_notification_id].should == ln.id
22
23
  }
23
24
  end
24
25
 
25
26
  it "supports custom properties" do
26
- n1_with_params.batch do |n|
27
+ n1.batch do |n|
27
28
  n.add_device_token(d)
28
29
  end
29
30
 
@@ -32,7 +33,7 @@ describe Notifiable::Apns::Grocer::Stream do
32
33
 
33
34
  Timeout.timeout(2) {
34
35
  notification = @grocer.notifications.pop
35
- notification.custom[:notification_id].should == n1_with_params.id
36
+ notification.custom[:localized_notification_id].should == ln.id
36
37
  notification.custom[:flag].should == true
37
38
  }
38
39
  end
@@ -42,7 +43,8 @@ describe Notifiable::Apns::Grocer::Stream do
42
43
  a.configuration = {:apns => {:sandbox => "0"}} # This is how production is configured
43
44
  a.configure(:apns, g)
44
45
 
45
- expect(g.send(:sandbox?)).to be_falsey
46
+ expect(g.send(:sandbox?)).to eq false
47
+
46
48
  end
47
49
 
48
50
  it "has default connection pool size" do
@@ -4,6 +4,7 @@ class CreateNotifiableDeviceTokens < ActiveRecord::Migration
4
4
  create_table :notifiable_device_tokens do |t|
5
5
  t.string :token
6
6
  t.string :provider
7
+ t.string :locale
7
8
  t.boolean :is_valid, :default => true
8
9
  t.integer :user_id
9
10
  t.references :app
@@ -11,7 +12,7 @@ class CreateNotifiableDeviceTokens < ActiveRecord::Migration
11
12
  t.timestamps
12
13
  end
13
14
 
14
- add_index :notifiable_device_tokens, :token
15
+ add_index :notifiable_device_tokens, :token, :unique => true
15
16
  add_index :notifiable_device_tokens, :user_id
16
17
  end
17
18
 
@@ -2,8 +2,6 @@ class CreateNotifiableNotifications < ActiveRecord::Migration
2
2
 
3
3
  def change
4
4
  create_table :notifiable_notifications do |t|
5
- t.text :message
6
- t.text :params
7
5
  t.references :app
8
6
 
9
7
  #stats
@@ -11,14 +9,6 @@ class CreateNotifiableNotifications < ActiveRecord::Migration
11
9
  t.integer :gateway_accepted_count, :default => 0
12
10
  t.integer :opened_count, :default => 0
13
11
 
14
- # APNS - Optional
15
- #t.integer :badge
16
- #t.text :sound
17
- #t.datetime :expiry
18
-
19
- # MPNS - Optional
20
- #t.text :title
21
-
22
12
  t.timestamps
23
13
  end
24
14
  end
@@ -0,0 +1,22 @@
1
+ class CreateNotifiableLocalizedNotifications < ActiveRecord::Migration
2
+
3
+ def change
4
+ create_table :notifiable_localized_notifications do |t|
5
+ t.text :message
6
+ t.text :params
7
+ t.string :locale
8
+ t.references :notification
9
+
10
+ # APNS - Optional
11
+ #t.integer :badge
12
+ #t.text :sound
13
+ #t.datetime :expiry
14
+
15
+ # MPNS - Optional
16
+ #t.text :title
17
+
18
+ t.timestamps
19
+ end
20
+ end
21
+
22
+ end
@@ -2,7 +2,7 @@ class CreateNotifiableStatuses < ActiveRecord::Migration
2
2
 
3
3
  def change
4
4
  create_table :notifiable_statuses do |t|
5
- t.references :notification
5
+ t.references :localized_notification
6
6
  t.references :device_token
7
7
  t.integer :status
8
8
  t.datetime :created_at
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifiable-apns-grocer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamil Kocemba
@@ -9,160 +9,160 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-07 00:00:00.000000000 Z
12
+ date: 2015-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: notifiable-rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 0.19.0
20
+ version: 0.21.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 0.19.0
27
+ version: 0.21.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: grocer
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.5.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 0.5.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: connection_pool
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: 2.0.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: 2.0.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: bundler
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.3'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.3'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rake
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rspec
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: simplecov
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - '>='
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: simplecov-rcov
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - '>='
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - '>='
123
+ - - ">="
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: sqlite3
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '>='
130
+ - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - '>='
137
+ - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: database_cleaner
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - '>='
144
+ - - ">="
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - '>='
151
+ - - ">="
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: ruby-prof
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - '>='
158
+ - - ">="
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  type: :development
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - '>='
165
+ - - ">="
166
166
  - !ruby/object:Gem::Version
167
167
  version: '0'
168
168
  description: Plugin to use Grocer for APNS with Notifiable-Rails
@@ -173,9 +173,9 @@ executables: []
173
173
  extensions: []
174
174
  extra_rdoc_files: []
175
175
  files:
176
- - .gitignore
177
- - .ruby-gemset
178
- - .ruby-version
176
+ - ".gitignore"
177
+ - ".ruby-gemset"
178
+ - ".ruby-version"
179
179
  - Gemfile
180
180
  - LICENSE
181
181
  - LICENSE.txt
@@ -188,10 +188,11 @@ files:
188
188
  - notifiable-apns-grocer.gemspec
189
189
  - spec/spec_helper.rb
190
190
  - spec/stream_spec.rb
191
- - spec/support/db/migrate/20131228225138_create_notifiable_apps.rb
192
- - spec/support/db/migrate/20131228225139_create_notifiable_device_tokens.rb
193
- - spec/support/db/migrate/20131228225140_create_notifiable_notifications.rb
194
- - spec/support/db/migrate/20131229104039_create_notifiable_statuses.rb
191
+ - spec/support/db/migrate/20131210115648_create_notifiable_apps.rb
192
+ - spec/support/db/migrate/20131210115649_create_notifiable_device_tokens.rb
193
+ - spec/support/db/migrate/20131210115650_create_notifiable_notifications.rb
194
+ - spec/support/db/migrate/20131210115651_create_notifiable_localized_notifications.rb
195
+ - spec/support/db/migrate/20131210115652_create_notifiable_statuses.rb
195
196
  homepage: http://www.futureworkshops.com
196
197
  licenses:
197
198
  - Apache 2.0
@@ -202,24 +203,25 @@ require_paths:
202
203
  - lib
203
204
  required_ruby_version: !ruby/object:Gem::Requirement
204
205
  requirements:
205
- - - '>='
206
+ - - ">="
206
207
  - !ruby/object:Gem::Version
207
208
  version: '0'
208
209
  required_rubygems_version: !ruby/object:Gem::Requirement
209
210
  requirements:
210
- - - '>='
211
+ - - ">="
211
212
  - !ruby/object:Gem::Version
212
213
  version: '0'
213
214
  requirements: []
214
215
  rubyforge_project:
215
- rubygems_version: 2.0.14
216
+ rubygems_version: 2.2.2
216
217
  signing_key:
217
218
  specification_version: 4
218
219
  summary: Plugin to use Grocer for APNS with Notifiable-Rails
219
220
  test_files:
220
221
  - spec/spec_helper.rb
221
222
  - spec/stream_spec.rb
222
- - spec/support/db/migrate/20131228225138_create_notifiable_apps.rb
223
- - spec/support/db/migrate/20131228225139_create_notifiable_device_tokens.rb
224
- - spec/support/db/migrate/20131228225140_create_notifiable_notifications.rb
225
- - spec/support/db/migrate/20131229104039_create_notifiable_statuses.rb
223
+ - spec/support/db/migrate/20131210115648_create_notifiable_apps.rb
224
+ - spec/support/db/migrate/20131210115649_create_notifiable_device_tokens.rb
225
+ - spec/support/db/migrate/20131210115650_create_notifiable_notifications.rb
226
+ - spec/support/db/migrate/20131210115651_create_notifiable_localized_notifications.rb
227
+ - spec/support/db/migrate/20131210115652_create_notifiable_statuses.rb