pushr-core 1.0.0.rc.1 → 1.0.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: b5aa180695a8bae681de138ad10bacf7533aba86
4
- data.tar.gz: 7d57cdb043ea68c5fd70203411be5929566fb07c
3
+ metadata.gz: 9ffb7fb3c92d6c74cd952b1e2db925518a24b75b
4
+ data.tar.gz: b167c999e085a9017a5ba924aa6b2769ced36e70
5
5
  SHA512:
6
- metadata.gz: 3fce9432e6d7577f98eef127f4cbc038e09d6986dc7226c5f8c47a8dd90baaf5364478dd31eed989c88b2deebdaf2dca7cc57bcebd7bbf85753616cf76b9c64e
7
- data.tar.gz: 5da4bbfb52aea12f3a68d55ad285dff059fdeaa289677e7ffea7e03fe48249369b390a1d3f65c7d1aa56a327ebf3fad62e23b35fb2aba8cd1d646b2c05e90f95
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.new(app: 'app_name', connections: 2, enabled: true,
57
- certificate: File.read('certificate.pem'), sandbox: false, skip_check_for_error: false).save
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.new(app: 'app_name', connections: 1, enabled: true,
68
- feedback_poll: 60).save
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.new(app: 'app_name', connections: 2, enabled: true, api: '<api key here>').save
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.new(
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).save
147
+ content_available: 1)
148
148
  ```
149
149
 
150
150
 
151
151
  Silent Push Notification via APNS:
152
152
 
153
153
  ```ruby
154
- Push::MessageApns.create(
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.new(
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').save
179
+ collapse_key: 'MSG')
180
180
  ```
181
181
 
182
182
  ## Feedback processing
@@ -27,6 +27,12 @@ module Pushr
27
27
  end
28
28
  end
29
29
 
30
+ def self.create(attributes = {})
31
+ m = new(attributes)
32
+ m.save
33
+ m
34
+ end
35
+
30
36
  def delete
31
37
  Pushr::Core.redis { |conn| conn.hdel('pushr:configurations', key) }
32
38
  end
@@ -23,6 +23,12 @@ module Pushr
23
23
  end
24
24
  end
25
25
 
26
+ def self.create(attributes = {})
27
+ m = new(attributes)
28
+ m.save
29
+ m
30
+ end
31
+
26
32
  def to_json
27
33
  MultiJson.dump(to_hash)
28
34
  end
data/lib/pushr/message.rb CHANGED
@@ -20,6 +20,12 @@ module Pushr
20
20
  end
21
21
  end
22
22
 
23
+ def self.create(attributes = {})
24
+ m = new(attributes)
25
+ m.save
26
+ m
27
+ end
28
+
23
29
  def to_json
24
30
  MultiJson.dump(to_hash)
25
31
  end
data/lib/pushr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pushr
2
- VERSION = '1.0.0.rc.1'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -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 'next' do
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.rc.1
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-19 00:00:00.000000000 Z
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: 1.3.1
259
+ version: '0'
260
260
  requirements: []
261
261
  rubyforge_project:
262
262
  rubygems_version: 2.1.11