pushr-core 1.0.0.rc.1 → 1.0.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/README.md +10 -10
- data/lib/pushr/configuration.rb +6 -0
- data/lib/pushr/feedback.rb +6 -0
- data/lib/pushr/message.rb +6 -0
- data/lib/pushr/version.rb +1 -1
- data/spec/lib/pushr/configuration_spec.rb +11 -0
- data/spec/lib/pushr/feedback_spec.rb +11 -0
- data/spec/lib/pushr/message_spec.rb +12 -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: 9ffb7fb3c92d6c74cd952b1e2db925518a24b75b
|
4
|
+
data.tar.gz: b167c999e085a9017a5ba924aa6b2769ced36e70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8da5f1a457ff6bdf6926318df3b3d8757d27651d7ca11a1e472d4d2587452b6e543e28d42d2bc524d0055f6e13f265b34bf546df6360a78b76a0d81d5822550c
|
7
|
+
data.tar.gz: 6f2a17440d22d992863a6cd4f3ac0f5a7dd5c61b32a3764f025db1d559902a04231d24dad422c1fa7ff885561b5da443d67e762711638394196dd75f440fe0e9
|
data/README.md
CHANGED
@@ -53,8 +53,8 @@ it will use that. The configuration is stored in Redis and you add the configura
|
|
53
53
|
|
54
54
|
APNS ([see](https://github.com/9to5/pushr-core#generating-certificates)):
|
55
55
|
```ruby
|
56
|
-
Pushr::ConfigurationApns.
|
57
|
-
certificate: File.read('certificate.pem'), sandbox: false, skip_check_for_error: false)
|
56
|
+
Pushr::ConfigurationApns.create(app: 'app_name', connections: 2, enabled: true,
|
57
|
+
certificate: File.read('certificate.pem'), sandbox: false, skip_check_for_error: false)
|
58
58
|
```
|
59
59
|
|
60
60
|
The `skip_check_for_error` parameter can be set to `true` or `false`. If set to `true` the APNS service
|
@@ -64,8 +64,8 @@ sandbox devices in your production environment you should not set `skip_check_fo
|
|
64
64
|
|
65
65
|
APNS Feedback:
|
66
66
|
```ruby
|
67
|
-
Pushr::ConfigurationApnsFeedback.
|
68
|
-
feedback_poll: 60)
|
67
|
+
Pushr::ConfigurationApnsFeedback.create(app: 'app_name', connections: 1, enabled: true,
|
68
|
+
feedback_poll: 60)
|
69
69
|
```
|
70
70
|
|
71
71
|
Use this configuration to let a thread check for feedback on all APNS Configurations. It checks every `feedback_poll` in seconds.
|
@@ -73,7 +73,7 @@ There should be only one instance of this configuration type.
|
|
73
73
|
|
74
74
|
GCM ([see](http://developer.android.com/guide/google/gcm/gs.html)):
|
75
75
|
```ruby
|
76
|
-
Pushr::ConfigurationGcm.
|
76
|
+
Pushr::ConfigurationGcm.create(app: 'app_name', connections: 2, enabled: true, api: '<api key here>')
|
77
77
|
```
|
78
78
|
|
79
79
|
You can have each provider per app_name and you can have more than one app_name. Use the instructions below to generate
|
@@ -135,7 +135,7 @@ Where `<options>` can be:
|
|
135
135
|
|
136
136
|
APNS:
|
137
137
|
```ruby
|
138
|
-
Pushr::MessageApns.
|
138
|
+
Pushr::MessageApns.create(
|
139
139
|
app: 'app_name',
|
140
140
|
device: '<APNS device_token here>',
|
141
141
|
alert: 'Hello World',
|
@@ -144,14 +144,14 @@ Pushr::MessageApns.new(
|
|
144
144
|
expiry: 1.day.from_now.to_i,
|
145
145
|
attributes_for_device: {key: 'MSG'},
|
146
146
|
priority: 10,
|
147
|
-
content_available: 1)
|
147
|
+
content_available: 1)
|
148
148
|
```
|
149
149
|
|
150
150
|
|
151
151
|
Silent Push Notification via APNS:
|
152
152
|
|
153
153
|
```ruby
|
154
|
-
|
154
|
+
Pushr::MessageApns.create(
|
155
155
|
app: 'app_name',
|
156
156
|
device: '<APNS device_token here>',
|
157
157
|
alert: nil,
|
@@ -167,7 +167,7 @@ Use `content_available: 1` if the iOS device should start your app upon receivin
|
|
167
167
|
|
168
168
|
GCM:
|
169
169
|
```ruby
|
170
|
-
Pushr::MessageGcm.
|
170
|
+
Pushr::MessageGcm.create(
|
171
171
|
app: 'app_name',
|
172
172
|
registration_ids: ['<GCM registration_id here>', '<GCM registration_id here>'],
|
173
173
|
notification_key: 'notification_key_name',
|
@@ -176,7 +176,7 @@ Pushr::MessageGcm.new(
|
|
176
176
|
time_to_live: 24 * 60 * 60,
|
177
177
|
restricted_package_name: 'com.example.gcm',
|
178
178
|
dry_run: false,
|
179
|
-
collapse_key: 'MSG')
|
179
|
+
collapse_key: 'MSG')
|
180
180
|
```
|
181
181
|
|
182
182
|
## Feedback processing
|
data/lib/pushr/configuration.rb
CHANGED
data/lib/pushr/feedback.rb
CHANGED
data/lib/pushr/message.rb
CHANGED
data/lib/pushr/version.rb
CHANGED
@@ -38,6 +38,17 @@ describe Pushr::Configuration do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
describe 'create' do
|
42
|
+
subject { Pushr::ConfigurationDummy.create(app: 'app_name', connections: 2, enabled: true) }
|
43
|
+
it 'should create a message' do
|
44
|
+
expect(subject.valid?).to eql true
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should create a ConfigurationDummy class' do
|
48
|
+
expect(subject.class).to eql Pushr::ConfigurationDummy
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
41
52
|
describe 'find' do
|
42
53
|
let!(:config) { Pushr::ConfigurationDummy.new(app: 'app_name', connections: 2, enabled: true) }
|
43
54
|
it 'should find a configuration' do
|
@@ -24,4 +24,15 @@ describe Pushr::Feedback do
|
|
24
24
|
expect(Pushr::Feedback.next).to be_kind_of(Pushr::FeedbackDummy)
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
28
|
+
describe 'create' do
|
29
|
+
subject { Pushr::FeedbackDummy.create(app: 'app_name', device: 'a' * 64, follow_up: 'delete', failed_at: Time.now) }
|
30
|
+
it 'should create a message' do
|
31
|
+
expect(subject.valid?).to eql true
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should create a FeedbackDummy class' do
|
35
|
+
expect(subject.class).to eql Pushr::FeedbackDummy
|
36
|
+
end
|
37
|
+
end
|
27
38
|
end
|
@@ -14,7 +14,7 @@ describe Pushr::Message do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
describe '
|
17
|
+
describe 'save' do
|
18
18
|
let(:message) { Pushr::MessageDummy.new(app: 'app_name') }
|
19
19
|
let(:message_invalid) { Pushr::MessageDummy.new }
|
20
20
|
it 'should return true' do
|
@@ -30,4 +30,15 @@ describe Pushr::Message do
|
|
30
30
|
expect(Pushr::Message.next('pushr:app_name:dummy')).to be_kind_of(Pushr::MessageDummy)
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
describe 'create' do
|
35
|
+
subject { Pushr::MessageDummy.create(app: 'app_name') }
|
36
|
+
it 'should create a message' do
|
37
|
+
expect(subject.valid?).to eql true
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should create a MessageDummy class' do
|
41
|
+
expect(subject.class).to eql Pushr::MessageDummy
|
42
|
+
end
|
43
|
+
end
|
33
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushr-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Pesman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -254,9 +254,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
254
254
|
version: 1.9.3
|
255
255
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
256
256
|
requirements:
|
257
|
-
- - "
|
257
|
+
- - ">="
|
258
258
|
- !ruby/object:Gem::Version
|
259
|
-
version:
|
259
|
+
version: '0'
|
260
260
|
requirements: []
|
261
261
|
rubyforge_project:
|
262
262
|
rubygems_version: 2.1.11
|