notifiable-apns-grocer 0.6.0 → 0.7.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: 89cdd826c462dcfdd546db1aabcb4d19e4d9a02e
4
- data.tar.gz: 7a0e1e9a9e1108b0ba820e57f8b4fd2b88fc8695
3
+ metadata.gz: e0da6abf688b70927c776b96a722d5327e34099a
4
+ data.tar.gz: 157899440c6e07fcab402ddc43d4e3de33dbd8d7
5
5
  SHA512:
6
- metadata.gz: f2410b6777b0c39a472d1814dd39b04062f023b299063907f53ff8d7783db47c65ea40e624a039b5f027dc90ca1674dc10d3c74db41f22e01be3f9f018b2d0b2
7
- data.tar.gz: ae01dca01d59761baef1d1c28f946a3e7c304ffee581feb0da5d0df84f794988416a56f964519accb9547ec2e18f465ddb20bafdac110f50cf80a07f08f65a01
6
+ metadata.gz: acf96da601806993a63080f8cabcb2d2d20d3ade7631613724a25abc2b786e3b2b8ca4bb559eff9fd856f18c6de495f3e6dec8110ef6413d517f1c2b296c6c8e
7
+ data.tar.gz: e7ed1687ee1cb2780e016d6375c7403e64394b45462ab862f8d859c2ed0fe90cf83d2eadc624ab5593125282863e558f302b60f30496673ffde25ad068b6044c
@@ -15,12 +15,12 @@ module Notifiable
15
15
  end
16
16
 
17
17
  protected
18
- def enqueue(notification, device_token, message, params)
18
+ def enqueue(device_token)
19
19
 
20
20
  grocer_notification = ::Grocer::Notification.new(
21
21
  device_token: device_token.token,
22
- alert: message,
23
- custom: params
22
+ alert: notification.message,
23
+ custom: notification.send_params
24
24
  )
25
25
 
26
26
  grocer_pusher.push(grocer_notification) unless Notifiable.delivery_method == :test
@@ -37,7 +37,7 @@ module Notifiable
37
37
  #8 - Invalid token
38
38
  #255 - None (unknown)
39
39
 
40
- processed(notification, device_token, 0)
40
+ processed(device_token, 0)
41
41
  end
42
42
 
43
43
  def flush
@@ -1,7 +1,7 @@
1
1
  module Notifiable
2
2
  module Apns
3
3
  module Grocer
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.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.16.0"
21
+ spec.add_dependency "notifiable-rails", ">=0.17.0"
22
22
  spec.add_dependency "grocer"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
data/spec/grocer_spec.rb CHANGED
@@ -3,57 +3,34 @@ require 'spec_helper'
3
3
  describe Notifiable::Apns::Grocer::Stream do
4
4
 
5
5
  let(:a) { Notifiable::App.create }
6
- let(:g) { Notifiable::Apns::Grocer::Stream.new }
7
- let(:n) { Notifiable::Notification.create(:message => "Test message", :app => a) }
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
8
  let(:d) { Notifiable::DeviceToken.create(:token => "ABC123", :provider => :apns, :app => a) }
9
- let(:u) { User.new(d) }
10
9
 
11
- it "sends a single grocer notification" do
12
- g.env = "test"
13
- g.send_notification(n, d)
10
+ it "sends a single notification" do
11
+ n1.batch do {|n| n.add_device_token(d)}
14
12
 
15
- Timeout.timeout(2) {
16
- notification = @grocer.notifications.pop
17
- notification.alert.should eql "Test message"
18
- notification.custom[:notification_id].should == n.id
19
- }
20
- end
21
-
22
- it "sends a single grocer notification in a batch" do
23
-
24
- Notifiable.batch(a) do |b|
25
- b.add_notifiable(n, u)
26
- end
27
13
  Notifiable::NotificationStatus.count.should == 1
28
14
  Notifiable::NotificationStatus.first.status.should == 0
29
15
 
30
16
  Timeout.timeout(2) {
31
17
  notification = @grocer.notifications.pop
32
18
  notification.alert.should eql "Test message"
33
- notification.custom[:notification_id].should == n.id
19
+ notification.custom[:notification_id].should == n1.id
34
20
  }
35
21
  end
36
22
 
37
- it "supports custom properties" do
38
- n.params = {:flag => true}
39
-
40
- Notifiable.batch(a) do |b|
41
- b.add_notifiable(n, u)
42
- end
23
+ it "supports custom properties" do
24
+ n1_with_params.batch do {|n| n.add_device_token(d)}
25
+
43
26
  Notifiable::NotificationStatus.count.should == 1
44
27
  Notifiable::NotificationStatus.first.status.should == 0
45
28
 
46
29
  Timeout.timeout(2) {
47
30
  notification = @grocer.notifications.pop
48
- notification.custom[:notification_id].should == n.id
31
+ notification.custom[:notification_id].should == n1_with_params.id
49
32
  notification.custom[:flag].should == true
50
33
  }
51
34
  end
52
35
 
53
- end
54
-
55
- User = Struct.new(:device_token) do
56
- def device_tokens
57
- [device_token]
58
- end
59
36
  end
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.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamil Kocemba
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-01 00:00:00.000000000 Z
12
+ date: 2014-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: notifiable-rails
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '>='
19
19
  - !ruby/object:Gem::Version
20
- version: 0.16.0
20
+ version: 0.17.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.16.0
27
+ version: 0.17.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: grocer
30
30
  requirement: !ruby/object:Gem::Requirement