rpush 4.1.1 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +261 -161
  3. data/README.md +103 -17
  4. data/lib/generators/rpush_migration_generator.rb +1 -0
  5. data/lib/generators/templates/rpush.rb +4 -0
  6. data/lib/generators/templates/rpush_4_2_0_updates.rb +10 -0
  7. data/lib/rpush/cli.rb +1 -1
  8. data/lib/rpush/client/active_model.rb +4 -1
  9. data/lib/rpush/client/active_model/adm/data_validator.rb +1 -1
  10. data/lib/rpush/client/active_model/apns/device_token_format_validator.rb +2 -2
  11. data/lib/rpush/client/active_model/apns/notification.rb +9 -1
  12. data/lib/rpush/client/active_model/apns/notification_payload_size_validator.rb +15 -0
  13. data/lib/rpush/client/active_model/apns2/notification.rb +14 -0
  14. data/lib/rpush/client/active_model/gcm/expiry_collapse_key_mutual_inclusion_validator.rb +1 -1
  15. data/lib/rpush/client/active_model/gcm/notification.rb +4 -3
  16. data/lib/rpush/client/active_model/payload_data_size_validator.rb +1 -1
  17. data/lib/rpush/client/active_model/registration_ids_count_validator.rb +1 -1
  18. data/lib/rpush/client/active_model/webpush/app.rb +41 -0
  19. data/lib/rpush/client/active_model/webpush/notification.rb +66 -0
  20. data/lib/rpush/client/active_model/wns/notification.rb +8 -0
  21. data/lib/rpush/client/active_record.rb +4 -0
  22. data/lib/rpush/client/active_record/apns/active_record_serializable_notification.rb +65 -0
  23. data/lib/rpush/client/active_record/apns/notification.rb +1 -29
  24. data/lib/rpush/client/active_record/apns2/notification.rb +4 -1
  25. data/lib/rpush/client/active_record/apnsp8/notification.rb +1 -0
  26. data/lib/rpush/client/active_record/app.rb +1 -1
  27. data/lib/rpush/client/active_record/notification.rb +1 -1
  28. data/lib/rpush/client/active_record/webpush/app.rb +11 -0
  29. data/lib/rpush/client/active_record/webpush/notification.rb +12 -0
  30. data/lib/rpush/client/redis.rb +3 -0
  31. data/lib/rpush/client/redis/apns2/notification.rb +1 -0
  32. data/lib/rpush/client/redis/apnsp8/notification.rb +2 -0
  33. data/lib/rpush/client/redis/notification.rb +2 -1
  34. data/lib/rpush/client/redis/pushy/notification.rb +0 -1
  35. data/lib/rpush/client/redis/webpush/app.rb +15 -0
  36. data/lib/rpush/client/redis/webpush/notification.rb +15 -0
  37. data/lib/rpush/configuration.rb +3 -2
  38. data/lib/rpush/daemon.rb +4 -1
  39. data/lib/rpush/daemon/apns/feedback_receiver.rb +2 -1
  40. data/lib/rpush/daemon/apns2/delivery.rb +13 -2
  41. data/lib/rpush/daemon/apnsp8/delivery.rb +7 -2
  42. data/lib/rpush/daemon/app_runner.rb +1 -1
  43. data/lib/rpush/daemon/batch.rb +12 -5
  44. data/lib/rpush/daemon/delivery.rb +1 -2
  45. data/lib/rpush/daemon/dispatcher/apns_http2.rb +4 -2
  46. data/lib/rpush/daemon/dispatcher/apnsp8_http2.rb +2 -1
  47. data/lib/rpush/daemon/signal_handler.rb +1 -1
  48. data/lib/rpush/daemon/store/active_record.rb +1 -1
  49. data/lib/rpush/daemon/store/active_record/reconnectable.rb +1 -1
  50. data/lib/rpush/daemon/store/redis.rb +1 -1
  51. data/lib/rpush/daemon/webpush.rb +10 -0
  52. data/lib/rpush/daemon/webpush/delivery.rb +114 -0
  53. data/lib/rpush/daemon/wns/badge_request.rb +8 -3
  54. data/lib/rpush/daemon/wns/raw_request.rb +9 -2
  55. data/lib/rpush/daemon/wns/toast_request.rb +6 -2
  56. data/lib/rpush/logger.rb +1 -0
  57. data/lib/rpush/version.rb +3 -3
  58. data/spec/.rubocop.yml +1 -1
  59. data/spec/functional/apns2_spec.rb +97 -2
  60. data/spec/functional/gcm_priority_spec.rb +40 -0
  61. data/spec/functional/webpush_spec.rb +30 -0
  62. data/spec/spec_helper.rb +2 -0
  63. data/spec/support/active_record_setup.rb +3 -1
  64. data/spec/support/simplecov_helper.rb +1 -1
  65. data/spec/unit/client/active_record/adm/app_spec.rb +2 -54
  66. data/spec/unit/client/active_record/adm/notification_spec.rb +2 -39
  67. data/spec/unit/client/active_record/apns/app_spec.rb +3 -26
  68. data/spec/unit/client/active_record/apns/feedback_spec.rb +1 -5
  69. data/spec/unit/client/active_record/apns/notification_spec.rb +29 -288
  70. data/spec/unit/client/active_record/apns2/app_spec.rb +4 -0
  71. data/spec/unit/client/active_record/apns2/notification_spec.rb +65 -0
  72. data/spec/unit/client/active_record/apnsp8/notification_spec.rb +28 -0
  73. data/spec/unit/client/active_record/app_spec.rb +1 -26
  74. data/spec/unit/client/active_record/gcm/app_spec.rb +3 -1
  75. data/spec/unit/client/active_record/gcm/notification_spec.rb +6 -83
  76. data/spec/unit/client/active_record/notification_spec.rb +10 -11
  77. data/spec/unit/client/active_record/pushy/app_spec.rb +2 -13
  78. data/spec/unit/client/active_record/pushy/notification_spec.rb +2 -55
  79. data/spec/unit/client/active_record/shared/app.rb +14 -0
  80. data/spec/unit/{notification_shared.rb → client/active_record/shared/notification.rb} +12 -7
  81. data/spec/unit/client/active_record/webpush/app_spec.rb +6 -0
  82. data/spec/unit/client/active_record/webpush/notification_spec.rb +6 -0
  83. data/spec/unit/client/active_record/wns/badge_notification_spec.rb +1 -11
  84. data/spec/unit/client/active_record/wns/raw_notification_spec.rb +3 -12
  85. data/spec/unit/client/active_record/wpns/app_spec.rb +3 -1
  86. data/spec/unit/client/active_record/wpns/notification_spec.rb +2 -17
  87. data/spec/unit/client/redis/adm/app_spec.rb +5 -0
  88. data/spec/unit/client/redis/adm/notification_spec.rb +5 -0
  89. data/spec/unit/client/redis/apns/app_spec.rb +5 -0
  90. data/spec/unit/client/redis/apns/feedback_spec.rb +5 -0
  91. data/spec/unit/client/redis/apns/notification_spec.rb +50 -0
  92. data/spec/unit/client/redis/apns2/app_spec.rb +4 -0
  93. data/spec/unit/client/redis/apns2/notification_spec.rb +50 -0
  94. data/spec/unit/client/redis/apnsp8/notification_spec.rb +29 -0
  95. data/spec/unit/client/redis/app_spec.rb +5 -0
  96. data/spec/unit/client/redis/gcm/app_spec.rb +5 -0
  97. data/spec/unit/client/redis/gcm/notification_spec.rb +5 -0
  98. data/spec/unit/client/redis/notification_spec.rb +5 -0
  99. data/spec/unit/client/redis/pushy/app_spec.rb +5 -0
  100. data/spec/unit/client/redis/pushy/notification_spec.rb +5 -0
  101. data/spec/unit/client/redis/webpush/app_spec.rb +5 -0
  102. data/spec/unit/client/redis/webpush/notification_spec.rb +5 -0
  103. data/spec/unit/client/redis/wns/badge_notification_spec.rb +5 -0
  104. data/spec/unit/client/redis/wns/raw_notification_spec.rb +22 -0
  105. data/spec/unit/client/redis/wpns/app_spec.rb +5 -0
  106. data/spec/unit/client/redis/wpns/notification_spec.rb +5 -0
  107. data/spec/unit/client/shared/adm/app.rb +51 -0
  108. data/spec/unit/client/shared/adm/notification.rb +39 -0
  109. data/spec/unit/client/shared/apns/app.rb +29 -0
  110. data/spec/unit/client/shared/apns/feedback.rb +9 -0
  111. data/spec/unit/client/shared/apns/notification.rb +262 -0
  112. data/spec/unit/client/shared/app.rb +17 -0
  113. data/spec/unit/client/shared/gcm/app.rb +4 -0
  114. data/spec/unit/client/shared/gcm/notification.rb +77 -0
  115. data/spec/unit/client/shared/notification.rb +10 -0
  116. data/spec/unit/client/shared/pushy/app.rb +17 -0
  117. data/spec/unit/client/shared/pushy/notification.rb +55 -0
  118. data/spec/unit/client/shared/webpush/app.rb +33 -0
  119. data/spec/unit/client/shared/webpush/notification.rb +83 -0
  120. data/spec/unit/client/shared/wns/badge_notification.rb +15 -0
  121. data/spec/unit/client/shared/wns/raw_notification.rb +21 -0
  122. data/spec/unit/client/shared/wpns/app.rb +4 -0
  123. data/spec/unit/client/shared/wpns/notification.rb +18 -0
  124. data/spec/unit/daemon/apns/feedback_receiver_spec.rb +19 -1
  125. data/spec/unit/daemon/batch_spec.rb +50 -2
  126. data/spec/unit/daemon/delivery_spec.rb +10 -0
  127. data/spec/unit/daemon/gcm/delivery_spec.rb +1 -1
  128. data/spec/unit/daemon/shared/store.rb +312 -0
  129. data/spec/unit/daemon/store/active_record/reconnectable_spec.rb +7 -7
  130. data/spec/unit/daemon/store/active_record_spec.rb +7 -295
  131. data/spec/unit/daemon/store/redis_spec.rb +4 -293
  132. data/spec/unit/daemon/webpush/delivery_spec.rb +142 -0
  133. data/spec/unit/daemon/wns/post_request_spec.rb +64 -0
  134. data/spec/unit_spec_helper.rb +3 -0
  135. metadata +140 -13
  136. data/lib/rpush/client/active_model/apns/binary_notification_validator.rb +0 -16
@@ -1,16 +0,0 @@
1
- module Rpush
2
- module Client
3
- module ActiveModel
4
- module Apns
5
- class BinaryNotificationValidator < ::ActiveModel::Validator
6
- MAX_BYTES = 2048
7
-
8
- def validate(record)
9
- return unless record.payload.bytesize > MAX_BYTES
10
- record.errors[:base] << "APN notification cannot be larger than #{MAX_BYTES} bytes. Try condensing your alert and device attributes."
11
- end
12
- end
13
- end
14
- end
15
- end
16
- end