rpush 1.0.0-java → 2.0.0-java

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.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +37 -22
  4. data/bin/rpush +13 -4
  5. data/lib/generators/rpush_generator.rb +2 -0
  6. data/lib/generators/templates/add_adm.rb +5 -5
  7. data/lib/generators/templates/add_alert_is_json_to_rapns_notifications.rb +1 -1
  8. data/lib/generators/templates/add_app_to_rapns.rb +2 -2
  9. data/lib/generators/templates/add_fail_after_to_rpush_notifications.rb +1 -1
  10. data/lib/generators/templates/add_gcm.rb +32 -32
  11. data/lib/generators/templates/add_rpush.rb +67 -67
  12. data/lib/generators/templates/add_wpns.rb +2 -2
  13. data/lib/generators/templates/create_rapns_apps.rb +5 -5
  14. data/lib/generators/templates/create_rapns_feedback.rb +2 -2
  15. data/lib/generators/templates/create_rapns_notifications.rb +15 -15
  16. data/lib/generators/templates/rpush.rb +28 -7
  17. data/lib/generators/templates/rpush_2_0_0_updates.rb +42 -0
  18. data/lib/rpush/client/active_model/adm/app.rb +23 -0
  19. data/lib/rpush/client/active_model/adm/data_validator.rb +14 -0
  20. data/lib/rpush/client/active_model/adm/notification.rb +28 -0
  21. data/lib/rpush/client/active_model/apns/app.rb +37 -0
  22. data/lib/rpush/client/active_model/apns/binary_notification_validator.rb +16 -0
  23. data/lib/rpush/client/active_model/apns/device_token_format_validator.rb +14 -0
  24. data/lib/rpush/client/active_model/apns/notification.rb +90 -0
  25. data/lib/rpush/client/active_model/gcm/app.rb +19 -0
  26. data/lib/rpush/client/active_model/gcm/expiry_collapse_key_mutual_inclusion_validator.rb +14 -0
  27. data/lib/rpush/client/active_model/gcm/notification.rb +31 -0
  28. data/lib/rpush/client/active_model/notification.rb +26 -0
  29. data/lib/rpush/client/active_model/payload_data_size_validator.rb +13 -0
  30. data/lib/rpush/client/active_model/registration_ids_count_validator.rb +13 -0
  31. data/lib/rpush/client/active_model/wpns/app.rb +13 -0
  32. data/lib/rpush/client/active_model/wpns/notification.rb +17 -0
  33. data/lib/rpush/client/active_model.rb +21 -0
  34. data/lib/rpush/client/active_record/adm/app.rb +11 -0
  35. data/lib/rpush/client/active_record/adm/notification.rb +11 -0
  36. data/lib/rpush/client/active_record/apns/app.rb +11 -0
  37. data/lib/rpush/client/active_record/apns/feedback.rb +22 -0
  38. data/lib/rpush/client/active_record/apns/notification.rb +46 -0
  39. data/lib/rpush/client/active_record/app.rb +17 -0
  40. data/lib/rpush/client/active_record/gcm/app.rb +11 -0
  41. data/lib/rpush/client/active_record/gcm/notification.rb +11 -0
  42. data/lib/rpush/client/active_record/notification.rb +38 -0
  43. data/lib/rpush/client/active_record/wpns/app.rb +11 -0
  44. data/lib/rpush/client/active_record/wpns/notification.rb +11 -0
  45. data/lib/rpush/client/active_record.rb +19 -0
  46. data/lib/rpush/client/redis/adm/app.rb +14 -0
  47. data/lib/rpush/client/redis/adm/notification.rb +11 -0
  48. data/lib/rpush/client/redis/apns/app.rb +11 -0
  49. data/lib/rpush/client/redis/apns/feedback.rb +20 -0
  50. data/lib/rpush/client/redis/apns/notification.rb +11 -0
  51. data/lib/rpush/client/redis/app.rb +24 -0
  52. data/lib/rpush/client/redis/gcm/app.rb +11 -0
  53. data/lib/rpush/client/redis/gcm/notification.rb +11 -0
  54. data/lib/rpush/client/redis/notification.rb +68 -0
  55. data/lib/rpush/client/redis/wpns/app.rb +11 -0
  56. data/lib/rpush/client/redis/wpns/notification.rb +11 -0
  57. data/lib/rpush/client/redis.rb +35 -0
  58. data/lib/rpush/configuration.rb +27 -6
  59. data/lib/rpush/daemon/adm/delivery.rb +56 -55
  60. data/lib/rpush/daemon/apns/delivery.rb +20 -44
  61. data/lib/rpush/daemon/apns/feedback_receiver.rb +11 -8
  62. data/lib/rpush/daemon/apns.rb +6 -5
  63. data/lib/rpush/daemon/app_runner.rb +103 -99
  64. data/lib/rpush/daemon/batch.rb +54 -40
  65. data/lib/rpush/daemon/delivery.rb +13 -3
  66. data/lib/rpush/daemon/delivery_error.rb +10 -2
  67. data/lib/rpush/daemon/dispatcher/apns_tcp.rb +114 -0
  68. data/lib/rpush/daemon/dispatcher/http.rb +3 -3
  69. data/lib/rpush/daemon/dispatcher/tcp.rb +3 -3
  70. data/lib/rpush/daemon/dispatcher_loop.rb +37 -23
  71. data/lib/rpush/daemon/errors.rb +18 -0
  72. data/lib/rpush/daemon/feeder.rb +28 -39
  73. data/lib/rpush/daemon/gcm/delivery.rb +19 -20
  74. data/lib/rpush/daemon/interruptible_sleep.rb +26 -45
  75. data/lib/rpush/daemon/loggable.rb +2 -4
  76. data/lib/rpush/daemon/proc_title.rb +16 -0
  77. data/lib/rpush/daemon/queue_payload.rb +12 -0
  78. data/lib/rpush/daemon/reflectable.rb +3 -5
  79. data/lib/rpush/daemon/retry_header_parser.rb +6 -6
  80. data/lib/rpush/daemon/retryable_error.rb +2 -0
  81. data/lib/rpush/daemon/ring_buffer.rb +16 -0
  82. data/lib/rpush/daemon/service_config_methods.rb +23 -7
  83. data/lib/rpush/daemon/signal_handler.rb +56 -0
  84. data/lib/rpush/daemon/store/active_record/reconnectable.rb +21 -17
  85. data/lib/rpush/daemon/store/active_record.rb +71 -38
  86. data/lib/rpush/daemon/store/interface.rb +19 -0
  87. data/lib/rpush/daemon/store/redis.rb +149 -0
  88. data/lib/rpush/daemon/string_helpers.rb +15 -0
  89. data/lib/rpush/daemon/synchronizer.rb +60 -0
  90. data/lib/rpush/daemon/tcp_connection.rb +6 -11
  91. data/lib/rpush/daemon/wpns/delivery.rb +21 -30
  92. data/lib/rpush/daemon.rb +40 -60
  93. data/lib/rpush/deprecatable.rb +4 -3
  94. data/lib/rpush/deprecation.rb +7 -10
  95. data/lib/rpush/embed.rb +8 -3
  96. data/lib/rpush/logger.rb +11 -15
  97. data/lib/rpush/push.rb +1 -2
  98. data/lib/rpush/reflection.rb +8 -12
  99. data/lib/rpush/version.rb +1 -1
  100. data/lib/rpush.rb +5 -29
  101. data/lib/tasks/quality.rake +35 -0
  102. data/lib/tasks/test.rake +1 -5
  103. data/spec/.rubocop.yml +4 -0
  104. data/spec/functional/adm_spec.rb +3 -6
  105. data/spec/functional/apns_spec.rb +117 -24
  106. data/spec/functional/embed_spec.rb +20 -20
  107. data/spec/functional/gcm_spec.rb +4 -7
  108. data/spec/functional/new_app_spec.rb +59 -0
  109. data/spec/functional/retry_spec.rb +46 -0
  110. data/spec/functional/synchronization_spec.rb +68 -0
  111. data/spec/functional/wpns_spec.rb +3 -6
  112. data/spec/functional_spec_helper.rb +26 -0
  113. data/spec/integration/rpush_spec.rb +13 -0
  114. data/spec/integration/support/gcm_success_response.json +1 -0
  115. data/spec/spec_helper.rb +60 -0
  116. data/spec/support/active_record_setup.rb +48 -0
  117. data/{config → spec/support/config}/database.yml +0 -0
  118. data/spec/support/install.sh +43 -7
  119. data/spec/support/simplecov_helper.rb +9 -5
  120. data/spec/support/simplecov_quality_formatter.rb +10 -6
  121. data/spec/unit/apns_feedback_spec.rb +3 -3
  122. data/spec/unit/{adm → client/active_record/adm}/app_spec.rb +3 -3
  123. data/spec/unit/{adm → client/active_record/adm}/notification_spec.rb +5 -7
  124. data/spec/unit/client/active_record/apns/app_spec.rb +29 -0
  125. data/spec/unit/client/active_record/apns/feedback_spec.rb +9 -0
  126. data/spec/unit/client/active_record/apns/notification_spec.rb +231 -0
  127. data/spec/unit/client/active_record/app_spec.rb +30 -0
  128. data/spec/unit/client/active_record/gcm/app_spec.rb +4 -0
  129. data/spec/unit/{gcm → client/active_record/gcm}/notification_spec.rb +5 -7
  130. data/spec/unit/client/active_record/notification_spec.rb +21 -0
  131. data/spec/unit/client/active_record/wpns/app_spec.rb +4 -0
  132. data/spec/unit/client/active_record/wpns/notification_spec.rb +21 -0
  133. data/spec/unit/configuration_spec.rb +12 -5
  134. data/spec/unit/daemon/adm/delivery_spec.rb +66 -55
  135. data/spec/unit/daemon/apns/certificate_expired_error_spec.rb +3 -3
  136. data/spec/unit/daemon/apns/delivery_spec.rb +90 -83
  137. data/spec/unit/daemon/apns/feedback_receiver_spec.rb +22 -17
  138. data/spec/unit/daemon/app_runner_spec.rb +78 -186
  139. data/spec/unit/daemon/batch_spec.rb +52 -115
  140. data/spec/unit/daemon/delivery_spec.rb +15 -1
  141. data/spec/unit/daemon/dispatcher/http_spec.rb +3 -2
  142. data/spec/unit/daemon/dispatcher/tcp_spec.rb +10 -9
  143. data/spec/unit/daemon/dispatcher_loop_spec.rb +6 -24
  144. data/spec/unit/daemon/feeder_spec.rb +38 -39
  145. data/spec/unit/daemon/gcm/delivery_spec.rb +122 -101
  146. data/spec/unit/daemon/reflectable_spec.rb +2 -2
  147. data/spec/unit/daemon/retryable_error_spec.rb +1 -1
  148. data/spec/unit/daemon/service_config_methods_spec.rb +6 -3
  149. data/spec/unit/daemon/signal_handler_spec.rb +95 -0
  150. data/spec/unit/daemon/store/active_record/reconnectable_spec.rb +48 -27
  151. data/spec/unit/daemon/store/active_record_spec.rb +38 -47
  152. data/spec/unit/daemon/tcp_connection_spec.rb +22 -34
  153. data/spec/unit/daemon/wpns/delivery_spec.rb +58 -50
  154. data/spec/unit/daemon_spec.rb +48 -82
  155. data/spec/unit/embed_spec.rb +6 -4
  156. data/spec/unit/logger_spec.rb +35 -43
  157. data/spec/unit/notification_shared.rb +9 -79
  158. data/spec/unit/push_spec.rb +6 -10
  159. data/spec/unit/reflection_spec.rb +25 -25
  160. data/spec/unit/rpush_spec.rb +1 -2
  161. data/spec/unit_spec_helper.rb +33 -88
  162. metadata +126 -76
  163. data/lib/rpush/TODO +0 -3
  164. data/lib/rpush/adm/app.rb +0 -15
  165. data/lib/rpush/adm/data_validator.rb +0 -11
  166. data/lib/rpush/adm/notification.rb +0 -29
  167. data/lib/rpush/apns/app.rb +0 -29
  168. data/lib/rpush/apns/binary_notification_validator.rb +0 -12
  169. data/lib/rpush/apns/device_token_format_validator.rb +0 -12
  170. data/lib/rpush/apns/feedback.rb +0 -16
  171. data/lib/rpush/apns/notification.rb +0 -84
  172. data/lib/rpush/app.rb +0 -18
  173. data/lib/rpush/daemon/apns/certificate_expired_error.rb +0 -20
  174. data/lib/rpush/daemon/apns/disconnection_error.rb +0 -20
  175. data/lib/rpush/daemon/dispatcher_loop_collection.rb +0 -33
  176. data/lib/rpush/daemon/too_many_requests_error.rb +0 -20
  177. data/lib/rpush/gcm/app.rb +0 -11
  178. data/lib/rpush/gcm/expiry_collapse_key_mutual_inclusion_validator.rb +0 -11
  179. data/lib/rpush/gcm/notification.rb +0 -30
  180. data/lib/rpush/notification.rb +0 -69
  181. data/lib/rpush/notifier.rb +0 -52
  182. data/lib/rpush/payload_data_size_validator.rb +0 -10
  183. data/lib/rpush/railtie.rb +0 -11
  184. data/lib/rpush/registration_ids_count_validator.rb +0 -10
  185. data/lib/rpush/wpns/app.rb +0 -9
  186. data/lib/rpush/wpns/notification.rb +0 -26
  187. data/lib/tasks/cane.rake +0 -18
  188. data/lib/tasks/rpush.rake +0 -16
  189. data/spec/unit/apns/app_spec.rb +0 -29
  190. data/spec/unit/apns/feedback_spec.rb +0 -9
  191. data/spec/unit/apns/notification_spec.rb +0 -208
  192. data/spec/unit/app_spec.rb +0 -30
  193. data/spec/unit/daemon/apns/disconnection_error_spec.rb +0 -18
  194. data/spec/unit/daemon/dispatcher_loop_collection_spec.rb +0 -37
  195. data/spec/unit/daemon/interruptible_sleep_spec.rb +0 -68
  196. data/spec/unit/daemon/too_many_requests_error_spec.rb +0 -14
  197. data/spec/unit/gcm/app_spec.rb +0 -4
  198. data/spec/unit/notification_spec.rb +0 -15
  199. data/spec/unit/notifier_spec.rb +0 -49
  200. data/spec/unit/wpns/app_spec.rb +0 -4
  201. data/spec/unit/wpns/notification_spec.rb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd3933018cb97f85a06df0df090aade180c8763c
4
- data.tar.gz: 689b13f47bb1ec8f2a371ad175e63e5c929ba6b6
3
+ metadata.gz: 61cf526e008ad5aba0d3523150428719f09a85a3
4
+ data.tar.gz: c126e4d03cefc7fe33e99b5b49f6f2854cfcabfd
5
5
  SHA512:
6
- metadata.gz: 5ca7768f9249d0f04553bd505f5f4bf929538a730eb24ce59bc37f041fddde8a55588e8758ce313902bfcd32716a49d51acb85ee226bb7e4343d0127b2922249
7
- data.tar.gz: d5cbc3465122d36dd5222928fea8ab901a77d58bffdf6d25c84092ea43c8cbeac4b9f004241caabbc5bb8f27fc112dc22dba2d0be2f7e93fba7937119a1739d1
6
+ metadata.gz: 0a871d37518b8643b373c31186bd97242eb23fb44d524c4c1c2d23bd002bf4d49020ee6883b37864613f5a2c85dc47561676ed06c9e3997342c52e4ec59db287
7
+ data.tar.gz: 98529b49e823bb026644a6b1b299ce7e0ffa4a373c47cb70f7fc7484900febdc42c82603d541624a2bcd9e3d8a2622c815489db8f1b510ff95e8f2e7af401e1f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## 2.0.0 (Sept 6, 2014)
2
+ * Use APNs enhanced binary format version 2.
3
+ * Support running multiple Rpush processes when using ActiveRecord and Redis.
4
+ * APNs error detection is now performed asynchronously, 'check_for_errors' is therefore deprecated.
5
+ * Deprecated attributes_for_device accessors. Use data instead.
6
+ * Fix signal handling to work with Ruby 2.x. (#40).
7
+ * You no longer need to signal HUP after creating a new app, they will be loaded automatically for you.
8
+ * APNs notifications are now delivered in batches, greatly improving throughput.
9
+ * Signaling HUP now also causes Rpush to immediately check for new notifications.
10
+ * The 'wakeup' config option has been removed.
11
+ * The 'batch_storage_updates' config option has been deprecated, storage backends will now always batch updates where appropriate.
12
+ * The rpush process title updates with number of queued notifications and number of dispatchers.
13
+ * Rpush::Apns::Feedback#app has been renamed to app_id and is now an Integer.
14
+ * An app is restarted when the HUP signal is received if its certificate or environment attribute changed.
15
+
1
16
  ## 1.0.0 (Feb 9, 2014)
2
17
  * Renamed to Rpush (from Rapns). Version number reset to 1.0.0.
3
18
  * Reduce default batch size to 100.
data/README.md CHANGED
@@ -1,24 +1,32 @@
1
1
  [![Build Status](https://secure.travis-ci.org/rpush/rpush.png?branch=master)](http://travis-ci.org/rpush/rpush)
2
2
  [![Code Climate](https://codeclimate.com/github/rpush/rpush.png)](https://codeclimate.com/github/rpush/rpush)
3
- [![Coverage Status](https://coveralls.io/repos/rpush/rpush/badge.png?branch=master)](https://coveralls.io/r/rpush/rpush?branch=master)
3
+ [![Code Coverage](https://codeclimate.com/github/rpush/rpush/coverage.png)](https://codeclimate.com/github/rpush/rpush)
4
4
  [![Gem Version](https://badge.fury.io/rb/rpush.png)](http://badge.fury.io/rb/rpush)
5
5
 
6
- <img src="https://raw.github.com/rpush/rpush/master/rpush.png" align="right" width="200px" />
6
+ <img src="https://raw.github.com/rpush/rpush/master/logo.png" align="right" width="200px" />
7
7
 
8
8
  ### Rpush. The push notification service for Ruby.
9
9
 
10
- * Supports:
10
+ * Supported services:
11
11
  * **Apple Push Notification Service**
12
- * **Google Cloud Messaging)**
13
- * **Amazon Devide Messaging**
14
- * **Windows Push Notification Service**.
12
+ * **Google Cloud Messaging**
13
+ * **Amazon Device Messaging**
14
+ * **Windows Phone Push Notification Service**
15
+
16
+
17
+ * Supported storage backends:
18
+ * ActiveRecord
19
+ * Redis
20
+ * More coming soon!
21
+
22
+
15
23
  * Seamless Rails (3, 4) integration.
16
- * Scalable - choose the number of persistent connections for each app.
17
- * Designed for uptime - signal -HUP to add, update apps.
18
- * Run as a daemon or inside an [existing processs](https://github.com/rpush/rpush/wiki/Embedding-API).
24
+ * Scales vertically (threading) and horizontally (multiple processes).
25
+ * Designed for uptime - new apps are loaded automatically, signal `HUP` to update running apps.
26
+ * Run as a daemon or inside an [existing process](https://github.com/rpush/rpush/wiki/Embedding-API).
19
27
  * Use in a scheduler for low-workload deployments ([Push API](https://github.com/rpush/rpush/wiki/Push-API)).
20
28
  * Hooks for fine-grained instrumentation and error handling ([Reflection API](https://github.com/rpush/rpush/wiki/Reflection-API)).
21
- * Works with MRI, JRuby, Rubinius 1.9, 2.0, 2.1.
29
+ * Works with MRI, JRuby and Rubinius.
22
30
 
23
31
 
24
32
  ### Getting Started
@@ -29,7 +37,7 @@ Add it to your Gemfile:
29
37
  gem 'rpush'
30
38
  ```
31
39
 
32
- Generate the migrations, rpush.yml and migrate:
40
+ Generate the migrations, rpush.rb and migrate:
33
41
 
34
42
  ```
35
43
  rails g rpush
@@ -57,7 +65,7 @@ n = Rpush::Apns::Notification.new
57
65
  n.app = Rpush::Apns::App.find_by_name("ios_app")
58
66
  n.device_token = "..."
59
67
  n.alert = "hi mom!"
60
- n.attributes_for_device = {:foo => :bar}
68
+ n.data = { foo: :bar }
61
69
  n.save!
62
70
  ```
63
71
 
@@ -76,8 +84,8 @@ app.save!
76
84
  ```ruby
77
85
  n = Rpush::Gcm::Notification.new
78
86
  n.app = Rpush::Gcm::App.find_by_name("android_app")
79
- n.registration_ids = ["..."]
80
- n.data = {:message => "hi mom!"}
87
+ n.registration_ids = ["token", "..."]
88
+ n.data = { message: "hi mom!" }
81
89
  n.save!
82
90
  ```
83
91
 
@@ -98,7 +106,7 @@ app.save!
98
106
  n = Rpush::Adm::Notification.new
99
107
  n.app = Rpush::Adm::App.find_by_name("kindle_app")
100
108
  n.registration_ids = ["..."]
101
- n.data = {:message => "hi mom!"}
109
+ n.data = { message: "hi mom!"}
102
110
  n.collapse_key = "Optional consolidationKey"
103
111
  n.save!
104
112
  ```
@@ -122,33 +130,40 @@ n.alert = "..."
122
130
  n.save!
123
131
  ```
124
132
 
125
- ### Starting Rpush
133
+ ### Running Rpush
134
+
135
+ It is recommended to run Rpush as a separate process in most cases, though embedding and manual modes are provided for low-workload environments.
126
136
 
127
- As a daemon:
137
+ #### As a daemon (recommended):
128
138
 
129
139
  cd /path/to/rails/app
130
140
  rpush <Rails environment> [options]
131
141
 
132
- Inside an existing process (see [Embedding API](https://github.com/rpush/rpush/wiki/Embedding-API)):
142
+ #### Embedded inside an existing process
133
143
 
134
144
  ```ruby
145
+ # Call this during startup of your application, for example, by adding it to the end of config/initializers/rpush.rb
135
146
  Rpush.embed
136
147
  ```
137
148
 
138
- *Please note that only ever a single instance of Rpush should be running.*
149
+ See [Embedding API](https://github.com/rpush/rpush/wiki/Embedding-API) for more details.
139
150
 
140
- In a scheduler (see [Push API](https://github.com/rpush/rpush/wiki/Push-API)):
151
+ #### Manually (in a scheduler)
141
152
 
142
153
  ```ruby
143
154
  Rpush.push
144
155
  Rpush.apns_feedback
145
156
  ```
146
157
 
158
+ See [Push API](https://github.com/rpush/rpush/wiki/Push-API) for more details.
159
+
160
+ ### Configuration
161
+
147
162
  See [Configuration](https://github.com/rpush/rpush/wiki/Configuration) for a list of options, or run `rpush --help`.
148
163
 
149
164
  ### Updating Rpush
150
165
 
151
- After updating you should run `rails g rpush` to check for any new migrations.
166
+ If you're using ActiveRecord, you should run `rails g rpush` after upgrading Rpush to check for any new migrations.
152
167
 
153
168
  ### Wiki
154
169
 
@@ -172,7 +187,7 @@ After updating you should run `rails g rpush` to check for any new migrations.
172
187
  * [Silent failures might be dropped connections](https://github.com/rpush/rpush/wiki/Dropped-connections)
173
188
 
174
189
  ### Google Cloud Messaging
175
- * [Notification Options](https://github.com/rpush/rpush/wiki//GCM-Notification-Options)
190
+ * [Notification Options](https://github.com/rpush/rpush/wiki/GCM-Notification-Options)
176
191
  * [Canonical IDs](https://github.com/rpush/rpush/wiki/Canonical-IDs)
177
192
  * [Delivery Failures & Retries](https://github.com/rpush/rpush/wiki/Delivery-Failures-&-Retries)
178
193
 
data/bin/rpush CHANGED
@@ -12,12 +12,21 @@ options = ARGV.options do |opts|
12
12
  opts.on('-f', '--foreground', 'Run in the foreground.') { config.foreground = true }
13
13
  opts.on('-P N', '--db-poll N', Integer, "Frequency in seconds to check for new notifications.") { |n| config.push_poll = n }
14
14
  opts.on('-F N', '--feedback-poll N', Integer, "Frequency in seconds to check for feedback.") { |n| config.feedback_poll = n }
15
- opts.on('-e', '--no-error-checks', 'Disable APNs error checking after notification delivery.') { config.check_for_errors = false }
15
+ opts.on('-e', '--no-error-checks', 'Disable APNs error checking after notification delivery.') { config.check_for_errors = false } # deprecated
16
16
  opts.on('-p PATH', '--pid-file PATH', String, 'Path to write PID file. Relative to Rails root unless absolute.') { |path| config.pid_file = path }
17
17
  opts.on('-b N', '--batch-size N', Integer, 'Storage backend notification batch size.') { |n| config.batch_size = n }
18
- opts.on('-B', '--[no-]batch-storage-updates', 'Perform storage updates in batches.') { |v| config.batch_storage_updates = v }
19
- opts.on('-v', '--version', 'Print the version.') { puts "rpush #{Rpush::VERSION}"; exit }
20
- opts.on('-h', '--help', 'You\'re looking at it.') { puts opts; exit }
18
+ opts.on('-B', '--[no-]batch-storage-updates', 'Perform storage updates in batches.') { |v| config.batch_storage_updates = v } # deprecated
19
+ opts.on('-v', '--version', 'Print the version.') do
20
+ puts "rpush #{Rpush::VERSION}"
21
+ exit
22
+ end
23
+ opts.on('-h', '--help', 'You\'re looking at it.') do
24
+ hidden_switches = %w(-e --no-error-checks)
25
+ puts opts.to_s.split("\n").delete_if do |line|
26
+ hidden_switches.any? { |s| line =~ /#{s}/ }
27
+ end.join("\n")
28
+ exit
29
+ end
21
30
  end
22
31
 
23
32
  if environment.nil? || environment =~ /^-/
@@ -23,6 +23,8 @@ class RpushGenerator < Rails::Generators::Base
23
23
  else
24
24
  add_rpush_migration('add_rpush')
25
25
  end
26
+
27
+ add_rpush_migration('rpush_2_0_0_updates')
26
28
  end
27
29
 
28
30
  def copy_config
@@ -6,14 +6,14 @@ class AddAdm < ActiveRecord::Migration
6
6
  end
7
7
 
8
8
  def self.up
9
- add_column :rapns_apps, :client_id, :string, :null => true
10
- add_column :rapns_apps, :client_secret, :string, :null => true
11
- add_column :rapns_apps, :access_token, :string, :null => true
12
- add_column :rapns_apps, :access_token_expiration, :datetime, :null => true
9
+ add_column :rapns_apps, :client_id, :string, null: true
10
+ add_column :rapns_apps, :client_secret, :string, null: true
11
+ add_column :rapns_apps, :access_token, :string, null: true
12
+ add_column :rapns_apps, :access_token_expiration, :datetime, null: true
13
13
  end
14
14
 
15
15
  def self.down
16
- AddAdm::Rapns::Notification.where(:type => 'Rapns::Adm::Notification').delete_all
16
+ AddAdm::Rapns::Notification.where(type: 'Rapns::Adm::Notification').delete_all
17
17
 
18
18
  remove_column :rapns_apps, :client_id
19
19
  remove_column :rapns_apps, :client_secret
@@ -1,6 +1,6 @@
1
1
  class AddAlertIsJsonToRapnsNotifications < ActiveRecord::Migration
2
2
  def self.up
3
- add_column :rapns_notifications, :alert_is_json, :boolean, :null => true, :default => false
3
+ add_column :rapns_notifications, :alert_is_json, :boolean, null: true, default: false
4
4
  end
5
5
 
6
6
  def self.down
@@ -1,7 +1,7 @@
1
1
  class AddAppToRapns < ActiveRecord::Migration
2
2
  def self.up
3
- add_column :rapns_notifications, :app, :string, :null => true
4
- add_column :rapns_feedback, :app, :string, :null => true
3
+ add_column :rapns_notifications, :app, :string, null: true
4
+ add_column :rapns_feedback, :app, :string, null: true
5
5
  end
6
6
 
7
7
  def self.down
@@ -1,6 +1,6 @@
1
1
  class AddFailAfterToRpushNotifications < ActiveRecord::Migration
2
2
  def self.up
3
- add_column :rpush_notifications, :fail_after, :timestamp, :null => true
3
+ add_column :rpush_notifications, :fail_after, :timestamp, null: true
4
4
  end
5
5
 
6
6
  def self.down
@@ -11,34 +11,34 @@ class AddGcm < ActiveRecord::Migration
11
11
  end
12
12
 
13
13
  def self.up
14
- add_column :rapns_notifications, :type, :string, :null => true
15
- add_column :rapns_apps, :type, :string, :null => true
14
+ add_column :rapns_notifications, :type, :string, null: true
15
+ add_column :rapns_apps, :type, :string, null: true
16
16
 
17
- AddGcm::Rapns::Notification.update_all :type => 'Rapns::Apns::Notification'
18
- AddGcm::Rapns::App.update_all :type => 'Rapns::Apns::App'
17
+ AddGcm::Rapns::Notification.update_all type: 'Rapns::Apns::Notification'
18
+ AddGcm::Rapns::App.update_all type: 'Rapns::Apns::App'
19
19
 
20
- change_column :rapns_notifications, :type, :string, :null => false
21
- change_column :rapns_apps, :type, :string, :null => false
22
- change_column :rapns_notifications, :device_token, :string, { :null => true, :limit => 64 }
23
- change_column :rapns_notifications, :expiry, :integer, { :null => true, :default => 1.day.to_i }
24
- change_column :rapns_apps, :environment, :string, :null => true
25
- change_column :rapns_apps, :certificate, :text, :null => true, :default => nil
20
+ change_column :rapns_notifications, :type, :string, null: false
21
+ change_column :rapns_apps, :type, :string, null: false
22
+ change_column :rapns_notifications, :device_token, :string, { null: true, limit: 64 }
23
+ change_column :rapns_notifications, :expiry, :integer, { null: true, default: 1.day.to_i }
24
+ change_column :rapns_apps, :environment, :string, null: true
25
+ change_column :rapns_apps, :certificate, :text, null: true, default: nil
26
26
 
27
- change_column :rapns_notifications, :error_description, :text, :null => true, :default => nil
28
- change_column :rapns_notifications, :sound, :string, :default => 'default'
27
+ change_column :rapns_notifications, :error_description, :text, null: true, default: nil
28
+ change_column :rapns_notifications, :sound, :string, default: 'default'
29
29
 
30
30
  rename_column :rapns_notifications, :attributes_for_device, :data
31
31
  rename_column :rapns_apps, :key, :name
32
32
 
33
- add_column :rapns_apps, :auth_key, :string, :null => true
33
+ add_column :rapns_apps, :auth_key, :string, null: true
34
34
 
35
- add_column :rapns_notifications, :collapse_key, :string, :null => true
36
- add_column :rapns_notifications, :delay_while_idle, :boolean, :null => false, :default => false
35
+ add_column :rapns_notifications, :collapse_key, :string, null: true
36
+ add_column :rapns_notifications, :delay_while_idle, :boolean, null: false, default: false
37
37
 
38
38
  reg_ids_type = ActiveRecord::Base.connection.adapter_name.include?('Mysql') ? :mediumtext : :text
39
- add_column :rapns_notifications, :registration_ids, reg_ids_type, :null => true
40
- add_column :rapns_notifications, :app_id, :integer, :null => true
41
- add_column :rapns_notifications, :retries, :integer, :null => true, :default => 0
39
+ add_column :rapns_notifications, :registration_ids, reg_ids_type, null: true
40
+ add_column :rapns_notifications, :app_id, :integer, null: true
41
+ add_column :rapns_notifications, :retries, :integer, null: true, default: 0
42
42
 
43
43
  AddGcm::Rapns::Notification.reset_column_information
44
44
  AddGcm::Rapns::App.reset_column_information
@@ -47,30 +47,30 @@ class AddGcm < ActiveRecord::Migration
47
47
  AddGcm::Rapns::Notification.update_all(['app_id = ?', app.id], ['app = ?', app.name])
48
48
  end
49
49
 
50
- change_column :rapns_notifications, :app_id, :integer, :null => false
50
+ change_column :rapns_notifications, :app_id, :integer, null: false
51
51
  remove_column :rapns_notifications, :app
52
52
 
53
53
  if index_name_exists?(:rapns_notifications, "index_rapns_notifications_multi", true)
54
- remove_index :rapns_notifications, :name => "index_rapns_notifications_multi"
54
+ remove_index :rapns_notifications, name: "index_rapns_notifications_multi"
55
55
  elsif index_name_exists?(:rapns_notifications, "index_rapns_notifications_on_delivered_failed_deliver_after", false)
56
- remove_index :rapns_notifications, :name => "index_rapns_notifications_on_delivered_failed_deliver_after"
56
+ remove_index :rapns_notifications, name: "index_rapns_notifications_on_delivered_failed_deliver_after"
57
57
  end
58
- add_index :rapns_notifications, [:app_id, :delivered, :failed, :deliver_after], :name => "index_rapns_notifications_multi"
58
+ add_index :rapns_notifications, [:app_id, :delivered, :failed, :deliver_after], name: "index_rapns_notifications_multi"
59
59
  end
60
60
 
61
61
  def self.down
62
- AddGcm::Rapns::Notification.where(:type => 'Rapns::Gcm::Notification').delete_all
62
+ AddGcm::Rapns::Notification.where(type: 'Rapns::Gcm::Notification').delete_all
63
63
 
64
64
  remove_column :rapns_notifications, :type
65
65
  remove_column :rapns_apps, :type
66
66
 
67
- change_column :rapns_notifications, :device_token, :string, { :null => false, :limit => 64 }
68
- change_column :rapns_notifications, :expiry, :integer, { :null => false, :default => 1.day.to_i }
69
- change_column :rapns_apps, :environment, :string, :null => false
70
- change_column :rapns_apps, :certificate, :text, :null => false
67
+ change_column :rapns_notifications, :device_token, :string, { null: false, limit: 64 }
68
+ change_column :rapns_notifications, :expiry, :integer, { null: false, default: 1.day.to_i }
69
+ change_column :rapns_apps, :environment, :string, null: false
70
+ change_column :rapns_apps, :certificate, :text, null: false
71
71
 
72
- change_column :rapns_notifications, :error_description, :string, :null => true, :default => nil
73
- change_column :rapns_notifications, :sound, :string, :default => '1.aiff'
72
+ change_column :rapns_notifications, :error_description, :string, null: true, default: nil
73
+ change_column :rapns_notifications, :sound, :string, default: '1.aiff'
74
74
 
75
75
  rename_column :rapns_notifications, :data, :attributes_for_device
76
76
  rename_column :rapns_apps, :name, :key
@@ -82,7 +82,7 @@ class AddGcm < ActiveRecord::Migration
82
82
  remove_column :rapns_notifications, :registration_ids
83
83
  remove_column :rapns_notifications, :retries
84
84
 
85
- add_column :rapns_notifications, :app, :string, :null => true
85
+ add_column :rapns_notifications, :app, :string, null: true
86
86
 
87
87
  AddGcm::Rapns::Notification.reset_column_information
88
88
  AddGcm::Rapns::App.reset_column_information
@@ -92,11 +92,11 @@ class AddGcm < ActiveRecord::Migration
92
92
  end
93
93
 
94
94
  if index_name_exists?(:rapns_notifications, :index_rapns_notifications_multi, true)
95
- remove_index :rapns_notifications, :name => :index_rapns_notifications_multi
95
+ remove_index :rapns_notifications, name: :index_rapns_notifications_multi
96
96
  end
97
97
 
98
98
  remove_column :rapns_notifications, :app_id
99
99
 
100
- add_index :rapns_notifications, [:delivered, :failed, :deliver_after], :name => :index_rapns_notifications_multi
100
+ add_index :rapns_notifications, [:delivered, :failed, :deliver_after], name: :index_rapns_notifications_multi
101
101
  end
102
102
  end
@@ -44,28 +44,28 @@ class AddRpush < ActiveRecord::Migration
44
44
  class CreateRapnsNotifications < ActiveRecord::Migration
45
45
  def self.up
46
46
  create_table :rapns_notifications do |t|
47
- t.integer :badge, :null => true
48
- t.string :device_token, :null => false, :limit => 64
49
- t.string :sound, :null => true, :default => "1.aiff"
50
- t.string :alert, :null => true
51
- t.text :attributes_for_device, :null => true
52
- t.integer :expiry, :null => false, :default => 1.day.to_i
53
- t.boolean :delivered, :null => false, :default => false
54
- t.timestamp :delivered_at, :null => true
55
- t.boolean :failed, :null => false, :default => false
56
- t.timestamp :failed_at, :null => true
57
- t.integer :error_code, :null => true
58
- t.string :error_description, :null => true
59
- t.timestamp :deliver_after, :null => true
47
+ t.integer :badge, null: true
48
+ t.string :device_token, null: false, limit: 64
49
+ t.string :sound, null: true, default: "1.aiff"
50
+ t.string :alert, null: true
51
+ t.text :attributes_for_device, null: true
52
+ t.integer :expiry, null: false, default: 1.day.to_i
53
+ t.boolean :delivered, null: false, default: false
54
+ t.timestamp :delivered_at, null: true
55
+ t.boolean :failed, null: false, default: false
56
+ t.timestamp :failed_at, null: true
57
+ t.integer :error_code, null: true
58
+ t.string :error_description, null: true
59
+ t.timestamp :deliver_after, null: true
60
60
  t.timestamps
61
61
  end
62
62
 
63
- add_index :rapns_notifications, [:delivered, :failed, :deliver_after], :name => 'index_rapns_notifications_multi'
63
+ add_index :rapns_notifications, [:delivered, :failed, :deliver_after], name: 'index_rapns_notifications_multi'
64
64
  end
65
65
 
66
66
  def self.down
67
67
  if index_name_exists?(:rapns_notifications, 'index_rapns_notifications_multi', true)
68
- remove_index :rapns_notifications, :name => 'index_rapns_notifications_multi'
68
+ remove_index :rapns_notifications, name: 'index_rapns_notifications_multi'
69
69
  end
70
70
  drop_table :rapns_notifications
71
71
  end
@@ -74,8 +74,8 @@ class AddRpush < ActiveRecord::Migration
74
74
  class CreateRapnsFeedback < ActiveRecord::Migration
75
75
  def self.up
76
76
  create_table :rapns_feedback do |t|
77
- t.string :device_token, :null => false, :limit => 64
78
- t.timestamp :failed_at, :null => false
77
+ t.string :device_token, null: false, limit: 64
78
+ t.timestamp :failed_at, null: false
79
79
  t.timestamps
80
80
  end
81
81
 
@@ -92,7 +92,7 @@ class AddRpush < ActiveRecord::Migration
92
92
 
93
93
  class AddAlertIsJsonToRapnsNotifications < ActiveRecord::Migration
94
94
  def self.up
95
- add_column :rapns_notifications, :alert_is_json, :boolean, :null => true, :default => false
95
+ add_column :rapns_notifications, :alert_is_json, :boolean, null: true, default: false
96
96
  end
97
97
 
98
98
  def self.down
@@ -102,8 +102,8 @@ class AddRpush < ActiveRecord::Migration
102
102
 
103
103
  class AddAppToRapns < ActiveRecord::Migration
104
104
  def self.up
105
- add_column :rapns_notifications, :app, :string, :null => true
106
- add_column :rapns_feedback, :app, :string, :null => true
105
+ add_column :rapns_notifications, :app, :string, null: true
106
+ add_column :rapns_feedback, :app, :string, null: true
107
107
  end
108
108
 
109
109
  def self.down
@@ -115,11 +115,11 @@ class AddRpush < ActiveRecord::Migration
115
115
  class CreateRapnsApps < ActiveRecord::Migration
116
116
  def self.up
117
117
  create_table :rapns_apps do |t|
118
- t.string :key, :null => false
119
- t.string :environment, :null => false
120
- t.text :certificate, :null => false
121
- t.string :password, :null => true
122
- t.integer :connections, :null => false, :default => 1
118
+ t.string :key, null: false
119
+ t.string :environment, null: false
120
+ t.text :certificate, null: false
121
+ t.string :password, null: true
122
+ t.integer :connections, null: false, default: 1
123
123
  t.timestamps
124
124
  end
125
125
  end
@@ -142,66 +142,66 @@ class AddRpush < ActiveRecord::Migration
142
142
  end
143
143
 
144
144
  def self.up
145
- add_column :rapns_notifications, :type, :string, :null => true
146
- add_column :rapns_apps, :type, :string, :null => true
145
+ add_column :rapns_notifications, :type, :string, null: true
146
+ add_column :rapns_apps, :type, :string, null: true
147
147
 
148
- AddGcm::Rapns::Notification.update_all :type => 'Rapns::Apns::Notification'
149
- AddGcm::Rapns::App.update_all :type => 'Rapns::Apns::App'
148
+ AddGcm::Rapns::Notification.update_all type: 'Rapns::Apns::Notification'
149
+ AddGcm::Rapns::App.update_all type: 'Rapns::Apns::App'
150
150
 
151
- change_column :rapns_notifications, :type, :string, :null => false
152
- change_column :rapns_apps, :type, :string, :null => false
153
- change_column :rapns_notifications, :device_token, :string, { :null => true, :limit => 64 }
154
- change_column :rapns_notifications, :expiry, :integer, { :null => true, :default => 1.day.to_i }
155
- change_column :rapns_apps, :environment, :string, :null => true
156
- change_column :rapns_apps, :certificate, :text, :null => true, :default => nil
151
+ change_column :rapns_notifications, :type, :string, null: false
152
+ change_column :rapns_apps, :type, :string, null: false
153
+ change_column :rapns_notifications, :device_token, :string, { null: true, limit: 64 }
154
+ change_column :rapns_notifications, :expiry, :integer, { null: true, default: 1.day.to_i }
155
+ change_column :rapns_apps, :environment, :string, null: true
156
+ change_column :rapns_apps, :certificate, :text, null: true, default: nil
157
157
 
158
- change_column :rapns_notifications, :error_description, :text, :null => true, :default => nil
159
- change_column :rapns_notifications, :sound, :string, :default => 'default'
158
+ change_column :rapns_notifications, :error_description, :text, null: true, default: nil
159
+ change_column :rapns_notifications, :sound, :string, default: 'default'
160
160
 
161
161
  rename_column :rapns_notifications, :attributes_for_device, :data
162
162
  rename_column :rapns_apps, :key, :name
163
163
 
164
- add_column :rapns_apps, :auth_key, :string, :null => true
164
+ add_column :rapns_apps, :auth_key, :string, null: true
165
165
 
166
- add_column :rapns_notifications, :collapse_key, :string, :null => true
167
- add_column :rapns_notifications, :delay_while_idle, :boolean, :null => false, :default => false
166
+ add_column :rapns_notifications, :collapse_key, :string, null: true
167
+ add_column :rapns_notifications, :delay_while_idle, :boolean, null: false, default: false
168
168
 
169
169
  reg_ids_type = ActiveRecord::Base.connection.adapter_name.include?('Mysql') ? :mediumtext : :text
170
- add_column :rapns_notifications, :registration_ids, reg_ids_type, :null => true
171
- add_column :rapns_notifications, :app_id, :integer, :null => true
172
- add_column :rapns_notifications, :retries, :integer, :null => true, :default => 0
170
+ add_column :rapns_notifications, :registration_ids, reg_ids_type, null: true
171
+ add_column :rapns_notifications, :app_id, :integer, null: true
172
+ add_column :rapns_notifications, :retries, :integer, null: true, default: 0
173
173
 
174
174
  AddGcm::Rapns::Notification.reset_column_information
175
175
  AddGcm::Rapns::App.reset_column_information
176
176
 
177
177
  AddGcm::Rapns::App.all.each do |app|
178
- AddGcm::Rapns::Notification.update_all(['app_id = ?', app.id], ['app = ?', app.name])
178
+ AddGcm::Rapns::Notification.where(app: app.name).update_all(app_id: app.id)
179
179
  end
180
180
 
181
- change_column :rapns_notifications, :app_id, :integer, :null => false
181
+ change_column :rapns_notifications, :app_id, :integer, null: false
182
182
  remove_column :rapns_notifications, :app
183
183
 
184
184
  if index_name_exists?(:rapns_notifications, "index_rapns_notifications_multi", true)
185
- remove_index :rapns_notifications, :name => "index_rapns_notifications_multi"
185
+ remove_index :rapns_notifications, name: "index_rapns_notifications_multi"
186
186
  elsif index_name_exists?(:rapns_notifications, "index_rapns_notifications_on_delivered_failed_deliver_after", false)
187
- remove_index :rapns_notifications, :name => "index_rapns_notifications_on_delivered_failed_deliver_after"
187
+ remove_index :rapns_notifications, name: "index_rapns_notifications_on_delivered_failed_deliver_after"
188
188
  end
189
- add_index :rapns_notifications, [:app_id, :delivered, :failed, :deliver_after], :name => "index_rapns_notifications_multi"
189
+ add_index :rapns_notifications, [:app_id, :delivered, :failed, :deliver_after], name: "index_rapns_notifications_multi"
190
190
  end
191
191
 
192
192
  def self.down
193
- AddGcm::Rapns::Notification.where(:type => 'Rapns::Gcm::Notification').delete_all
193
+ AddGcm::Rapns::Notification.where(type: 'Rapns::Gcm::Notification').delete_all
194
194
 
195
195
  remove_column :rapns_notifications, :type
196
196
  remove_column :rapns_apps, :type
197
197
 
198
- change_column :rapns_notifications, :device_token, :string, { :null => false, :limit => 64 }
199
- change_column :rapns_notifications, :expiry, :integer, { :null => false, :default => 1.day.to_i }
200
- change_column :rapns_apps, :environment, :string, :null => false
201
- change_column :rapns_apps, :certificate, :text, :null => false
198
+ change_column :rapns_notifications, :device_token, :string, { null: false, limit: 64 }
199
+ change_column :rapns_notifications, :expiry, :integer, { null: false, default: 1.day.to_i }
200
+ change_column :rapns_apps, :environment, :string, null: false
201
+ change_column :rapns_apps, :certificate, :text, null: false
202
202
 
203
- change_column :rapns_notifications, :error_description, :string, :null => true, :default => nil
204
- change_column :rapns_notifications, :sound, :string, :default => '1.aiff'
203
+ change_column :rapns_notifications, :error_description, :string, null: true, default: nil
204
+ change_column :rapns_notifications, :sound, :string, default: '1.aiff'
205
205
 
206
206
  rename_column :rapns_notifications, :data, :attributes_for_device
207
207
  rename_column :rapns_apps, :name, :key
@@ -213,22 +213,22 @@ class AddRpush < ActiveRecord::Migration
213
213
  remove_column :rapns_notifications, :registration_ids
214
214
  remove_column :rapns_notifications, :retries
215
215
 
216
- add_column :rapns_notifications, :app, :string, :null => true
216
+ add_column :rapns_notifications, :app, :string, null: true
217
217
 
218
218
  AddGcm::Rapns::Notification.reset_column_information
219
219
  AddGcm::Rapns::App.reset_column_information
220
220
 
221
221
  AddGcm::Rapns::App.all.each do |app|
222
- AddGcm::Rapns::Notification.update_all(['app = ?', app.key], ['app_id = ?', app.id])
222
+ AddGcm::Rapns::Notification.where(app_id: app.id).update_all(app: app.key)
223
223
  end
224
224
 
225
225
  if index_name_exists?(:rapns_notifications, :index_rapns_notifications_multi, true)
226
- remove_index :rapns_notifications, :name => :index_rapns_notifications_multi
226
+ remove_index :rapns_notifications, name: :index_rapns_notifications_multi
227
227
  end
228
228
 
229
229
  remove_column :rapns_notifications, :app_id
230
230
 
231
- add_index :rapns_notifications, [:delivered, :failed, :deliver_after], :name => :index_rapns_notifications_multi
231
+ add_index :rapns_notifications, [:delivered, :failed, :deliver_after], name: :index_rapns_notifications_multi
232
232
  end
233
233
  end
234
234
 
@@ -240,11 +240,11 @@ class AddRpush < ActiveRecord::Migration
240
240
  end
241
241
 
242
242
  def self.up
243
- add_column :rapns_notifications, :uri, :string, :null => true
243
+ add_column :rapns_notifications, :uri, :string, null: true
244
244
  end
245
245
 
246
246
  def self.down
247
- AddWpns::Rapns::Notification.where(:type => 'Rapns::Wpns::Notification').delete_all
247
+ AddWpns::Rapns::Notification.where(type: 'Rapns::Wpns::Notification').delete_all
248
248
  remove_column :rapns_notifications, :uri
249
249
  end
250
250
  end
@@ -257,14 +257,14 @@ class AddRpush < ActiveRecord::Migration
257
257
  end
258
258
 
259
259
  def self.up
260
- add_column :rapns_apps, :client_id, :string, :null => true
261
- add_column :rapns_apps, :client_secret, :string, :null => true
262
- add_column :rapns_apps, :access_token, :string, :null => true
263
- add_column :rapns_apps, :access_token_expiration, :datetime, :null => true
260
+ add_column :rapns_apps, :client_id, :string, null: true
261
+ add_column :rapns_apps, :client_secret, :string, null: true
262
+ add_column :rapns_apps, :access_token, :string, null: true
263
+ add_column :rapns_apps, :access_token_expiration, :datetime, null: true
264
264
  end
265
265
 
266
266
  def self.down
267
- AddAdm::Rapns::Notification.where(:type => 'Rapns::Adm::Notification').delete_all
267
+ AddAdm::Rapns::Notification.where(type: 'Rapns::Adm::Notification').delete_all
268
268
 
269
269
  remove_column :rapns_apps, :client_id
270
270
  remove_column :rapns_apps, :client_secret
@@ -339,7 +339,7 @@ class AddRpush < ActiveRecord::Migration
339
339
 
340
340
  class AddFailAfterToRpushNotifications < ActiveRecord::Migration
341
341
  def self.up
342
- add_column :rpush_notifications, :fail_after, :timestamp, :null => true
342
+ add_column :rpush_notifications, :fail_after, :timestamp, null: true
343
343
  end
344
344
 
345
345
  def self.down