actionwebpush 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 +7 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/CONTRIBUTING.md +256 -0
- data/LICENSE.txt +21 -0
- data/README.md +569 -0
- data/Rakefile +17 -0
- data/app/controllers/actionwebpush/subscriptions_controller.rb +60 -0
- data/app/models/actionwebpush/subscription.rb +164 -0
- data/config/routes.rb +5 -0
- data/db/migrate/001_create_action_web_push_subscriptions.rb +17 -0
- data/lib/actionwebpush/analytics.rb +197 -0
- data/lib/actionwebpush/authorization.rb +236 -0
- data/lib/actionwebpush/base.rb +107 -0
- data/lib/actionwebpush/batch_delivery.rb +92 -0
- data/lib/actionwebpush/configuration.rb +91 -0
- data/lib/actionwebpush/delivery_job.rb +52 -0
- data/lib/actionwebpush/delivery_methods/base.rb +19 -0
- data/lib/actionwebpush/delivery_methods/test.rb +36 -0
- data/lib/actionwebpush/delivery_methods/web_push.rb +74 -0
- data/lib/actionwebpush/engine.rb +20 -0
- data/lib/actionwebpush/error_handler.rb +99 -0
- data/lib/actionwebpush/generators/campfire_migration_generator.rb +69 -0
- data/lib/actionwebpush/generators/install_generator.rb +47 -0
- data/lib/actionwebpush/generators/templates/campfire_compatibility.rb +173 -0
- data/lib/actionwebpush/generators/templates/campfire_data_migration.rb +98 -0
- data/lib/actionwebpush/generators/templates/create_action_web_push_subscriptions.rb +17 -0
- data/lib/actionwebpush/generators/templates/initializer.rb +16 -0
- data/lib/actionwebpush/generators/vapid_keys_generator.rb +38 -0
- data/lib/actionwebpush/instrumentation.rb +31 -0
- data/lib/actionwebpush/logging.rb +38 -0
- data/lib/actionwebpush/metrics.rb +67 -0
- data/lib/actionwebpush/notification.rb +97 -0
- data/lib/actionwebpush/pool.rb +167 -0
- data/lib/actionwebpush/railtie.rb +48 -0
- data/lib/actionwebpush/rate_limiter.rb +167 -0
- data/lib/actionwebpush/sentry_integration.rb +104 -0
- data/lib/actionwebpush/status_broadcaster.rb +62 -0
- data/lib/actionwebpush/status_channel.rb +21 -0
- data/lib/actionwebpush/tenant_configuration.rb +106 -0
- data/lib/actionwebpush/test_helper.rb +68 -0
- data/lib/actionwebpush/version.rb +5 -0
- data/lib/actionwebpush.rb +78 -0
- data/sig/actionwebpush.rbs +4 -0
- metadata +212 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 51cb63d596feca886277a0250aafac6390f5e20d46e90a846a23ab92ab39656c
|
4
|
+
data.tar.gz: cc5610b7429e76b0976e80192ecac7d4dcca5522c6959919675ed4b05dd4baae
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8336fb0ccc3c877db99b20e36032535fe3c07cdb13f98d4129ad2dd64777801648271483189813fff7c917be92e47b4f788da6c1b6d1a216a7338943bf24e4a3
|
7
|
+
data.tar.gz: 98945510bf3e1f82fdd2e48115b9cd57edb0779257c273d0ac5ea24325513c6f408708812c9c385b402732fae32b3a4c6d3ca253ca6d0d2dfc5ba877af5fb7c4
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.4.5
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at keshavkk.musafir@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,256 @@
|
|
1
|
+
# Contributing to ActionWebPush
|
2
|
+
|
3
|
+
Thank you for your interest in contributing to ActionWebPush! This document provides guidelines and information for contributors.
|
4
|
+
|
5
|
+
## Table of Contents
|
6
|
+
|
7
|
+
- [Code of Conduct](#code-of-conduct)
|
8
|
+
- [Getting Started](#getting-started)
|
9
|
+
- [Development Setup](#development-setup)
|
10
|
+
- [Making Changes](#making-changes)
|
11
|
+
- [Testing](#testing)
|
12
|
+
- [Submitting Changes](#submitting-changes)
|
13
|
+
- [Release Process](#release-process)
|
14
|
+
|
15
|
+
## Code of Conduct
|
16
|
+
|
17
|
+
This project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
18
|
+
|
19
|
+
## Getting Started
|
20
|
+
|
21
|
+
1. Fork the repository on GitHub
|
22
|
+
2. Clone your fork locally
|
23
|
+
3. Set up the development environment
|
24
|
+
4. Create a feature branch for your changes
|
25
|
+
|
26
|
+
## Development Setup
|
27
|
+
|
28
|
+
### Prerequisites
|
29
|
+
|
30
|
+
- Ruby 2.6.0 or higher
|
31
|
+
- Rails 6.0 or higher
|
32
|
+
- Redis (for rate limiting tests)
|
33
|
+
- Git
|
34
|
+
|
35
|
+
### Setup
|
36
|
+
|
37
|
+
```bash
|
38
|
+
# Clone your fork
|
39
|
+
git clone https://github.com/yourusername/actionwebpush.git
|
40
|
+
cd actionwebpush
|
41
|
+
|
42
|
+
# Install dependencies
|
43
|
+
bundle install
|
44
|
+
|
45
|
+
# Run tests to ensure everything works
|
46
|
+
bundle exec rake test
|
47
|
+
```
|
48
|
+
|
49
|
+
### Development Dependencies
|
50
|
+
|
51
|
+
The gem uses these development tools:
|
52
|
+
- **Minitest** for testing
|
53
|
+
- **SQLite3** for test database
|
54
|
+
- **Resque** for background job testing
|
55
|
+
- **WebMock** for HTTP mocking in tests
|
56
|
+
|
57
|
+
## Making Changes
|
58
|
+
|
59
|
+
### Branch Naming
|
60
|
+
|
61
|
+
Use descriptive branch names:
|
62
|
+
- `feature/add-batch-delivery`
|
63
|
+
- `fix/rate-limiter-race-condition`
|
64
|
+
- `docs/update-readme`
|
65
|
+
|
66
|
+
### Code Style
|
67
|
+
|
68
|
+
- Follow Ruby community standards
|
69
|
+
- Use 2 spaces for indentation
|
70
|
+
- Keep lines under 120 characters
|
71
|
+
- Add comments for complex logic
|
72
|
+
- Use descriptive variable and method names
|
73
|
+
|
74
|
+
### Commit Messages
|
75
|
+
|
76
|
+
Write clear, descriptive commit messages:
|
77
|
+
```
|
78
|
+
Add batch delivery optimization for large subscription lists
|
79
|
+
|
80
|
+
- Implement batching logic in BatchDelivery class
|
81
|
+
- Add configuration option for batch size
|
82
|
+
- Include tests for batch processing
|
83
|
+
- Update documentation with batch delivery examples
|
84
|
+
|
85
|
+
Fixes #42
|
86
|
+
```
|
87
|
+
|
88
|
+
## Testing
|
89
|
+
|
90
|
+
### Running Tests
|
91
|
+
|
92
|
+
```bash
|
93
|
+
# Run all tests
|
94
|
+
bundle exec rake test
|
95
|
+
|
96
|
+
# Run specific test file
|
97
|
+
bundle exec ruby test/notification_test.rb
|
98
|
+
|
99
|
+
# Run tests with coverage
|
100
|
+
bundle exec rake test:coverage
|
101
|
+
```
|
102
|
+
|
103
|
+
### Test Structure
|
104
|
+
|
105
|
+
- **Unit tests**: Test individual classes and methods
|
106
|
+
- **Integration tests**: Test component interactions
|
107
|
+
- **System tests**: Test end-to-end functionality
|
108
|
+
|
109
|
+
### Writing Tests
|
110
|
+
|
111
|
+
- Write tests for new features
|
112
|
+
- Ensure edge cases are covered
|
113
|
+
- Mock external dependencies (WebPush API calls)
|
114
|
+
- Use descriptive test names
|
115
|
+
|
116
|
+
Example:
|
117
|
+
```ruby
|
118
|
+
def test_notification_delivery_with_expired_subscription
|
119
|
+
# Test setup
|
120
|
+
# Test execution
|
121
|
+
# Assertions
|
122
|
+
end
|
123
|
+
```
|
124
|
+
|
125
|
+
### Test Requirements
|
126
|
+
|
127
|
+
- All new code must have tests
|
128
|
+
- Maintain or improve test coverage
|
129
|
+
- Tests must pass on Ruby 2.6+ and Rails 6.0+
|
130
|
+
|
131
|
+
## Submitting Changes
|
132
|
+
|
133
|
+
### Pull Request Process
|
134
|
+
|
135
|
+
1. **Update documentation** if your changes affect the public API
|
136
|
+
2. **Add tests** for new functionality
|
137
|
+
3. **Update CHANGELOG.md** with your changes
|
138
|
+
4. **Ensure all tests pass**
|
139
|
+
5. **Create a pull request** with:
|
140
|
+
- Clear title and description
|
141
|
+
- Reference to related issues
|
142
|
+
- Screenshots/examples if applicable
|
143
|
+
|
144
|
+
### Pull Request Template
|
145
|
+
|
146
|
+
```markdown
|
147
|
+
## Description
|
148
|
+
Brief description of changes
|
149
|
+
|
150
|
+
## Type of Change
|
151
|
+
- [ ] Bug fix
|
152
|
+
- [ ] New feature
|
153
|
+
- [ ] Breaking change
|
154
|
+
- [ ] Documentation update
|
155
|
+
|
156
|
+
## Testing
|
157
|
+
- [ ] Tests added/updated
|
158
|
+
- [ ] All tests pass
|
159
|
+
- [ ] Manual testing completed
|
160
|
+
|
161
|
+
## Checklist
|
162
|
+
- [ ] Code follows project style guidelines
|
163
|
+
- [ ] Self-review completed
|
164
|
+
- [ ] Documentation updated
|
165
|
+
- [ ] CHANGELOG.md updated
|
166
|
+
```
|
167
|
+
|
168
|
+
### Review Process
|
169
|
+
|
170
|
+
- Maintainers will review your PR
|
171
|
+
- Address feedback promptly
|
172
|
+
- Be open to suggestions and changes
|
173
|
+
- Once approved, your PR will be merged
|
174
|
+
|
175
|
+
## Types of Contributions
|
176
|
+
|
177
|
+
### Bug Reports
|
178
|
+
|
179
|
+
When reporting bugs, include:
|
180
|
+
- Ruby and Rails versions
|
181
|
+
- Gem version
|
182
|
+
- Steps to reproduce
|
183
|
+
- Expected vs actual behavior
|
184
|
+
- Error messages/stack traces
|
185
|
+
|
186
|
+
### Feature Requests
|
187
|
+
|
188
|
+
For new features:
|
189
|
+
- Describe the use case
|
190
|
+
- Explain why it's valuable
|
191
|
+
- Consider backwards compatibility
|
192
|
+
- Provide implementation ideas if possible
|
193
|
+
|
194
|
+
### Documentation
|
195
|
+
|
196
|
+
Documentation improvements are always welcome:
|
197
|
+
- Fix typos and grammar
|
198
|
+
- Add examples
|
199
|
+
- Improve clarity
|
200
|
+
- Translate content
|
201
|
+
|
202
|
+
### Code Contributions
|
203
|
+
|
204
|
+
Areas where contributions are especially welcome:
|
205
|
+
- Performance optimizations
|
206
|
+
- Additional delivery methods
|
207
|
+
- Better error handling
|
208
|
+
- Enhanced configuration options
|
209
|
+
- More comprehensive tests
|
210
|
+
|
211
|
+
## Release Process
|
212
|
+
|
213
|
+
1. Update version in `lib/actionwebpush/version.rb`
|
214
|
+
2. Update `CHANGELOG.md` with release notes
|
215
|
+
3. Create git tag for version
|
216
|
+
4. Build and push gem to RubyGems
|
217
|
+
5. Create GitHub release with notes
|
218
|
+
|
219
|
+
## Development Guidelines
|
220
|
+
|
221
|
+
### Adding New Features
|
222
|
+
|
223
|
+
1. **Discuss first**: Open an issue to discuss major features
|
224
|
+
2. **Design consideration**: Consider impact on existing API
|
225
|
+
3. **Documentation**: Update README and API docs
|
226
|
+
4. **Tests**: Comprehensive test coverage required
|
227
|
+
5. **Examples**: Add usage examples
|
228
|
+
|
229
|
+
### Maintaining Backward Compatibility
|
230
|
+
|
231
|
+
- Avoid breaking changes in minor versions
|
232
|
+
- Deprecate features before removing them
|
233
|
+
- Provide migration paths for breaking changes
|
234
|
+
- Document any compatibility requirements
|
235
|
+
|
236
|
+
### Performance Considerations
|
237
|
+
|
238
|
+
- Profile performance-critical code
|
239
|
+
- Consider memory usage in long-running processes
|
240
|
+
- Test with realistic data volumes
|
241
|
+
- Document performance characteristics
|
242
|
+
|
243
|
+
## Getting Help
|
244
|
+
|
245
|
+
- **Issues**: Use GitHub issues for bugs and feature requests
|
246
|
+
- **Discussions**: Use GitHub discussions for questions
|
247
|
+
- **Email**: Contact maintainers for security issues
|
248
|
+
|
249
|
+
## Recognition
|
250
|
+
|
251
|
+
Contributors will be:
|
252
|
+
- Listed in the gem's credits
|
253
|
+
- Mentioned in release notes for significant contributions
|
254
|
+
- Invited to be maintainers for consistent, high-quality contributions
|
255
|
+
|
256
|
+
Thank you for contributing to ActionWebPush! 🚀
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Keshav Kk
|
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.
|