rpush 8.0.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -6
  3. data/README.md +8 -65
  4. data/lib/generators/templates/rpush.rb +9 -16
  5. data/lib/rpush/client/active_model.rb +0 -4
  6. data/lib/rpush/client/active_record.rb +0 -3
  7. data/lib/rpush/client/redis.rb +0 -3
  8. data/lib/rpush/configuration.rb +2 -19
  9. data/lib/rpush/daemon/service_config_methods.rb +0 -2
  10. data/lib/rpush/daemon/store/active_record.rb +2 -14
  11. data/lib/rpush/daemon/store/interface.rb +2 -2
  12. data/lib/rpush/daemon/store/redis.rb +2 -11
  13. data/lib/rpush/daemon.rb +0 -10
  14. data/lib/rpush/reflection_collection.rb +1 -2
  15. data/lib/rpush/version.rb +1 -1
  16. data/lib/rpush.rb +0 -1
  17. data/spec/functional/cli_spec.rb +41 -15
  18. data/spec/functional/embed_spec.rb +57 -26
  19. data/spec/functional/retry_spec.rb +21 -4
  20. data/spec/functional/synchronization_spec.rb +1 -1
  21. data/spec/functional_spec_helper.rb +0 -6
  22. data/spec/spec_helper.rb +2 -0
  23. data/spec/unit/client/active_record/shared/app.rb +1 -1
  24. data/spec/unit/daemon/shared/store.rb +0 -42
  25. metadata +49 -55
  26. data/lib/rpush/apns_feedback.rb +0 -18
  27. data/lib/rpush/client/active_model/gcm/app.rb +0 -19
  28. data/lib/rpush/client/active_model/gcm/expiry_collapse_key_mutual_inclusion_validator.rb +0 -14
  29. data/lib/rpush/client/active_model/gcm/notification.rb +0 -62
  30. data/lib/rpush/client/active_record/gcm/app.rb +0 -11
  31. data/lib/rpush/client/active_record/gcm/notification.rb +0 -11
  32. data/lib/rpush/client/redis/gcm/app.rb +0 -11
  33. data/lib/rpush/client/redis/gcm/notification.rb +0 -11
  34. data/lib/rpush/daemon/apns/delivery.rb +0 -43
  35. data/lib/rpush/daemon/apns/feedback_receiver.rb +0 -91
  36. data/lib/rpush/daemon/apns.rb +0 -17
  37. data/lib/rpush/daemon/dispatcher/apns_tcp.rb +0 -152
  38. data/lib/rpush/daemon/dispatcher/tcp.rb +0 -22
  39. data/lib/rpush/daemon/gcm/delivery.rb +0 -241
  40. data/lib/rpush/daemon/gcm.rb +0 -9
  41. data/lib/rpush/daemon/tcp_connection.rb +0 -190
  42. data/spec/functional/apns_spec.rb +0 -162
  43. data/spec/functional/gcm_priority_spec.rb +0 -40
  44. data/spec/functional/gcm_spec.rb +0 -46
  45. data/spec/functional/new_app_spec.rb +0 -44
  46. data/spec/unit/apns_feedback_spec.rb +0 -39
  47. data/spec/unit/client/active_record/gcm/app_spec.rb +0 -6
  48. data/spec/unit/client/active_record/gcm/notification_spec.rb +0 -14
  49. data/spec/unit/client/redis/gcm/app_spec.rb +0 -5
  50. data/spec/unit/client/redis/gcm/notification_spec.rb +0 -5
  51. data/spec/unit/client/shared/gcm/app.rb +0 -4
  52. data/spec/unit/client/shared/gcm/notification.rb +0 -77
  53. data/spec/unit/daemon/apns/delivery_spec.rb +0 -108
  54. data/spec/unit/daemon/apns/feedback_receiver_spec.rb +0 -137
  55. data/spec/unit/daemon/dispatcher/tcp_spec.rb +0 -32
  56. data/spec/unit/daemon/gcm/delivery_spec.rb +0 -387
  57. data/spec/unit/daemon/tcp_connection_spec.rb +0 -293
@@ -1,10 +1,12 @@
1
1
  require 'functional_spec_helper'
2
2
 
3
3
  describe 'Retries' do
4
- let(:app) { Rpush::Gcm::App.new }
5
- let(:notification) { Rpush::Gcm::Notification.new }
4
+ let(:app) { Rpush::Fcm::App.new }
5
+ let(:notification) { Rpush::Fcm::Notification.new }
6
6
  let(:response) { double(Net::HTTPResponse, code: 200) }
7
7
  let(:http) { double(Net::HTTP::Persistent, request: response, shutdown: nil) }
8
+ let(:fake_device_token) { 'a' * 108 }
9
+ let(:creds) {double(Google::Auth::UserRefreshCredentials)}
8
10
 
9
11
  before do
10
12
  Rpush::Daemon.common_init
@@ -14,7 +16,7 @@ describe 'Retries' do
14
16
  app.save!
15
17
 
16
18
  notification.app_id = app.id
17
- notification.registration_ids = ['foo']
19
+ notification.device_token = 'foo'
18
20
  notification.data = { message: 'test' }
19
21
  notification.save!
20
22
 
@@ -23,7 +25,22 @@ describe 'Retries' do
23
25
  end
24
26
 
25
27
  allow(Net::HTTP::Persistent).to receive_messages(new: http)
26
- allow(response).to receive_messages(body: JSON.dump(results: [{ message_id: notification.registration_ids.first.to_s }]))
28
+ allow(creds).to receive(:fetch_access_token).and_return({'access_token': 'face_access_token'})
29
+
30
+ allow(::Google::Auth::ServiceAccountCredentials).to receive(:fetch_access_token).and_return({access_token: 'bbbbbb'})
31
+ allow(::Google::Auth::ServiceAccountCredentials).to receive(:make_creds).and_return(creds)
32
+ allow_any_instance_of(::Rpush::Daemon::Fcm::Delivery).to receive(:necessary_data_exists?).and_return(true)
33
+
34
+ example_success_body = {
35
+ "multicast_id": 108,
36
+ "success": 1,
37
+ "failure": 0,
38
+ "canonical_ids": 0,
39
+ "results": [
40
+ { "message_id": "1:08" }
41
+ ]
42
+ }.to_json
43
+ allow(response).to receive_messages(body: example_success_body)
27
44
  end
28
45
 
29
46
  it 'delivers a notification due to be retried' do
@@ -2,7 +2,7 @@ require 'functional_spec_helper'
2
2
 
3
3
  describe 'Synchronization' do
4
4
  let(:timeout) { 10 }
5
- let(:app) { Rpush::Gcm::App.new }
5
+ let(:app) { Rpush::Fcm::App.new }
6
6
 
7
7
  def wait_for_num_dispatchers(num)
8
8
  Timeout.timeout(timeout) do
@@ -11,12 +11,6 @@ def timeout(&blk)
11
11
  Timeout.timeout(10, &blk)
12
12
  end
13
13
 
14
- def stub_tcp_connection(tcp_socket, ssl_socket, io_double)
15
- allow_any_instance_of(Rpush::Daemon::TcpConnection).to receive_messages(connect_socket: [tcp_socket, ssl_socket])
16
- allow_any_instance_of(Rpush::Daemon::TcpConnection).to receive_messages(setup_ssl_context: double.as_null_object)
17
- stub_const('Rpush::Daemon::TcpConnection::IO', io_double)
18
- end
19
-
20
14
  RSpec.configure do |config|
21
15
  config.before(:each) do
22
16
  Modis.with_connection do |redis|
data/spec/spec_helper.rb CHANGED
@@ -58,6 +58,8 @@ def after_example_cleanup
58
58
  end
59
59
  Rpush.plugins.values.each(&:unload)
60
60
  Rpush.instance_variable_set('@plugins', {})
61
+ Rpush.reflection_stack.clear
62
+ Rpush.reflection_stack.push(Rpush::ReflectionCollection.new)
61
63
  end
62
64
 
63
65
  RSpec.configure do |config|
@@ -8,7 +8,7 @@ shared_examples_for 'Rpush::Client::ActiveRecord::App' do
8
8
  app = Rpush::Apns::App.new(name: 'test', environment: 'development', certificate: TEST_CERT)
9
9
  expect(app.valid?).to eq(true)
10
10
 
11
- app = Rpush::Gcm::App.new(name: 'test', environment: 'production', auth_key: TEST_CERT)
11
+ app = Rpush::Fcm::App.new(name: 'test', environment: 'production', json_key: TEST_CERT)
12
12
  expect(app.valid?).to eq(true)
13
13
  end
14
14
  end
@@ -233,48 +233,6 @@ shared_examples 'Rpush::Daemon::Store' do
233
233
  end
234
234
  end
235
235
 
236
- describe 'create_apns_feedback' do
237
- it 'creates the Feedback record' do
238
- expect(Rpush::Apns::Feedback).to receive(:create!).with(
239
- failed_at: time, device_token: 'ab' * 32, app_id: app.id
240
- )
241
- store.create_apns_feedback(time, 'ab' * 32, app)
242
- end
243
- end
244
-
245
- describe 'create_gcm_notification' do
246
- let(:data) { { 'data' => true } }
247
- let(:attributes) { { device_token: 'ab' * 32 } }
248
- let(:registration_ids) { %w[123 456] }
249
- let(:deliver_after) { time + 10.seconds }
250
- let(:args) { [attributes, data, registration_ids, deliver_after, app] }
251
-
252
- it 'sets the given attributes' do
253
- new_notification = store.create_gcm_notification(*args)
254
- expect(new_notification.device_token).to eq 'ab' * 32
255
- end
256
-
257
- it 'sets the given data' do
258
- new_notification = store.create_gcm_notification(*args)
259
- expect(new_notification.data['data']).to be_truthy
260
- end
261
-
262
- it 'sets the given registration IDs' do
263
- new_notification = store.create_gcm_notification(*args)
264
- expect(new_notification.registration_ids).to eq registration_ids
265
- end
266
-
267
- it 'sets the deliver_after timestamp' do
268
- new_notification = store.create_gcm_notification(*args)
269
- expect(new_notification.deliver_after).to eq deliver_after
270
- end
271
-
272
- it 'saves the new notification' do
273
- new_notification = store.create_gcm_notification(*args)
274
- expect(new_notification.new_record?).to be_falsey
275
- end
276
- end
277
-
278
236
  describe 'create_adm_notification' do
279
237
  let(:data) { { 'data' => true } }
280
238
  let(:attributes) { { app_id: app.id, collapse_key: 'ckey', delay_while_idle: true } }
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: 8.0.0
4
+ version: 9.0.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: 2024-09-06 00:00:00.000000000 Z
11
+ date: 2024-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -78,7 +78,7 @@ dependencies:
78
78
  requirements:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: '5.2'
81
+ version: '6.0'
82
82
  - - "<"
83
83
  - !ruby/object:Gem::Version
84
84
  version: 7.1.0
@@ -88,7 +88,7 @@ dependencies:
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: '5.2'
91
+ version: '6.0'
92
92
  - - "<"
93
93
  - !ruby/object:Gem::Version
94
94
  version: 7.1.0
@@ -328,14 +328,14 @@ dependencies:
328
328
  requirements:
329
329
  - - "~>"
330
330
  - !ruby/object:Gem::Version
331
- version: 1.12.0
331
+ version: '1.66'
332
332
  type: :development
333
333
  prerelease: false
334
334
  version_requirements: !ruby/object:Gem::Requirement
335
335
  requirements:
336
336
  - - "~>"
337
337
  - !ruby/object:Gem::Version
338
- version: 1.12.0
338
+ version: '1.66'
339
339
  - !ruby/object:Gem::Dependency
340
340
  name: rubocop-performance
341
341
  requirement: !ruby/object:Gem::Requirement
@@ -350,6 +350,48 @@ dependencies:
350
350
  - - ">="
351
351
  - !ruby/object:Gem::Version
352
352
  version: '0'
353
+ - !ruby/object:Gem::Dependency
354
+ name: rubocop-rake
355
+ requirement: !ruby/object:Gem::Requirement
356
+ requirements:
357
+ - - ">="
358
+ - !ruby/object:Gem::Version
359
+ version: '0'
360
+ type: :development
361
+ prerelease: false
362
+ version_requirements: !ruby/object:Gem::Requirement
363
+ requirements:
364
+ - - ">="
365
+ - !ruby/object:Gem::Version
366
+ version: '0'
367
+ - !ruby/object:Gem::Dependency
368
+ name: rubocop-rspec
369
+ requirement: !ruby/object:Gem::Requirement
370
+ requirements:
371
+ - - ">="
372
+ - !ruby/object:Gem::Version
373
+ version: '0'
374
+ type: :development
375
+ prerelease: false
376
+ version_requirements: !ruby/object:Gem::Requirement
377
+ requirements:
378
+ - - ">="
379
+ - !ruby/object:Gem::Version
380
+ version: '0'
381
+ - !ruby/object:Gem::Dependency
382
+ name: rubocop-rails
383
+ requirement: !ruby/object:Gem::Requirement
384
+ requirements:
385
+ - - ">="
386
+ - !ruby/object:Gem::Version
387
+ version: '0'
388
+ type: :development
389
+ prerelease: false
390
+ version_requirements: !ruby/object:Gem::Requirement
391
+ requirements:
392
+ - - ">="
393
+ - !ruby/object:Gem::Version
394
+ version: '0'
353
395
  - !ruby/object:Gem::Dependency
354
396
  name: byebug
355
397
  requirement: !ruby/object:Gem::Requirement
@@ -449,7 +491,6 @@ files:
449
491
  - lib/generators/templates/rpush_4_2_0_updates.rb
450
492
  - lib/generators/templates/rpush_7_1_0_updates.rb
451
493
  - lib/rpush.rb
452
- - lib/rpush/apns_feedback.rb
453
494
  - lib/rpush/cli.rb
454
495
  - lib/rpush/client/active_model.rb
455
496
  - lib/rpush/client/active_model/adm/app.rb
@@ -468,9 +509,6 @@ files:
468
509
  - lib/rpush/client/active_model/fcm/expiry_collapse_key_mutual_inclusion_validator.rb
469
510
  - lib/rpush/client/active_model/fcm/notification.rb
470
511
  - lib/rpush/client/active_model/fcm/notification_keys_in_allowed_list_validator.rb
471
- - lib/rpush/client/active_model/gcm/app.rb
472
- - lib/rpush/client/active_model/gcm/expiry_collapse_key_mutual_inclusion_validator.rb
473
- - lib/rpush/client/active_model/gcm/notification.rb
474
512
  - lib/rpush/client/active_model/notification.rb
475
513
  - lib/rpush/client/active_model/payload_data_size_validator.rb
476
514
  - lib/rpush/client/active_model/pushy/app.rb
@@ -497,8 +535,6 @@ files:
497
535
  - lib/rpush/client/active_record/app.rb
498
536
  - lib/rpush/client/active_record/fcm/app.rb
499
537
  - lib/rpush/client/active_record/fcm/notification.rb
500
- - lib/rpush/client/active_record/gcm/app.rb
501
- - lib/rpush/client/active_record/gcm/notification.rb
502
538
  - lib/rpush/client/active_record/notification.rb
503
539
  - lib/rpush/client/active_record/pushy/app.rb
504
540
  - lib/rpush/client/active_record/pushy/notification.rb
@@ -523,8 +559,6 @@ files:
523
559
  - lib/rpush/client/redis/app.rb
524
560
  - lib/rpush/client/redis/fcm/app.rb
525
561
  - lib/rpush/client/redis/fcm/notification.rb
526
- - lib/rpush/client/redis/gcm/app.rb
527
- - lib/rpush/client/redis/gcm/notification.rb
528
562
  - lib/rpush/client/redis/notification.rb
529
563
  - lib/rpush/client/redis/pushy/app.rb
530
564
  - lib/rpush/client/redis/pushy/notification.rb
@@ -540,9 +574,6 @@ files:
540
574
  - lib/rpush/daemon.rb
541
575
  - lib/rpush/daemon/adm.rb
542
576
  - lib/rpush/daemon/adm/delivery.rb
543
- - lib/rpush/daemon/apns.rb
544
- - lib/rpush/daemon/apns/delivery.rb
545
- - lib/rpush/daemon/apns/feedback_receiver.rb
546
577
  - lib/rpush/daemon/apns2.rb
547
578
  - lib/rpush/daemon/apns2/delivery.rb
548
579
  - lib/rpush/daemon/apnsp8.rb
@@ -554,17 +585,13 @@ files:
554
585
  - lib/rpush/daemon/delivery.rb
555
586
  - lib/rpush/daemon/delivery_error.rb
556
587
  - lib/rpush/daemon/dispatcher/apns_http2.rb
557
- - lib/rpush/daemon/dispatcher/apns_tcp.rb
558
588
  - lib/rpush/daemon/dispatcher/apnsp8_http2.rb
559
589
  - lib/rpush/daemon/dispatcher/http.rb
560
- - lib/rpush/daemon/dispatcher/tcp.rb
561
590
  - lib/rpush/daemon/dispatcher_loop.rb
562
591
  - lib/rpush/daemon/errors.rb
563
592
  - lib/rpush/daemon/fcm.rb
564
593
  - lib/rpush/daemon/fcm/delivery.rb
565
594
  - lib/rpush/daemon/feeder.rb
566
- - lib/rpush/daemon/gcm.rb
567
- - lib/rpush/daemon/gcm/delivery.rb
568
595
  - lib/rpush/daemon/google_credential_cache.rb
569
596
  - lib/rpush/daemon/interruptible_sleep.rb
570
597
  - lib/rpush/daemon/loggable.rb
@@ -586,7 +613,6 @@ files:
586
613
  - lib/rpush/daemon/store/redis.rb
587
614
  - lib/rpush/daemon/string_helpers.rb
588
615
  - lib/rpush/daemon/synchronizer.rb
589
- - lib/rpush/daemon/tcp_connection.rb
590
616
  - lib/rpush/daemon/webpush.rb
591
617
  - lib/rpush/daemon/webpush/delivery.rb
592
618
  - lib/rpush/daemon/wns.rb
@@ -612,14 +638,10 @@ files:
612
638
  - spec/.rubocop.yml
613
639
  - spec/functional/adm_spec.rb
614
640
  - spec/functional/apns2_spec.rb
615
- - spec/functional/apns_spec.rb
616
641
  - spec/functional/cli_spec.rb
617
642
  - spec/functional/embed_spec.rb
618
643
  - spec/functional/fcm_priority_spec.rb
619
644
  - spec/functional/fcm_spec.rb
620
- - spec/functional/gcm_priority_spec.rb
621
- - spec/functional/gcm_spec.rb
622
- - spec/functional/new_app_spec.rb
623
645
  - spec/functional/pushy_spec.rb
624
646
  - spec/functional/retry_spec.rb
625
647
  - spec/functional/synchronization_spec.rb
@@ -634,7 +656,6 @@ files:
634
656
  - spec/support/simplecov_helper.rb
635
657
  - spec/support/simplecov_quality_formatter.rb
636
658
  - spec/tmp/.gitkeep
637
- - spec/unit/apns_feedback_spec.rb
638
659
  - spec/unit/client/active_record/adm/app_spec.rb
639
660
  - spec/unit/client/active_record/adm/notification_spec.rb
640
661
  - spec/unit/client/active_record/apns/app_spec.rb
@@ -646,8 +667,6 @@ files:
646
667
  - spec/unit/client/active_record/app_spec.rb
647
668
  - spec/unit/client/active_record/fcm/app_spec.rb
648
669
  - spec/unit/client/active_record/fcm/notification_spec.rb
649
- - spec/unit/client/active_record/gcm/app_spec.rb
650
- - spec/unit/client/active_record/gcm/notification_spec.rb
651
670
  - spec/unit/client/active_record/notification_spec.rb
652
671
  - spec/unit/client/active_record/pushy/app_spec.rb
653
672
  - spec/unit/client/active_record/pushy/notification_spec.rb
@@ -670,8 +689,6 @@ files:
670
689
  - spec/unit/client/redis/app_spec.rb
671
690
  - spec/unit/client/redis/fcm/app_spec.rb
672
691
  - spec/unit/client/redis/fcm/notification_spec.rb
673
- - spec/unit/client/redis/gcm/app_spec.rb
674
- - spec/unit/client/redis/gcm/notification_spec.rb
675
692
  - spec/unit/client/redis/notification_spec.rb
676
693
  - spec/unit/client/redis/pushy/app_spec.rb
677
694
  - spec/unit/client/redis/pushy/notification_spec.rb
@@ -689,8 +706,6 @@ files:
689
706
  - spec/unit/client/shared/app.rb
690
707
  - spec/unit/client/shared/fcm/app.rb
691
708
  - spec/unit/client/shared/fcm/notification.rb
692
- - spec/unit/client/shared/gcm/app.rb
693
- - spec/unit/client/shared/gcm/notification.rb
694
709
  - spec/unit/client/shared/notification.rb
695
710
  - spec/unit/client/shared/pushy/app.rb
696
711
  - spec/unit/client/shared/pushy/notification.rb
@@ -703,19 +718,15 @@ files:
703
718
  - spec/unit/configuration_spec.rb
704
719
  - spec/unit/daemon/adm/delivery_spec.rb
705
720
  - spec/unit/daemon/apns/certificate_expired_error_spec.rb
706
- - spec/unit/daemon/apns/delivery_spec.rb
707
- - spec/unit/daemon/apns/feedback_receiver_spec.rb
708
721
  - spec/unit/daemon/apnsp8/delivery_spec.rb
709
722
  - spec/unit/daemon/app_runner_spec.rb
710
723
  - spec/unit/daemon/batch_spec.rb
711
724
  - spec/unit/daemon/delivery_error_spec.rb
712
725
  - spec/unit/daemon/delivery_spec.rb
713
726
  - spec/unit/daemon/dispatcher/http_spec.rb
714
- - spec/unit/daemon/dispatcher/tcp_spec.rb
715
727
  - spec/unit/daemon/dispatcher_loop_spec.rb
716
728
  - spec/unit/daemon/fcm/delivery_spec.rb
717
729
  - spec/unit/daemon/feeder_spec.rb
718
- - spec/unit/daemon/gcm/delivery_spec.rb
719
730
  - spec/unit/daemon/proc_title_spec.rb
720
731
  - spec/unit/daemon/pushy/delivery_spec.rb
721
732
  - spec/unit/daemon/retryable_error_spec.rb
@@ -725,7 +736,6 @@ files:
725
736
  - spec/unit/daemon/store/active_record/reconnectable_spec.rb
726
737
  - spec/unit/daemon/store/active_record_spec.rb
727
738
  - spec/unit/daemon/store/redis_spec.rb
728
- - spec/unit/daemon/tcp_connection_spec.rb
729
739
  - spec/unit/daemon/webpush/delivery_spec.rb
730
740
  - spec/unit/daemon/wns/delivery_spec.rb
731
741
  - spec/unit/daemon/wns/post_request_spec.rb
@@ -761,7 +771,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
761
771
  requirements:
762
772
  - - ">="
763
773
  - !ruby/object:Gem::Version
764
- version: 2.7.0
774
+ version: 3.0.0
765
775
  required_rubygems_version: !ruby/object:Gem::Requirement
766
776
  requirements:
767
777
  - - ">="
@@ -776,14 +786,10 @@ test_files:
776
786
  - spec/.rubocop.yml
777
787
  - spec/functional/adm_spec.rb
778
788
  - spec/functional/apns2_spec.rb
779
- - spec/functional/apns_spec.rb
780
789
  - spec/functional/cli_spec.rb
781
790
  - spec/functional/embed_spec.rb
782
791
  - spec/functional/fcm_priority_spec.rb
783
792
  - spec/functional/fcm_spec.rb
784
- - spec/functional/gcm_priority_spec.rb
785
- - spec/functional/gcm_spec.rb
786
- - spec/functional/new_app_spec.rb
787
793
  - spec/functional/pushy_spec.rb
788
794
  - spec/functional/retry_spec.rb
789
795
  - spec/functional/synchronization_spec.rb
@@ -798,7 +804,6 @@ test_files:
798
804
  - spec/support/simplecov_helper.rb
799
805
  - spec/support/simplecov_quality_formatter.rb
800
806
  - spec/tmp/.gitkeep
801
- - spec/unit/apns_feedback_spec.rb
802
807
  - spec/unit/client/active_record/adm/app_spec.rb
803
808
  - spec/unit/client/active_record/adm/notification_spec.rb
804
809
  - spec/unit/client/active_record/apns/app_spec.rb
@@ -810,8 +815,6 @@ test_files:
810
815
  - spec/unit/client/active_record/app_spec.rb
811
816
  - spec/unit/client/active_record/fcm/app_spec.rb
812
817
  - spec/unit/client/active_record/fcm/notification_spec.rb
813
- - spec/unit/client/active_record/gcm/app_spec.rb
814
- - spec/unit/client/active_record/gcm/notification_spec.rb
815
818
  - spec/unit/client/active_record/notification_spec.rb
816
819
  - spec/unit/client/active_record/pushy/app_spec.rb
817
820
  - spec/unit/client/active_record/pushy/notification_spec.rb
@@ -834,8 +837,6 @@ test_files:
834
837
  - spec/unit/client/redis/app_spec.rb
835
838
  - spec/unit/client/redis/fcm/app_spec.rb
836
839
  - spec/unit/client/redis/fcm/notification_spec.rb
837
- - spec/unit/client/redis/gcm/app_spec.rb
838
- - spec/unit/client/redis/gcm/notification_spec.rb
839
840
  - spec/unit/client/redis/notification_spec.rb
840
841
  - spec/unit/client/redis/pushy/app_spec.rb
841
842
  - spec/unit/client/redis/pushy/notification_spec.rb
@@ -853,8 +854,6 @@ test_files:
853
854
  - spec/unit/client/shared/app.rb
854
855
  - spec/unit/client/shared/fcm/app.rb
855
856
  - spec/unit/client/shared/fcm/notification.rb
856
- - spec/unit/client/shared/gcm/app.rb
857
- - spec/unit/client/shared/gcm/notification.rb
858
857
  - spec/unit/client/shared/notification.rb
859
858
  - spec/unit/client/shared/pushy/app.rb
860
859
  - spec/unit/client/shared/pushy/notification.rb
@@ -867,19 +866,15 @@ test_files:
867
866
  - spec/unit/configuration_spec.rb
868
867
  - spec/unit/daemon/adm/delivery_spec.rb
869
868
  - spec/unit/daemon/apns/certificate_expired_error_spec.rb
870
- - spec/unit/daemon/apns/delivery_spec.rb
871
- - spec/unit/daemon/apns/feedback_receiver_spec.rb
872
869
  - spec/unit/daemon/apnsp8/delivery_spec.rb
873
870
  - spec/unit/daemon/app_runner_spec.rb
874
871
  - spec/unit/daemon/batch_spec.rb
875
872
  - spec/unit/daemon/delivery_error_spec.rb
876
873
  - spec/unit/daemon/delivery_spec.rb
877
874
  - spec/unit/daemon/dispatcher/http_spec.rb
878
- - spec/unit/daemon/dispatcher/tcp_spec.rb
879
875
  - spec/unit/daemon/dispatcher_loop_spec.rb
880
876
  - spec/unit/daemon/fcm/delivery_spec.rb
881
877
  - spec/unit/daemon/feeder_spec.rb
882
- - spec/unit/daemon/gcm/delivery_spec.rb
883
878
  - spec/unit/daemon/proc_title_spec.rb
884
879
  - spec/unit/daemon/pushy/delivery_spec.rb
885
880
  - spec/unit/daemon/retryable_error_spec.rb
@@ -889,7 +884,6 @@ test_files:
889
884
  - spec/unit/daemon/store/active_record/reconnectable_spec.rb
890
885
  - spec/unit/daemon/store/active_record_spec.rb
891
886
  - spec/unit/daemon/store/redis_spec.rb
892
- - spec/unit/daemon/tcp_connection_spec.rb
893
887
  - spec/unit/daemon/webpush/delivery_spec.rb
894
888
  - spec/unit/daemon/wns/delivery_spec.rb
895
889
  - spec/unit/daemon/wns/post_request_spec.rb
@@ -1,18 +0,0 @@
1
- module Rpush
2
- def self.apns_feedback
3
- require 'rpush/daemon'
4
- Rpush::Daemon.common_init
5
-
6
- Rpush::Apns::App.all.each do |app|
7
- # Redis stores every App type on the same namespace, hence the
8
- # additional filtering
9
- next unless app.service_name == 'apns'
10
- next unless app.feedback_enabled
11
-
12
- receiver = Rpush::Daemon::Apns::FeedbackReceiver.new(app)
13
- receiver.check_for_feedback
14
- end
15
-
16
- nil
17
- end
18
- end
@@ -1,19 +0,0 @@
1
- module Rpush
2
- module Client
3
- module ActiveModel
4
- module Gcm
5
- module App
6
- def self.included(base)
7
- base.instance_eval do
8
- validates :auth_key, presence: true
9
- end
10
- end
11
-
12
- def service_name
13
- 'gcm'
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,14 +0,0 @@
1
- module Rpush
2
- module Client
3
- module ActiveModel
4
- module Gcm
5
- class ExpiryCollapseKeyMutualInclusionValidator < ::ActiveModel::Validator
6
- def validate(record)
7
- return unless record.collapse_key && !record.expiry
8
- record.errors.add :expiry, 'must be set when using a collapse_key'
9
- end
10
- end
11
- end
12
- end
13
- end
14
- end
@@ -1,62 +0,0 @@
1
- module Rpush
2
- module Client
3
- module ActiveModel
4
- module Gcm
5
- module Notification
6
- GCM_PRIORITY_HIGH = Rpush::Client::ActiveModel::Apns::Notification::APNS_PRIORITY_IMMEDIATE
7
- GCM_PRIORITY_NORMAL = Rpush::Client::ActiveModel::Apns::Notification::APNS_PRIORITY_CONSERVE_POWER
8
- GCM_PRIORITIES = [GCM_PRIORITY_HIGH, GCM_PRIORITY_NORMAL]
9
-
10
- def self.included(base)
11
- base.instance_eval do
12
- validates :registration_ids, presence: true
13
- validates :priority, inclusion: { in: GCM_PRIORITIES }, allow_nil: true
14
- validates :dry_run, inclusion: { in: [true, false] }
15
-
16
- validates_with Rpush::Client::ActiveModel::PayloadDataSizeValidator, limit: 4096
17
- validates_with Rpush::Client::ActiveModel::RegistrationIdsCountValidator, limit: 1000
18
-
19
- validates_with Rpush::Client::ActiveModel::Gcm::ExpiryCollapseKeyMutualInclusionValidator
20
- end
21
- end
22
-
23
- # This is a hack. The schema defines `priority` to be an integer, but GCM expects a string.
24
- # But for users of rpush to have an API they might expect (setting priority to `high`, not 10)
25
- # we do a little conversion here.
26
- # I'm not happy about it, but this will have to do until I can take a further look.
27
- def priority=(priority)
28
- case priority
29
- when 'high', GCM_PRIORITY_HIGH
30
- super(GCM_PRIORITY_HIGH)
31
- when 'normal', GCM_PRIORITY_NORMAL
32
- super(GCM_PRIORITY_NORMAL)
33
- else
34
- errors.add(:priority, 'must be one of either "normal" or "high"')
35
- end
36
- end
37
-
38
- def as_json(options = nil) # rubocop:disable Metrics/PerceivedComplexity
39
- json = {
40
- 'registration_ids' => registration_ids,
41
- 'delay_while_idle' => delay_while_idle,
42
- 'data' => data
43
- }
44
- json['collapse_key'] = collapse_key if collapse_key
45
- json['content_available'] = content_available if content_available
46
- json['mutable_content'] = mutable_content if mutable_content
47
- json['dry_run'] = dry_run if dry_run
48
- json['notification'] = notification if notification
49
- json['priority'] = priority_for_notification if priority
50
- json['time_to_live'] = expiry if expiry
51
- json
52
- end
53
-
54
- def priority_for_notification
55
- return 'high' if priority == GCM_PRIORITY_HIGH
56
- 'normal' if priority == GCM_PRIORITY_NORMAL
57
- end
58
- end
59
- end
60
- end
61
- end
62
- end
@@ -1,11 +0,0 @@
1
- module Rpush
2
- module Client
3
- module ActiveRecord
4
- module Gcm
5
- class App < Rpush::Client::ActiveRecord::App
6
- include Rpush::Client::ActiveModel::Gcm::App
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- module Rpush
2
- module Client
3
- module ActiveRecord
4
- module Gcm
5
- class Notification < Rpush::Client::ActiveRecord::Notification
6
- include Rpush::Client::ActiveModel::Gcm::Notification
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- module Rpush
2
- module Client
3
- module Redis
4
- module Gcm
5
- class App < Rpush::Client::Redis::App
6
- include Rpush::Client::ActiveModel::Gcm::App
7
- end
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- module Rpush
2
- module Client
3
- module Redis
4
- module Gcm
5
- class Notification < Rpush::Client::Redis::Notification
6
- include Rpush::Client::ActiveModel::Gcm::Notification
7
- end
8
- end
9
- end
10
- end
11
- end