rpush 2.5.0 → 2.6.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: 8e562313c0e7b3ce34abf0013edf503f2f5dd4d2
4
- data.tar.gz: 1b3e1799010d17074316c353e77f8bef16bf54a7
3
+ metadata.gz: 6f3cc8682dd4d0be056e3fdac764d7e611f93d13
4
+ data.tar.gz: 9d98d267c188c407324808d28d9a3922dbb9b060
5
5
  SHA512:
6
- metadata.gz: bd1b05e4f6a848428b2d3f008e57806f062b9803605d2544b9ad45a26e4e2f90f56f1af095a56963d1e3f2b5edf835e07694b758bec2fca036171de3135543bc
7
- data.tar.gz: 85f65b3f5278077a738dbbc10ae16f1eeae6ece50cfdde65c9333a053ea595551ce071aa9e68a52acdf9ce4710230bda6d9d866f97f69352fcc9e63ffdc23014
6
+ metadata.gz: 59ee90a994a38a3684baef26510f1bf8befac593c91d691988f729224eeda34129c4965aa3bd8b7ed7db2b2c4288087bf11372c4089b73c90a77e78706fc56f4
7
+ data.tar.gz: c6d83831032136982317afe65731d0c0f56c2c568ce8c5c27ad96e5cb0b573587615d09fa36da7791999e78c652f8f2b05808a1c266e67f19025e3cb9a3b8ba5
@@ -1,3 +1,17 @@
1
+ ## 2.6.0 (Jan 25, 2016)
2
+
3
+ #### Features
4
+
5
+ * Added support for GCM for iOS' `content_available`. ([#221](https://github.com/rpush/rpush/pull/221))
6
+
7
+ #### Fixes
8
+
9
+ * Fix typo in Oracle support. ([#185](https://github.com/rpush/rpush/pull/185))
10
+ * Remove `param` tag from WNS message. ([#190](https://github.com/rpush/rpush/pull/190))
11
+ * Fixed WNS response headers parser. ([#192](https://github.com/rpush/rpush/pull/192))
12
+ * GCM: fixed raise of unhandled errors. ([#193](https://github.com/rpush/rpush/pull/193))
13
+ * Fix issue with custom PID file set in `Rpush.config`. ([#224](https://github.com/rpush/rpush/pull/224), [#225](https://github.com/rpush/rpush/pull/225))
14
+
1
15
  ## 2.5.0 (July 19, 2015)
2
16
  Features:
3
17
  * Add 'rpush status' to inspect running Rpush internal status.
@@ -10,7 +24,7 @@
10
24
  * Fix for handling APNs error when using `rpush push` or `Rpush.push`.
11
25
  * Fix backwards compatibility issue with ActiveRecord (#144).
12
26
 
13
- ## 2.4.0 (Fed 18, 2015)
27
+ ## 2.4.0 (Feb 18, 2015)
14
28
  Features:
15
29
  * Support for MongoDB (using Mongoid).
16
30
  * config.feedback_poll is now deprecated, use config.apns.feedback_receiver.frequency instead.
data/README.md CHANGED
@@ -119,6 +119,8 @@ For more documentation on [ADM](https://developer.amazon.com/sdk/adm.html).
119
119
  ```ruby
120
120
  app = Rpush::Wpns::App.new
121
121
  app.name = "windows_phone_app"
122
+ app.client_id = # Get this from your apps dashboard https://dev.windows.com
123
+ app.client_secret = # Get this from your apps dashboard https://dev.windows.com
122
124
  app.connections = 1
123
125
  app.save!
124
126
  ```
@@ -175,6 +177,10 @@ end
175
177
 
176
178
  Call this during startup of your application, for example, by adding it to the end of `config/rpush.rb`. See [Embedding API](https://github.com/rpush/rpush/wiki/Embedding-API) for more details.
177
179
 
180
+ #### Using mina
181
+
182
+ If you're using [mina](https://github.com/mina-deploy/mina), there is a gem called [mina-rpush](https://github.com/d4rky-pl/mina-rpush) which helps you control rpush.
183
+
178
184
  ### Configuration
179
185
 
180
186
  See [Configuration](https://github.com/rpush/rpush/wiki/Configuration) for a list of options.
@@ -216,7 +222,7 @@ You should run `rpush init` after upgrading Rpush to check for configuration and
216
222
 
217
223
  When running specs, please note that the ActiveRecord adapter can be changed by setting the `ADAPTER` environment variable. For example: `ADAPTER=postgresql rake`.
218
224
 
219
- Available adapters for testing are `mysql`, `mysql2` and `postgresql`.
225
+ Available adapters for testing are `postgresql`, `jdbcpostgresql`, `mysql2`, `jdbcmysql`, `jdbch2`, and `sqlite3`.
220
226
 
221
227
  Note that the database username is changed at runtime to be the currently logged in user's name. So if you're testing
222
228
  with mysql and you're using a user named 'bob', you will need to grant a mysql user 'bob' access to the 'rpush_test'
@@ -40,6 +40,7 @@ class RpushMigrationGenerator < Rails::Generators::Base
40
40
 
41
41
  add_rpush_migration('rpush_2_0_0_updates')
42
42
  add_rpush_migration('rpush_2_1_0_updates')
43
+ add_rpush_migration('rpush_2_6_0_updates')
43
44
  end
44
45
 
45
46
  protected
@@ -0,0 +1,10 @@
1
+ class Rpush260Updates < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :rpush_notifications, :content_available, :boolean, default: false
4
+ end
5
+
6
+ def self.down
7
+ remove_column :rpush_notifications, :content_available
8
+ end
9
+ end
10
+
@@ -93,6 +93,8 @@ module Rpush
93
93
 
94
94
  desc 'status', 'Show the internal status of the running Rpush instance.'
95
95
  def status
96
+ config_setup
97
+
96
98
  require 'rpush/daemon'
97
99
  rpc = Rpush::Daemon::Rpc::Client.new(rpush_process_pid)
98
100
  status = rpc.status
@@ -22,6 +22,7 @@ module Rpush
22
22
  }
23
23
  json['collapse_key'] = collapse_key if collapse_key
24
24
  json['time_to_live'] = expiry if expiry
25
+ json['content_available'] = content_available if content_available
25
26
  json
26
27
  end
27
28
  end
@@ -16,7 +16,7 @@ module Rpush
16
16
  attr_accessible :badge, :device_token, :sound, :alert, :data, :expiry, :delivered,
17
17
  :delivered_at, :failed, :failed_at, :error_code, :error_description, :deliver_after,
18
18
  :alert_is_json, :app, :app_id, :collapse_key, :delay_while_idle, :registration_ids,
19
- :uri, :url_args, :category
19
+ :uri, :url_args, :category, :content_available
20
20
  end
21
21
 
22
22
  def data=(attrs)
@@ -32,6 +32,7 @@ module Rpush
32
32
  field :priority, type: Integer
33
33
  field :url_args, type: Array
34
34
  field :category, type: String
35
+ field :content_available, type: Boolean, default: false
35
36
 
36
37
  field :integer_id, type: Integer
37
38
  increments :integer_id, model_name: name
@@ -42,6 +42,7 @@ module Rpush
42
42
  attribute :priority, :integer
43
43
  attribute :url_args, :array
44
44
  attribute :category, :string
45
+ attribute :content_available, :boolean, default: false
45
46
 
46
47
  def app
47
48
  return nil unless app_id
@@ -5,7 +5,7 @@ module Rpush
5
5
  class Delivery < Rpush::Daemon::Delivery
6
6
  include MultiJsonHelper
7
7
 
8
- host = 'https://android.googleapis.com'
8
+ host = 'https://gcm-http.googleapis.com'
9
9
  GCM_URI = URI.parse("#{host}/gcm/send")
10
10
  UNAVAILABLE_STATES = %w(Unavailable InternalServerError)
11
11
  INVALID_REGISTRATION_ID_STATES = %w(InvalidRegistration MismatchSenderId NotRegistered InvalidPackageName)
@@ -44,7 +44,7 @@ module Rpush
44
44
  when 503
45
45
  service_unavailable(response)
46
46
  else
47
- fail Rpush::DeliveryError.new(response.code, @notification.id, Rpush::Daemon::HTTP_STATUS_CODES[response.code.to_i])
47
+ fail Rpush::DeliveryError.new(response.code.to_i, @notification.id, Rpush::Daemon::HTTP_STATUS_CODES[response.code.to_i])
48
48
  end
49
49
  end
50
50
 
@@ -206,7 +206,7 @@ module Rpush
206
206
 
207
207
  def claim(relation)
208
208
  notifications = relation.lock(true).to_a
209
- @using_oracle ? notification.sort_by(&:created_at) : notifications
209
+ @using_oracle ? notifications.sort_by(&:created_at) : notifications
210
210
  end
211
211
 
212
212
  def adapter_name
@@ -145,26 +145,24 @@ module Rpush
145
145
  end
146
146
 
147
147
  def status_from_response(response)
148
- headers = response.to_hash
148
+ headers = response.to_hash.inject({}) {|h, v| h[v[0].downcase] = v[1]; h}
149
149
  {
150
- notification: headers["X-WNS-Status"],
151
- device_connection: headers["X-WNS-DeviceConnectionStatus"],
152
- msg_id: headers["X-WNS-Msg-ID"],
153
- error_description: headers["X-WNS-Error-Description"],
154
- debug_trace: headers["X-WNS-Debug-Trace"]
150
+ notification: headers["x-wns-status"],
151
+ device_connection: headers["x-wns-deviceconnectionstatus"],
152
+ msg_id: headers["x-wns-msg-id"],
153
+ error_description: headers["x-wns-error-description"],
154
+ debug_trace: headers["x-wns-debug-trace"]
155
155
  }
156
156
  end
157
157
 
158
158
  def notification_to_xml
159
159
  title = clean_param_string(@notification.data['title']) if @notification.data['title'].present?
160
160
  body = clean_param_string(@notification.data['body']) if @notification.data['body'].present?
161
- param = clean_param_string(@notification.data['param']) if @notification.data['param'].present?
162
161
  "<toast>
163
162
  <visual version='1' lang='en-US'>
164
163
  <binding template='ToastText02'>
165
164
  <text id='1'>#{title}</text>
166
165
  <text id='2'>#{body}</text>
167
- <param>#{param}</param>
168
166
  </binding>
169
167
  </visual>
170
168
  </toast>"
@@ -1,3 +1,3 @@
1
1
  module Rpush
2
- VERSION = '2.5.0'
2
+ VERSION = '2.6.0'
3
3
  end
@@ -28,6 +28,7 @@ describe Rpush::CLI do
28
28
  after { timeout { Rpush.shutdown } }
29
29
 
30
30
  it 'prints the status' do
31
+ expect(subject).to receive(:configure_rpush) { true }
31
32
  expect(subject).to receive(:puts).with(/app_runners:/)
32
33
  subject.status
33
34
  end
@@ -29,8 +29,9 @@ ActiveRecord::Base.establish_connection(db_config[SPEC_ADAPTER])
29
29
  require 'generators/templates/add_rpush'
30
30
  require 'generators/templates/rpush_2_0_0_updates'
31
31
  require 'generators/templates/rpush_2_1_0_updates'
32
+ require 'generators/templates/rpush_2_6_0_updates'
32
33
 
33
- migrations = [AddRpush, Rpush200Updates, Rpush210Updates]
34
+ migrations = [AddRpush, Rpush200Updates, Rpush210Updates, Rpush260Updates]
34
35
 
35
36
  unless ENV['TRAVIS']
36
37
  migrations.reverse_each do |m|
@@ -31,4 +31,9 @@ describe Rpush::Client::ActiveRecord::Gcm::Notification do
31
31
  notification.expiry = 100
32
32
  expect(notification.as_json['time_to_live']).to eq 100
33
33
  end
34
+
35
+ it 'includes content_available in the payload' do
36
+ notification.content_available = true
37
+ expect(notification.as_json['content_available']).to eq true
38
+ end
34
39
  end if active_record?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpush
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Leitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-19 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -128,6 +128,7 @@ files:
128
128
  - lib/generators/templates/rpush.rb
129
129
  - lib/generators/templates/rpush_2_0_0_updates.rb
130
130
  - lib/generators/templates/rpush_2_1_0_updates.rb
131
+ - lib/generators/templates/rpush_2_6_0_updates.rb
131
132
  - lib/rpush.rb
132
133
  - lib/rpush/apns_feedback.rb
133
134
  - lib/rpush/cli.rb