active_delivery_rpush 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 29c5d30a6cdd0dd54cc727f0bcb6115c2c5664e3ba86b5f7d09a858125208c89
4
+ data.tar.gz: 510aa7058cc1e4c770a68d35cc8a346babed1deaf906c7efba5c7742f0055508
5
+ SHA512:
6
+ metadata.gz: 4e01dd6d6a73f9646151eafa290a65adde749a425b51682f1fbf7bd1c7274c0568a164f76a72298dd1426f0201a5c6b695ca128e1a2b991e3ab95d4753c2dbed
7
+ data.tar.gz: 7bf02bacf674081da159db1dbb586c5e990f8b4b05e3390f97e366dd6c9f35cf490104873e610fd4c21c78601a8f828b757102e2d0b3c6689be730004c32f34c
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.5
6
+ before_install: gem install bundler -v 2.1.3
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in active_delivery_rpush.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "minitest", "~> 5.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,95 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ active_delivery_rpush (0.1.0)
5
+ abstract_notifier (~> 0.2.0)
6
+ active_delivery (~> 0.3.1)
7
+ rpush (~> 5.0.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ abstract_notifier (0.2.0)
13
+ actionpack (6.0.2.1)
14
+ actionview (= 6.0.2.1)
15
+ activesupport (= 6.0.2.1)
16
+ rack (~> 2.0, >= 2.0.8)
17
+ rack-test (>= 0.6.3)
18
+ rails-dom-testing (~> 2.0)
19
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
20
+ actionview (6.0.2.1)
21
+ activesupport (= 6.0.2.1)
22
+ builder (~> 3.1)
23
+ erubi (~> 1.4)
24
+ rails-dom-testing (~> 2.0)
25
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
26
+ active_delivery (0.3.1)
27
+ activesupport (6.0.2.1)
28
+ concurrent-ruby (~> 1.0, >= 1.0.2)
29
+ i18n (>= 0.7, < 2)
30
+ minitest (~> 5.1)
31
+ tzinfo (~> 1.1)
32
+ zeitwerk (~> 2.2)
33
+ builder (3.2.4)
34
+ concurrent-ruby (1.1.6)
35
+ connection_pool (2.2.2)
36
+ crass (1.0.6)
37
+ erubi (1.9.0)
38
+ http-2 (0.10.1)
39
+ i18n (1.8.2)
40
+ concurrent-ruby (~> 1.0)
41
+ jwt (2.2.1)
42
+ loofah (2.4.0)
43
+ crass (~> 1.0.2)
44
+ nokogiri (>= 1.5.9)
45
+ method_source (0.9.2)
46
+ mini_portile2 (2.4.0)
47
+ minitest (5.14.0)
48
+ multi_json (1.14.1)
49
+ net-http-persistent (3.1.0)
50
+ connection_pool (~> 2.2)
51
+ net-http2 (0.18.2)
52
+ http-2 (~> 0.10.1)
53
+ nokogiri (1.10.8)
54
+ mini_portile2 (~> 2.4.0)
55
+ rack (2.2.2)
56
+ rack-test (1.1.0)
57
+ rack (>= 1.0, < 3)
58
+ rails-dom-testing (2.0.3)
59
+ activesupport (>= 4.2.0)
60
+ nokogiri (>= 1.6)
61
+ rails-html-sanitizer (1.3.0)
62
+ loofah (~> 2.3)
63
+ railties (6.0.2.1)
64
+ actionpack (= 6.0.2.1)
65
+ activesupport (= 6.0.2.1)
66
+ method_source
67
+ rake (>= 0.8.7)
68
+ thor (>= 0.20.3, < 2.0)
69
+ rainbow (3.0.0)
70
+ rake (12.3.3)
71
+ rpush (5.0.0)
72
+ activesupport (>= 5.0)
73
+ jwt (>= 1.5.6)
74
+ multi_json (~> 1.0)
75
+ net-http-persistent
76
+ net-http2 (~> 0.14)
77
+ railties
78
+ rainbow
79
+ thor (>= 0.18.1, < 2.0)
80
+ thor (1.0.1)
81
+ thread_safe (0.3.6)
82
+ tzinfo (1.2.6)
83
+ thread_safe (~> 0.1)
84
+ zeitwerk (2.2.2)
85
+
86
+ PLATFORMS
87
+ ruby
88
+
89
+ DEPENDENCIES
90
+ active_delivery_rpush!
91
+ minitest (~> 5.0)
92
+ rake (~> 12.0)
93
+
94
+ BUNDLED WITH
95
+ 2.1.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Paul d'Hubert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # ActiveDeliveryRpush
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/active_delivery_rpush`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'active_delivery_rpush'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install active_delivery_rpush
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/active_delivery_rpush.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,32 @@
1
+ require_relative 'lib/active_delivery_rpush/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "active_delivery_rpush"
5
+ spec.version = ActiveDeliveryRpush::VERSION
6
+ spec.authors = ["Paul d'Hubert"]
7
+ spec.email = ["paul.dhubert@pm.me"]
8
+
9
+ spec.summary = %q{Integrates rpush notification service with active delivery}
10
+ spec.description = spec.summary
11
+ spec.homepage = "https://github.com/pauldub/active_delivery_rpush"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/pauldub/active_delivery_rpush"
19
+ spec.metadata["changelog_uri"] = "https://github.com/pauldub/active_delivery_rpush/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+ spec.add_runtime_dependency 'rpush', '~> 5.0.0'
30
+ spec.add_runtime_dependency 'active_delivery', '~> 0.3.1'
31
+ spec.add_runtime_dependency 'abstract_notifier', '~> 0.2.0'
32
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "active_delivery_rpush"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,13 @@
1
+ require "active_delivery_rpush/version"
2
+
3
+ module ActiveDeliveryRpush
4
+ class Error < StandardError; end
5
+ end
6
+
7
+ require 'rpush'
8
+ require 'active_delivery'
9
+
10
+ require "active_delivery_rpush/line"
11
+ require "active_delivery_rpush/driver"
12
+ require "active_delivery_rpush/notifier"
13
+ require "active_delivery_rpush/fcm_notifier"
@@ -0,0 +1,19 @@
1
+ # lib/driver.rb
2
+
3
+ module ActiveDeliveryRpush
4
+ class Driver
5
+ def initialize(notification_klass)
6
+ @notification_klass = notification_klass
7
+ end
8
+
9
+ def call(params)
10
+ raise ArgumentError, "`app` must be passed as a param" unless params.fetch(:app, nil)
11
+
12
+ notification = @notification_klass.new(
13
+ params
14
+ )
15
+
16
+ notification.save!
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ # lib/line.rb
2
+
3
+
4
+ module ActiveDeliveryRpush
5
+ class Line < ActiveDelivery::Lines::Base
6
+ def resolve_class(name)
7
+ name.gsub(/Delivery$/, "Notification").safe_constantize
8
+ end
9
+
10
+ def notify?(delivery_action)
11
+ handler_class.respond_to?(delivery_action)
12
+ end
13
+
14
+ def notify_now(sender, delivery_action, *args)
15
+ sender.public_send(delivery_action, *args).notify_now
16
+ end
17
+
18
+ def notify_later(sender, delivery_action, *args)
19
+ sender.public_send(delivery_action, *args).notify_later
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ # lib/notifier.rb
2
+
3
+ require 'abstract_notifier/base'
4
+
5
+ module ActiveDeliveryRpush
6
+ class Notifier < AbstractNotifier::Base
7
+ def notification(**payload)
8
+ merge_defaults!(payload)
9
+ AbstractNotifier::Notification.new(self.class, payload)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module ActiveDeliveryRpush
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_delivery_rpush
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Paul d'Hubert
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 1970-01-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rpush
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: active_delivery
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: abstract_notifier
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.2.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.2.0
55
+ description: Integrates rpush notification service with active delivery
56
+ email:
57
+ - paul.dhubert@pm.me
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - active_delivery_rpush.gemspec
70
+ - bin/console
71
+ - bin/setup
72
+ - lib/active_delivery_rpush.rb
73
+ - lib/active_delivery_rpush/driver.rb
74
+ - lib/active_delivery_rpush/line.rb
75
+ - lib/active_delivery_rpush/notifier.rb
76
+ - lib/active_delivery_rpush/version.rb
77
+ homepage: https://github.com/pauldub/active_delivery_rpush
78
+ licenses:
79
+ - MIT
80
+ metadata:
81
+ allowed_push_host: https://rubygems.org
82
+ homepage_uri: https://github.com/pauldub/active_delivery_rpush
83
+ source_code_uri: https://github.com/pauldub/active_delivery_rpush
84
+ changelog_uri: https://github.com/pauldub/active_delivery_rpush/CHANGELOG.md
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: 2.3.0
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubygems_version: 3.0.6
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Integrates rpush notification service with active delivery
104
+ test_files: []