lex-pushover 0.1.3 → 0.2.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 +4 -4
- data/.github/workflows/ci.yml +16 -0
- data/.rubocop.yml +37 -15
- data/CHANGELOG.md +14 -0
- data/CLAUDE.md +92 -0
- data/Gemfile +12 -1
- data/Gemfile.lock +81 -51
- data/README.md +37 -42
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/lex-pushover.gemspec +7 -14
- data/lib/legion/extensions/pushover/client.rb +25 -0
- data/lib/legion/extensions/pushover/helpers/client.rb +28 -22
- data/lib/legion/extensions/pushover/runners/message.rb +41 -35
- data/lib/legion/extensions/pushover/version.rb +3 -1
- data/lib/legion/extensions/pushover.rb +4 -2
- metadata +13 -137
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2dd17b806a568a272f8a94a8cc4da8d8264c1106416c0fc256dc45847fb8271f
|
|
4
|
+
data.tar.gz: 6c807ad3386b93d6c281bc028fe4355a6cf0c79961e569913289a5b0cb41e1e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b786321dd687d1a3d40b5fdbf9338a9c0a8acac23117ec0442cf28c06bdec920aabacb7f59616d8f5d7310bdaa9e37d124255eae6b1ad8dbf0aa3089478837a1
|
|
7
|
+
data.tar.gz: 0f0f4815f9dda2224906837cee33c4abb412a9b8e4d84b611c7874d71f867eb6bda00cbde621dd040c4071697e95b133e3a6c823e04e0598810aae56927ef14c
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
ci:
|
|
9
|
+
uses: LegionIO/.github/.github/workflows/ci.yml@main
|
|
10
|
+
|
|
11
|
+
release:
|
|
12
|
+
needs: ci
|
|
13
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
14
|
+
uses: LegionIO/.github/.github/workflows/release.yml@main
|
|
15
|
+
secrets:
|
|
16
|
+
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
|
data/.rubocop.yml
CHANGED
|
@@ -1,26 +1,48 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 3.4
|
|
3
|
+
NewCops: enable
|
|
4
|
+
SuggestExtensions: false
|
|
5
|
+
|
|
1
6
|
Layout/LineLength:
|
|
2
|
-
Max:
|
|
3
|
-
|
|
4
|
-
Max: 30
|
|
5
|
-
Metrics/ClassLength:
|
|
6
|
-
Max: 1500
|
|
7
|
-
Metrics/BlockLength:
|
|
8
|
-
Max: 50
|
|
7
|
+
Max: 160
|
|
8
|
+
|
|
9
9
|
Layout/SpaceAroundEqualsInParameterDefault:
|
|
10
10
|
EnforcedStyle: space
|
|
11
|
-
|
|
12
|
-
Enabled: true
|
|
11
|
+
|
|
13
12
|
Layout/HashAlignment:
|
|
14
13
|
EnforcedHashRocketStyle: table
|
|
15
14
|
EnforcedColonStyle: table
|
|
15
|
+
|
|
16
|
+
Metrics/MethodLength:
|
|
17
|
+
Max: 50
|
|
18
|
+
|
|
19
|
+
Metrics/ClassLength:
|
|
20
|
+
Max: 1500
|
|
21
|
+
|
|
22
|
+
Metrics/ModuleLength:
|
|
23
|
+
Max: 1500
|
|
24
|
+
|
|
25
|
+
Metrics/BlockLength:
|
|
26
|
+
Max: 40
|
|
27
|
+
|
|
28
|
+
Metrics/AbcSize:
|
|
29
|
+
Max: 60
|
|
30
|
+
|
|
31
|
+
Metrics/CyclomaticComplexity:
|
|
32
|
+
Max: 15
|
|
33
|
+
|
|
34
|
+
Metrics/PerceivedComplexity:
|
|
35
|
+
Max: 17
|
|
36
|
+
|
|
16
37
|
Style/Documentation:
|
|
17
38
|
Enabled: false
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
39
|
+
|
|
40
|
+
Style/SymbolArray:
|
|
41
|
+
Enabled: true
|
|
42
|
+
|
|
21
43
|
Style/FrozenStringLiteralComment:
|
|
22
|
-
Enabled:
|
|
44
|
+
Enabled: true
|
|
45
|
+
EnforcedStyle: always
|
|
46
|
+
|
|
23
47
|
Naming/FileName:
|
|
24
48
|
Enabled: false
|
|
25
|
-
Style/ClassAndModuleChildren:
|
|
26
|
-
Enabled: false
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.2.0] - 2026-03-15
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Standalone `Client` class (`Legion::Extensions::Pushover::Client`) that includes all Runner modules
|
|
7
|
+
- `Client#initialize` accepts `user_key:` and `api_token:` keyword arguments stored in `@opts`
|
|
8
|
+
- `Client#find_setting` resolves credentials from per-call opts or stored `@opts`
|
|
9
|
+
- Specs for `Client` class covering initialization, `find_setting`, and runner method presence
|
|
10
|
+
|
|
11
|
+
## [0.1.3] - 2026-03-13
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- Initial release
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# lex-pushover: Pushover Notification Extension for LegionIO
|
|
2
|
+
|
|
3
|
+
**Repository Level 3 Documentation**
|
|
4
|
+
- **Parent**: `/Users/miverso2/rubymine/legion/extensions-other/CLAUDE.md`
|
|
5
|
+
- **Grandparent**: `/Users/miverso2/rubymine/legion/CLAUDE.md`
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Legion Extension that connects LegionIO to the Pushover push notification service. Provides runners for sending messages to Pushover-connected devices with configurable priority levels.
|
|
10
|
+
|
|
11
|
+
**GitHub**: https://github.com/LegionIO/lex-pushover
|
|
12
|
+
**License**: MIT
|
|
13
|
+
**Version**: 0.2.0
|
|
14
|
+
|
|
15
|
+
## Architecture
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Legion::Extensions::Pushover
|
|
19
|
+
├── Client # Standalone client: includes all runners + helpers; accepts user_key/api_token kwargs
|
|
20
|
+
├── Runners/
|
|
21
|
+
│ └── Message # Priority-based push notifications
|
|
22
|
+
└── Helpers/
|
|
23
|
+
└── Client # Pushover::Message builder (token, user from settings)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Key Files
|
|
27
|
+
|
|
28
|
+
| Path | Purpose |
|
|
29
|
+
|------|---------|
|
|
30
|
+
| `lib/legion/extensions/pushover.rb` | Entry point, extension registration |
|
|
31
|
+
| `lib/legion/extensions/pushover/client.rb` | Standalone client; includes Helpers::Client + Runners::Message |
|
|
32
|
+
| `lib/legion/extensions/pushover/runners/message.rb` | push, emergency, high, normal, low, lowest |
|
|
33
|
+
| `lib/legion/extensions/pushover/helpers/client.rb` | Pushover message factory, reads token/user from settings |
|
|
34
|
+
|
|
35
|
+
## Runner: Message
|
|
36
|
+
|
|
37
|
+
| Method | Priority | Description |
|
|
38
|
+
|--------|----------|-------------|
|
|
39
|
+
| `push` | default | Send a notification |
|
|
40
|
+
| `emergency` | 2 | Emergency priority (requires ack) |
|
|
41
|
+
| `high` | 1 | High priority |
|
|
42
|
+
| `normal` | 0 | Normal priority |
|
|
43
|
+
| `low` | -1 | Low priority |
|
|
44
|
+
| `lowest` | -2 | Lowest priority |
|
|
45
|
+
|
|
46
|
+
All methods accept `message:` (required), `title:`, `token:`, `user:`, `device:`, `url:`, `url_title:`, `sound:`, `expire:`, `retry:`, `callback:`.
|
|
47
|
+
|
|
48
|
+
## Standalone Usage
|
|
49
|
+
|
|
50
|
+
`Legion::Extensions::Pushover::Client` can be used outside the Legion runtime by instantiating it directly:
|
|
51
|
+
|
|
52
|
+
```ruby
|
|
53
|
+
client = Legion::Extensions::Pushover::Client.new(user_key: 'uXXX', api_token: 'aXXX')
|
|
54
|
+
client.push(message: 'Deploy complete')
|
|
55
|
+
client.high(message: 'Disk usage above 90%', title: 'Alert')
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Credentials passed at construction are merged with per-call kwargs; per-call values take precedence.
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
Token and user can be set globally in Legion settings or passed per-message in the payload:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"extensions": {
|
|
67
|
+
"pushover": {
|
|
68
|
+
"enabled": true,
|
|
69
|
+
"token": "your_app_token",
|
|
70
|
+
"user": "your_user_key"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Dependencies
|
|
77
|
+
|
|
78
|
+
| Gem | Purpose |
|
|
79
|
+
|-----|---------|
|
|
80
|
+
| `pushover` (>= 3.0.0) | Pushover Ruby client |
|
|
81
|
+
|
|
82
|
+
## Development
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
bundle install
|
|
86
|
+
bundle exec rspec
|
|
87
|
+
bundle exec rubocop
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
**Maintained By**: Matthew Iverson (@Esity)
|
data/Gemfile
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
source 'https://rubygems.org'
|
|
2
4
|
|
|
3
|
-
# Specify your gem's dependencies in legion-extensions-pushover.gemspec
|
|
4
5
|
gemspec
|
|
6
|
+
|
|
7
|
+
gem 'bundler'
|
|
8
|
+
gem 'codecov'
|
|
9
|
+
gem 'rake', '~> 12.0'
|
|
10
|
+
gem 'rspec', '~> 3.0'
|
|
11
|
+
gem 'rspec_junit_formatter'
|
|
12
|
+
gem 'rubocop'
|
|
13
|
+
gem 'rubocop-md'
|
|
14
|
+
gem 'rubocop-performance'
|
|
15
|
+
gem 'rubocop-rspec'
|
data/Gemfile.lock
CHANGED
|
@@ -1,82 +1,112 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lex-pushover (0.
|
|
4
|
+
lex-pushover (0.2.0)
|
|
5
5
|
pushover (>= 3.0.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
addressable (2.8.9)
|
|
11
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
12
|
+
ast (2.4.3)
|
|
13
|
+
bigdecimal (4.0.1)
|
|
14
|
+
codecov (0.6.0)
|
|
15
|
+
simplecov (>= 0.15, < 0.22)
|
|
16
|
+
diff-lcs (1.6.2)
|
|
17
|
+
docile (1.4.1)
|
|
18
|
+
excon (1.4.0)
|
|
19
|
+
logger
|
|
20
|
+
gli (2.22.2)
|
|
21
|
+
ostruct
|
|
22
|
+
json (2.19.1)
|
|
23
|
+
json-schema (6.2.0)
|
|
24
|
+
addressable (~> 2.8)
|
|
25
|
+
bigdecimal (>= 3.1, < 5)
|
|
26
|
+
language_server-protocol (3.17.0.5)
|
|
27
|
+
lint_roller (1.1.0)
|
|
28
|
+
logger (1.7.0)
|
|
29
|
+
mcp (0.8.0)
|
|
30
|
+
json-schema (>= 4.1)
|
|
31
|
+
oj (3.16.16)
|
|
32
|
+
bigdecimal (>= 3.0)
|
|
33
|
+
ostruct (>= 0.2)
|
|
34
|
+
ostruct (0.6.3)
|
|
35
|
+
parallel (1.27.0)
|
|
36
|
+
parser (3.3.10.2)
|
|
22
37
|
ast (~> 2.4.1)
|
|
38
|
+
racc
|
|
39
|
+
prism (1.9.0)
|
|
40
|
+
public_suffix (7.0.5)
|
|
23
41
|
pushover (3.0.3)
|
|
24
42
|
excon
|
|
25
43
|
gli
|
|
26
44
|
oj
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
rspec (3.
|
|
32
|
-
rspec-core (~> 3.
|
|
33
|
-
rspec-expectations (~> 3.
|
|
34
|
-
rspec-mocks (~> 3.
|
|
35
|
-
rspec-core (3.
|
|
36
|
-
rspec-support (~> 3.
|
|
37
|
-
rspec-expectations (3.
|
|
45
|
+
racc (1.8.1)
|
|
46
|
+
rainbow (3.1.1)
|
|
47
|
+
rake (12.3.3)
|
|
48
|
+
regexp_parser (2.11.3)
|
|
49
|
+
rspec (3.13.2)
|
|
50
|
+
rspec-core (~> 3.13.0)
|
|
51
|
+
rspec-expectations (~> 3.13.0)
|
|
52
|
+
rspec-mocks (~> 3.13.0)
|
|
53
|
+
rspec-core (3.13.6)
|
|
54
|
+
rspec-support (~> 3.13.0)
|
|
55
|
+
rspec-expectations (3.13.5)
|
|
38
56
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
39
|
-
rspec-support (~> 3.
|
|
40
|
-
rspec-mocks (3.
|
|
57
|
+
rspec-support (~> 3.13.0)
|
|
58
|
+
rspec-mocks (3.13.8)
|
|
41
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
42
|
-
rspec-support (~> 3.
|
|
43
|
-
rspec-support (3.
|
|
44
|
-
rspec_junit_formatter (0.
|
|
60
|
+
rspec-support (~> 3.13.0)
|
|
61
|
+
rspec-support (3.13.7)
|
|
62
|
+
rspec_junit_formatter (0.6.0)
|
|
45
63
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
46
|
-
rubocop (
|
|
64
|
+
rubocop (1.85.1)
|
|
65
|
+
json (~> 2.3)
|
|
66
|
+
language_server-protocol (~> 3.17.0.2)
|
|
67
|
+
lint_roller (~> 1.1.0)
|
|
68
|
+
mcp (~> 0.6)
|
|
47
69
|
parallel (~> 1.10)
|
|
48
|
-
parser (>=
|
|
70
|
+
parser (>= 3.3.0.2)
|
|
49
71
|
rainbow (>= 2.2.2, < 4.0)
|
|
50
|
-
regexp_parser (>=
|
|
51
|
-
|
|
52
|
-
rubocop-ast (>= 0.6.0)
|
|
72
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
73
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
53
74
|
ruby-progressbar (~> 1.7)
|
|
54
|
-
unicode-display_width (>=
|
|
55
|
-
rubocop-ast (
|
|
56
|
-
parser (>=
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
rubocop (>=
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
rubocop (
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
76
|
+
rubocop-ast (1.49.1)
|
|
77
|
+
parser (>= 3.3.7.2)
|
|
78
|
+
prism (~> 1.7)
|
|
79
|
+
rubocop-md (2.0.4)
|
|
80
|
+
lint_roller (~> 1.1)
|
|
81
|
+
rubocop (>= 1.72.1)
|
|
82
|
+
rubocop-performance (1.26.1)
|
|
83
|
+
lint_roller (~> 1.1)
|
|
84
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
85
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
86
|
+
rubocop-rspec (3.9.0)
|
|
87
|
+
lint_roller (~> 1.1)
|
|
88
|
+
rubocop (~> 1.81)
|
|
89
|
+
ruby-progressbar (1.13.0)
|
|
90
|
+
simplecov (0.21.2)
|
|
66
91
|
docile (~> 1.1)
|
|
67
92
|
simplecov-html (~> 0.11)
|
|
68
|
-
|
|
69
|
-
|
|
93
|
+
simplecov_json_formatter (~> 0.1)
|
|
94
|
+
simplecov-html (0.13.2)
|
|
95
|
+
simplecov_json_formatter (0.1.4)
|
|
96
|
+
unicode-display_width (3.2.0)
|
|
97
|
+
unicode-emoji (~> 4.1)
|
|
98
|
+
unicode-emoji (4.2.0)
|
|
70
99
|
|
|
71
100
|
PLATFORMS
|
|
101
|
+
arm64-darwin-25
|
|
72
102
|
ruby
|
|
73
103
|
|
|
74
104
|
DEPENDENCIES
|
|
75
105
|
bundler
|
|
76
106
|
codecov
|
|
77
107
|
lex-pushover!
|
|
78
|
-
rake
|
|
79
|
-
rspec
|
|
108
|
+
rake (~> 12.0)
|
|
109
|
+
rspec (~> 3.0)
|
|
80
110
|
rspec_junit_formatter
|
|
81
111
|
rubocop
|
|
82
112
|
rubocop-md
|
|
@@ -84,4 +114,4 @@ DEPENDENCIES
|
|
|
84
114
|
rubocop-rspec
|
|
85
115
|
|
|
86
116
|
BUNDLED WITH
|
|
87
|
-
2.
|
|
117
|
+
2.6.9
|
data/README.md
CHANGED
|
@@ -1,69 +1,64 @@
|
|
|
1
|
-
#
|
|
1
|
+
# lex-pushover
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Pushover push notification integration for [LegionIO](https://github.com/LegionIO/LegionIO). Send notifications to Pushover-connected devices with configurable priority levels.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
gem install lex-pushover
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or add to your Gemfile:
|
|
8
12
|
|
|
9
13
|
```ruby
|
|
10
14
|
gem 'lex-pushover'
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
## Runners
|
|
18
|
+
|
|
19
|
+
| Method | Priority | Description |
|
|
20
|
+
|--------|----------|-------------|
|
|
21
|
+
| `push` | default | Send a notification |
|
|
22
|
+
| `emergency` | 2 | Emergency priority (requires acknowledgment) |
|
|
23
|
+
| `high` | 1 | High priority |
|
|
24
|
+
| `normal` | 0 | Normal priority |
|
|
25
|
+
| `low` | -1 | Low priority |
|
|
26
|
+
| `lowest` | -2 | Lowest priority |
|
|
27
|
+
|
|
28
|
+
All methods accept: `message` (required), `title`, `token`, `user`, `device`, `url`, `url_title`, `sound`, `expire`, `retry`, `callback`.
|
|
29
|
+
|
|
30
|
+
## Example Payloads
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{"message": "Hello World!"}
|
|
34
|
+
```
|
|
14
35
|
|
|
15
|
-
|
|
36
|
+
```json
|
|
37
|
+
{"title": "Alert", "message": "Disk space low", "priority": 1}
|
|
38
|
+
```
|
|
16
39
|
|
|
17
|
-
|
|
40
|
+
## Configuration
|
|
18
41
|
|
|
19
|
-
|
|
42
|
+
Token and user can be set globally in Legion settings or passed per-message:
|
|
20
43
|
|
|
21
|
-
## Adding to Legion
|
|
22
|
-
You can manually install with a `gem install lex-pushover` command or by adding it into your settings with something like this
|
|
23
44
|
```json
|
|
24
45
|
{
|
|
25
46
|
"extensions": {
|
|
26
47
|
"pushover": {
|
|
27
48
|
"enabled": true,
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"user": "user" # optional and can be passed in via the payload
|
|
49
|
+
"token": "your_app_token",
|
|
50
|
+
"user": "your_user_key"
|
|
31
51
|
}
|
|
32
52
|
}
|
|
33
53
|
}
|
|
34
54
|
```
|
|
35
55
|
|
|
36
|
-
##
|
|
37
|
-
There is only a single runner in this LEX. It can make the following calls
|
|
38
|
-
##### Functions
|
|
39
|
-
|function|message|title|token|user|
|
|
40
|
-
|---|---|---|---|---|
|
|
41
|
-
|push |Required|Optional|Optional|Optional
|
|
42
|
-
|emergency|Required|Optional|Optional|Optional
|
|
43
|
-
|high |Required|Optional|Optional|Optional
|
|
44
|
-
|normal |Required|Optional|Optional|Optional
|
|
45
|
-
|low |Required|Optional|Optional|Optional
|
|
46
|
-
|lowest |Required|Optional|Optional|Optional
|
|
47
|
-
|
|
48
|
-
Other optional parameteres
|
|
49
|
-
```ruby
|
|
50
|
-
message priority device title url url_title sound expire retry callback
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
#### Example Payloads
|
|
54
|
-
```json
|
|
55
|
-
{"message": "Hello World!"}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
```json
|
|
59
|
-
{"title": "Hello World!", "message": "I am a notification"}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
```json
|
|
63
|
-
{"message": "With Creds","token": "easy as abc 123"}
|
|
64
|
-
```
|
|
56
|
+
## Requirements
|
|
65
57
|
|
|
58
|
+
- Ruby >= 3.4
|
|
59
|
+
- [LegionIO](https://github.com/LegionIO/LegionIO) framework
|
|
60
|
+
- Pushover account
|
|
66
61
|
|
|
67
62
|
## License
|
|
68
63
|
|
|
69
|
-
|
|
64
|
+
MIT
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/lex-pushover.gemspec
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require_relative 'lib/legion/extensions/pushover/version'
|
|
2
4
|
|
|
3
5
|
Gem::Specification.new do |spec|
|
|
@@ -8,13 +10,14 @@ Gem::Specification.new do |spec|
|
|
|
8
10
|
|
|
9
11
|
spec.summary = 'LEX::Pushover'
|
|
10
12
|
spec.description = 'Used to connect Legion to Pushover'
|
|
11
|
-
spec.homepage = 'https://
|
|
13
|
+
spec.homepage = 'https://github.com/LegionIO/lex-pushover'
|
|
12
14
|
spec.license = 'MIT'
|
|
13
|
-
spec.required_ruby_version =
|
|
15
|
+
spec.required_ruby_version = '>= 3.4'
|
|
14
16
|
|
|
15
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
16
|
-
spec.metadata['source_code_uri'] = 'https://
|
|
17
|
-
spec.metadata['changelog_uri'] = 'https://
|
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-pushover'
|
|
19
|
+
spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-pushover/blob/main/CHANGELOG.md'
|
|
20
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
18
21
|
|
|
19
22
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
20
23
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
@@ -22,15 +25,5 @@ Gem::Specification.new do |spec|
|
|
|
22
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
23
26
|
spec.require_paths = ['lib']
|
|
24
27
|
|
|
25
|
-
spec.add_development_dependency 'bundler'
|
|
26
|
-
spec.add_development_dependency 'codecov'
|
|
27
|
-
spec.add_development_dependency 'rake'
|
|
28
|
-
spec.add_development_dependency 'rspec'
|
|
29
|
-
spec.add_development_dependency 'rspec_junit_formatter'
|
|
30
|
-
spec.add_development_dependency 'rubocop'
|
|
31
|
-
spec.add_development_dependency 'rubocop-md'
|
|
32
|
-
spec.add_development_dependency 'rubocop-performance'
|
|
33
|
-
spec.add_development_dependency 'rubocop-rspec'
|
|
34
|
-
|
|
35
28
|
spec.add_dependency 'pushover', '>= 3.0.0'
|
|
36
29
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'helpers/client'
|
|
4
|
+
require_relative 'runners/message'
|
|
5
|
+
|
|
6
|
+
module Legion
|
|
7
|
+
module Extensions
|
|
8
|
+
module Pushover
|
|
9
|
+
class Client
|
|
10
|
+
include Helpers::Client
|
|
11
|
+
include Runners::Message
|
|
12
|
+
|
|
13
|
+
attr_reader :opts
|
|
14
|
+
|
|
15
|
+
def initialize(user_key: nil, api_token: nil, **extra)
|
|
16
|
+
@opts = { user: user_key, token: api_token, **extra }.compact
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def find_setting(key, opts = {})
|
|
20
|
+
opts[key.to_sym] || @opts[key.to_sym]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -1,30 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'pushover'
|
|
2
4
|
|
|
3
|
-
module Legion
|
|
4
|
-
module
|
|
5
|
-
module
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Pushover
|
|
8
|
+
module Helpers
|
|
9
|
+
module Client
|
|
10
|
+
def message(**opts)
|
|
11
|
+
client_hash = {}
|
|
12
|
+
%i[message priority device title url url_title sound expire retry callback].each do |thing|
|
|
13
|
+
client_hash[thing] = opts[thing] if opts.key?(thing) && !opts[thing].nil?
|
|
14
|
+
end
|
|
15
|
+
::Pushover::Message.new(token: token(opts),
|
|
16
|
+
user: user(opts),
|
|
17
|
+
timestamp: Time.now.getlocal,
|
|
18
|
+
**client_hash)
|
|
19
|
+
end
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
def timestamp(**opts)
|
|
22
|
+
opts[:timstamp] if opts.key? :timestamp
|
|
23
|
+
Time.now.getutc
|
|
24
|
+
end
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
def token(**opts)
|
|
27
|
+
find_setting('token', opts)
|
|
28
|
+
end
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
def user(**opts)
|
|
31
|
+
find_setting('user', opts)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
28
34
|
end
|
|
29
35
|
end
|
|
30
36
|
end
|
|
@@ -1,53 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# require 'pushover'
|
|
2
4
|
|
|
3
|
-
module Legion
|
|
4
|
-
module
|
|
5
|
-
module
|
|
6
|
-
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Pushover
|
|
8
|
+
module Runners
|
|
9
|
+
module Message
|
|
10
|
+
include Legion::Extensions::Pushover::Helpers::Client
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
def push(message:, title: nil, **)
|
|
13
|
+
result = message(message: message, title: title, **).push
|
|
14
|
+
raise IOError, result.errors unless result.errors.nil?
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
{}
|
|
17
|
+
end
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
def emergency(message:, title: nil, **)
|
|
20
|
+
result = message(message: message, title: title, priority: 2, **).push
|
|
21
|
+
raise IOError, result.errors unless result.errors.nil?
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
{}
|
|
24
|
+
end
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
def high(message:, title: nil, **)
|
|
27
|
+
result = message(message: message, title: title, priority: 1, **).push
|
|
28
|
+
raise IOError, result.errors unless result.errors.nil?
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
{}
|
|
31
|
+
end
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
def normal(message:, title: nil, **)
|
|
34
|
+
result = message(message: message, title: title, **).push
|
|
35
|
+
raise IOError, result.errors unless result.errors.nil?
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
{}
|
|
38
|
+
end
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
def low(message:, title: nil, **)
|
|
41
|
+
result = message(message: message, title: title, priority: -1, **).push
|
|
42
|
+
raise IOError, result.errors unless result.errors.nil?
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
{}
|
|
45
|
+
end
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
def lowest(message:, title: nil, **)
|
|
48
|
+
result = message(message: message, title: title, priority: -2, **).push
|
|
49
|
+
raise IOError, result.errors unless result.errors.nil?
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
{}
|
|
52
|
+
end
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
include Legion::Extensions::Helpers::Lex
|
|
55
|
+
end
|
|
56
|
+
end
|
|
51
57
|
end
|
|
52
58
|
end
|
|
53
59
|
end
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'legion/extensions/pushover/version'
|
|
2
|
-
require 'legion/extensions'
|
|
4
|
+
require 'legion/extensions/pushover/client'
|
|
3
5
|
|
|
4
6
|
module Legion
|
|
5
7
|
module Extensions
|
|
6
8
|
module Pushover
|
|
7
|
-
extend Legion::Extensions::Core
|
|
9
|
+
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
|
|
8
10
|
end
|
|
9
11
|
end
|
|
10
12
|
end
|
metadata
CHANGED
|
@@ -1,141 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-pushover
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: bundler
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - ">="
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
20
|
-
type: :development
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: codecov
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rake
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: rspec
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - ">="
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rspec_junit_formatter
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - ">="
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: rubocop
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - ">="
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
90
|
-
type: :development
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - ">="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
97
|
-
- !ruby/object:Gem::Dependency
|
|
98
|
-
name: rubocop-md
|
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
|
100
|
-
requirements:
|
|
101
|
-
- - ">="
|
|
102
|
-
- !ruby/object:Gem::Version
|
|
103
|
-
version: '0'
|
|
104
|
-
type: :development
|
|
105
|
-
prerelease: false
|
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
-
requirements:
|
|
108
|
-
- - ">="
|
|
109
|
-
- !ruby/object:Gem::Version
|
|
110
|
-
version: '0'
|
|
111
|
-
- !ruby/object:Gem::Dependency
|
|
112
|
-
name: rubocop-performance
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - ">="
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '0'
|
|
118
|
-
type: :development
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - ">="
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '0'
|
|
125
|
-
- !ruby/object:Gem::Dependency
|
|
126
|
-
name: rubocop-rspec
|
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
|
128
|
-
requirements:
|
|
129
|
-
- - ">="
|
|
130
|
-
- !ruby/object:Gem::Version
|
|
131
|
-
version: '0'
|
|
132
|
-
type: :development
|
|
133
|
-
prerelease: false
|
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
-
requirements:
|
|
136
|
-
- - ">="
|
|
137
|
-
- !ruby/object:Gem::Version
|
|
138
|
-
version: '0'
|
|
139
12
|
- !ruby/object:Gem::Dependency
|
|
140
13
|
name: pushover
|
|
141
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -157,9 +30,12 @@ executables: []
|
|
|
157
30
|
extensions: []
|
|
158
31
|
extra_rdoc_files: []
|
|
159
32
|
files:
|
|
33
|
+
- ".github/workflows/ci.yml"
|
|
160
34
|
- ".gitignore"
|
|
161
35
|
- ".rspec"
|
|
162
36
|
- ".rubocop.yml"
|
|
37
|
+
- CHANGELOG.md
|
|
38
|
+
- CLAUDE.md
|
|
163
39
|
- Gemfile
|
|
164
40
|
- Gemfile.lock
|
|
165
41
|
- LICENSE.txt
|
|
@@ -169,17 +45,18 @@ files:
|
|
|
169
45
|
- bin/setup
|
|
170
46
|
- lex-pushover.gemspec
|
|
171
47
|
- lib/legion/extensions/pushover.rb
|
|
48
|
+
- lib/legion/extensions/pushover/client.rb
|
|
172
49
|
- lib/legion/extensions/pushover/helpers/client.rb
|
|
173
50
|
- lib/legion/extensions/pushover/runners/message.rb
|
|
174
51
|
- lib/legion/extensions/pushover/version.rb
|
|
175
|
-
homepage: https://
|
|
52
|
+
homepage: https://github.com/LegionIO/lex-pushover
|
|
176
53
|
licenses:
|
|
177
54
|
- MIT
|
|
178
55
|
metadata:
|
|
179
|
-
homepage_uri: https://
|
|
180
|
-
source_code_uri: https://
|
|
181
|
-
changelog_uri: https://
|
|
182
|
-
|
|
56
|
+
homepage_uri: https://github.com/LegionIO/lex-pushover
|
|
57
|
+
source_code_uri: https://github.com/LegionIO/lex-pushover
|
|
58
|
+
changelog_uri: https://github.com/LegionIO/lex-pushover/blob/main/CHANGELOG.md
|
|
59
|
+
rubygems_mfa_required: 'true'
|
|
183
60
|
rdoc_options: []
|
|
184
61
|
require_paths:
|
|
185
62
|
- lib
|
|
@@ -187,15 +64,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
187
64
|
requirements:
|
|
188
65
|
- - ">="
|
|
189
66
|
- !ruby/object:Gem::Version
|
|
190
|
-
version:
|
|
67
|
+
version: '3.4'
|
|
191
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
69
|
requirements:
|
|
193
70
|
- - ">="
|
|
194
71
|
- !ruby/object:Gem::Version
|
|
195
72
|
version: '0'
|
|
196
73
|
requirements: []
|
|
197
|
-
rubygems_version: 3.
|
|
198
|
-
signing_key:
|
|
74
|
+
rubygems_version: 3.6.9
|
|
199
75
|
specification_version: 4
|
|
200
76
|
summary: LEX::Pushover
|
|
201
77
|
test_files: []
|