lex-pushover 0.1.3 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7aa80f989a93ae961c1cb4cc02185cc05dce494cd76c7168102e1f8c0640a8d1
4
- data.tar.gz: f29dd1984c731a97492dd2ecb7ea19e969af739235094c2fda94cd99d761969a
3
+ metadata.gz: af420cb8e126ecb07bebe22af41f0386988a8863fee88dece05ff0e7d088ffb5
4
+ data.tar.gz: '0803870a32d4343140dad18a773945aa4e7c10599bb59abd227df99a1d5b2172'
5
5
  SHA512:
6
- metadata.gz: bf713181fb28905a727709a52ed6f63ab872a8c7184f1f57ba531a5e56af013ca3df365c13aa039d5d9442f7b6837def6fe4cf8589dbfc9f8691a7b280fd7d5b
7
- data.tar.gz: c0079b9e938cf59b604af38a4be46e79e5902c327768ee33a496ad0c481375a00c410d537e697b5aee7cea2b07e35b1d566082dd04d6c8e3b5980de5c84369ab
6
+ metadata.gz: 54dc8f812292aa52bdf4967c90113f7e6f94664d113c9397f19a1fa95b7950e7ed2dc544b6a35346a4c7430f16ee173696497d24d87d6f8b3bb1aa52edd082b4
7
+ data.tar.gz: 1113c9d0f5f9afbe6e8fcca1223e1a22732040b29cb5f3dc6980231acebff9b9ea98605f224e342e476a3637426f1ffd1647f46a990ae3bc5dc3016eba199b21
@@ -0,0 +1,7 @@
1
+ # Auto-generated from team-config.yml
2
+ # Team: extensions
3
+ #
4
+ # To apply: scripts/apply-codeowners.sh lex-pushover
5
+
6
+ * @LegionIO/maintainers
7
+ * @LegionIO/extensions
@@ -0,0 +1,18 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ day: monday
8
+ open-pull-requests-limit: 5
9
+ labels:
10
+ - "type:dependencies"
11
+ - package-ecosystem: github-actions
12
+ directory: /
13
+ schedule:
14
+ interval: weekly
15
+ day: monday
16
+ open-pull-requests-limit: 5
17
+ labels:
18
+ - "type:dependencies"
@@ -0,0 +1,34 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ schedule:
7
+ - cron: '0 9 * * 1'
8
+
9
+ jobs:
10
+ ci:
11
+ uses: LegionIO/.github/.github/workflows/ci.yml@main
12
+
13
+ lint:
14
+ uses: LegionIO/.github/.github/workflows/lint-patterns.yml@main
15
+
16
+ security:
17
+ uses: LegionIO/.github/.github/workflows/security-scan.yml@main
18
+
19
+ version-changelog:
20
+ uses: LegionIO/.github/.github/workflows/version-changelog.yml@main
21
+
22
+ dependency-review:
23
+ uses: LegionIO/.github/.github/workflows/dependency-review.yml@main
24
+
25
+ stale:
26
+ if: github.event_name == 'schedule'
27
+ uses: LegionIO/.github/.github/workflows/stale.yml@main
28
+
29
+ release:
30
+ needs: [ci, lint]
31
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
32
+ uses: LegionIO/.github/.github/workflows/release.yml@main
33
+ secrets:
34
+ rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ Gemfile.lock
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
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: 120
3
- Metrics/MethodLength:
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
- Style/SymbolArray:
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
- AllCops:
19
- TargetRubyVersion: 2.5
20
- NewCops: enable
39
+
40
+ Style/SymbolArray:
41
+ Enabled: true
42
+
21
43
  Style/FrozenStringLiteralComment:
22
- Enabled: false
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,20 @@
1
+ # Changelog
2
+
3
+ ## [0.2.1] - 2026-03-22
4
+
5
+ ### Changed
6
+ - Add legion-cache, legion-crypt, legion-data, legion-json, legion-logging, legion-settings, legion-transport as runtime dependencies
7
+ - Update spec_helper with real sub-gem helper stubs
8
+
9
+ ## [0.2.0] - 2026-03-15
10
+
11
+ ### Added
12
+ - Standalone `Client` class (`Legion::Extensions::Pushover::Client`) that includes all Runner modules
13
+ - `Client#initialize` accepts `user_key:` and `api_token:` keyword arguments stored in `@opts`
14
+ - `Client#find_setting` resolves credentials from per-call opts or stored `@opts`
15
+ - Specs for `Client` class covering initialization, `find_setting`, and runner method presence
16
+
17
+ ## [0.1.3] - 2026-03-13
18
+
19
+ ### Added
20
+ - Initial release
data/CLAUDE.md ADDED
@@ -0,0 +1,94 @@
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.1
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
+ 15 specs total.
85
+
86
+ ```bash
87
+ bundle install
88
+ bundle exec rspec
89
+ bundle exec rubocop
90
+ ```
91
+
92
+ ---
93
+
94
+ **Maintained By**: Matthew Iverson (@Esity)
data/Gemfile CHANGED
@@ -1,4 +1,14 @@
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 'rake', '~> 12.0'
9
+ gem 'rspec', '~> 3.0'
10
+ gem 'rspec_junit_formatter'
11
+ gem 'rubocop'
12
+ gem 'rubocop-md'
13
+ gem 'rubocop-performance'
14
+ gem 'rubocop-rspec'
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2021 Esity
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md CHANGED
@@ -1,69 +1,76 @@
1
- # Legion::Extensions::Pushover
1
+ # lex-pushover
2
2
 
3
- A Legion Extension designed to connect Legion to Pushover
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
- Add this line to your application's Gemfile:
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
- And then execute:
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 |
14
27
 
15
- $ bundle install
28
+ All methods accept: `message` (required), `title`, `token`, `user`, `device`, `url`, `url_title`, `sound`, `expire`, `retry`, `callback`.
16
29
 
17
- Or install it yourself as:
30
+ ## Example Payloads
18
31
 
19
- $ gem install lex-pushover
32
+ ```json
33
+ {"message": "Hello World!"}
34
+ ```
35
+
36
+ ```json
37
+ {"title": "Alert", "message": "Disk space low", "priority": 1}
38
+ ```
39
+
40
+ ## Configuration
41
+
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
- "workers": 1,
29
- "token": "___token___", # optional and can be passed in via the payload
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
- ## Usage
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
56
+ ## Standalone Client
57
+
49
58
  ```ruby
50
- message priority device title url url_title sound expire retry callback
51
- ```
59
+ require 'legion/extensions/pushover'
52
60
 
53
- #### Example Payloads
54
- ```json
55
- {"message": "Hello World!"}
61
+ client = Legion::Extensions::Pushover::Client.new(user_key: 'uXXX', api_token: 'aXXX')
62
+ client.push(message: 'Deploy complete')
63
+ client.high(message: 'Disk usage above 90%', title: 'Alert')
56
64
  ```
57
65
 
58
- ```json
59
- {"title": "Hello World!", "message": "I am a notification"}
60
- ```
66
+ Credentials passed to `Client.new` are merged with per-call kwargs; per-call values take precedence.
61
67
 
62
- ```json
63
- {"message": "With Creds","token": "easy as abc 123"}
64
- ```
68
+ ## Requirements
65
69
 
70
+ - Ruby >= 3.4
71
+ - Pushover account (user key + API token)
72
+ - [LegionIO](https://github.com/LegionIO/LegionIO) framework (optional for standalone client)
66
73
 
67
74
  ## License
68
75
 
69
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
76
+ MIT
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'legion/extensions/pushover'
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://bitbucket.org/legion-io/lex-pushover'
13
+ spec.homepage = 'https://github.com/LegionIO/lex-pushover'
12
14
  spec.license = 'MIT'
13
- spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
15
+ spec.required_ruby_version = '>= 3.4'
14
16
 
15
17
  spec.metadata['homepage_uri'] = spec.homepage
16
- spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/lex-pushover'
17
- spec.metadata['changelog_uri'] = 'https://bitbucket.org/legion-io/lex-pushover/src/master/CHANGELOG.md'
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,12 @@ 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
-
28
+ spec.add_dependency 'legion-cache', '>= 1.3.11'
29
+ spec.add_dependency 'legion-crypt', '>= 1.4.9'
30
+ spec.add_dependency 'legion-data', '>= 1.4.17'
31
+ spec.add_dependency 'legion-json', '>= 1.2.1'
32
+ spec.add_dependency 'legion-logging', '>= 1.3.2'
33
+ spec.add_dependency 'legion-settings', '>= 1.3.14'
34
+ spec.add_dependency 'legion-transport', '>= 1.3.9'
35
35
  spec.add_dependency 'pushover', '>= 3.0.0'
36
36
  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::Extensions::Pushover
4
- module Helpers
5
- module Client
6
- def message(**opts)
7
- client_hash = {}
8
- %i[message priority device title url url_title sound expire retry callback].each do |thing|
9
- client_hash[thing] = opts[thing] if opts.key?(thing) && !opts[thing].nil?
10
- end
11
- ::Pushover::Message.new(token: token(opts),
12
- user: user(opts),
13
- timestamp: Time.now.getlocal,
14
- **client_hash)
15
- end
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
- def timestamp(**opts)
18
- opts[:timstamp] if opts.key? :timestamp
19
- Time.now.getutc
20
- end
21
+ def timestamp(**opts)
22
+ opts[:timstamp] if opts.key? :timestamp
23
+ Time.now.getutc
24
+ end
21
25
 
22
- def token(**opts)
23
- find_setting('token', opts)
24
- end
26
+ def token(**opts)
27
+ find_setting('token', opts)
28
+ end
25
29
 
26
- def user(**opts)
27
- find_setting('user', opts)
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::Extensions::Pushover
4
- module Runners
5
- module Message
6
- include Legion::Extensions::Pushover::Helpers::Client
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
- def push(message:, title: nil, **opts)
9
- result = message(message: message, title: title, **opts).push
10
- raise IOError, result.errors unless result.errors.nil?
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
- end
16
+ {}
17
+ end
14
18
 
15
- def emergency(message:, title: nil, **opts)
16
- result = message(message: message, title: title, priority: 2, **opts).push
17
- raise IOError, result.errors unless result.errors.nil?
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
- end
23
+ {}
24
+ end
21
25
 
22
- def high(message:, title: nil, **opts)
23
- result = message(message: message, title: title, priority: 1, **opts).push
24
- raise IOError, result.errors unless result.errors.nil?
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
- end
30
+ {}
31
+ end
28
32
 
29
- def normal(message:, title: nil, **opts)
30
- result = message(message: message, title: title, **opts).push
31
- raise IOError, result.errors unless result.errors.nil?
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
- end
37
+ {}
38
+ end
35
39
 
36
- def low(message:, title: nil, **opts)
37
- result = message(message: message, title: title, priority: -1, **opts).push
38
- raise IOError, result.errors unless result.errors.nil?
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
- end
44
+ {}
45
+ end
42
46
 
43
- def lowest(message:, title: nil, **opts)
44
- result = message(message: message, title: title, priority: -2, **opts).push
45
- raise IOError, result.errors unless result.errors.nil?
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
- end
51
+ {}
52
+ end
49
53
 
50
- include Legion::Extensions::Helpers::Lex
54
+ include Legion::Extensions::Helpers::Lex
55
+ end
56
+ end
51
57
  end
52
58
  end
53
59
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Legion
2
4
  module Extensions
3
5
  module Pushover
4
- VERSION = '0.1.3'.freeze
6
+ VERSION = '0.2.1'
5
7
  end
6
8
  end
7
9
  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,112 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-pushover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2020-10-14 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: bundler
13
+ name: legion-cache
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
18
17
  - !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
18
+ version: 1.3.11
19
+ type: :runtime
49
20
  prerelease: false
50
21
  version_requirements: !ruby/object:Gem::Requirement
51
22
  requirements:
52
23
  - - ">="
53
24
  - !ruby/object:Gem::Version
54
- version: '0'
25
+ version: 1.3.11
55
26
  - !ruby/object:Gem::Dependency
56
- name: rspec
27
+ name: legion-crypt
57
28
  requirement: !ruby/object:Gem::Requirement
58
29
  requirements:
59
30
  - - ">="
60
31
  - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
32
+ version: 1.4.9
33
+ type: :runtime
63
34
  prerelease: false
64
35
  version_requirements: !ruby/object:Gem::Requirement
65
36
  requirements:
66
37
  - - ">="
67
38
  - !ruby/object:Gem::Version
68
- version: '0'
39
+ version: 1.4.9
69
40
  - !ruby/object:Gem::Dependency
70
- name: rspec_junit_formatter
41
+ name: legion-data
71
42
  requirement: !ruby/object:Gem::Requirement
72
43
  requirements:
73
44
  - - ">="
74
45
  - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
46
+ version: 1.4.17
47
+ type: :runtime
77
48
  prerelease: false
78
49
  version_requirements: !ruby/object:Gem::Requirement
79
50
  requirements:
80
51
  - - ">="
81
52
  - !ruby/object:Gem::Version
82
- version: '0'
53
+ version: 1.4.17
83
54
  - !ruby/object:Gem::Dependency
84
- name: rubocop
55
+ name: legion-json
85
56
  requirement: !ruby/object:Gem::Requirement
86
57
  requirements:
87
58
  - - ">="
88
59
  - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
60
+ version: 1.2.1
61
+ type: :runtime
91
62
  prerelease: false
92
63
  version_requirements: !ruby/object:Gem::Requirement
93
64
  requirements:
94
65
  - - ">="
95
66
  - !ruby/object:Gem::Version
96
- version: '0'
67
+ version: 1.2.1
97
68
  - !ruby/object:Gem::Dependency
98
- name: rubocop-md
69
+ name: legion-logging
99
70
  requirement: !ruby/object:Gem::Requirement
100
71
  requirements:
101
72
  - - ">="
102
73
  - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
74
+ version: 1.3.2
75
+ type: :runtime
105
76
  prerelease: false
106
77
  version_requirements: !ruby/object:Gem::Requirement
107
78
  requirements:
108
79
  - - ">="
109
80
  - !ruby/object:Gem::Version
110
- version: '0'
81
+ version: 1.3.2
111
82
  - !ruby/object:Gem::Dependency
112
- name: rubocop-performance
83
+ name: legion-settings
113
84
  requirement: !ruby/object:Gem::Requirement
114
85
  requirements:
115
86
  - - ">="
116
87
  - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
88
+ version: 1.3.14
89
+ type: :runtime
119
90
  prerelease: false
120
91
  version_requirements: !ruby/object:Gem::Requirement
121
92
  requirements:
122
93
  - - ">="
123
94
  - !ruby/object:Gem::Version
124
- version: '0'
95
+ version: 1.3.14
125
96
  - !ruby/object:Gem::Dependency
126
- name: rubocop-rspec
97
+ name: legion-transport
127
98
  requirement: !ruby/object:Gem::Requirement
128
99
  requirements:
129
100
  - - ">="
130
101
  - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
102
+ version: 1.3.9
103
+ type: :runtime
133
104
  prerelease: false
134
105
  version_requirements: !ruby/object:Gem::Requirement
135
106
  requirements:
136
107
  - - ">="
137
108
  - !ruby/object:Gem::Version
138
- version: '0'
109
+ version: 1.3.9
139
110
  - !ruby/object:Gem::Dependency
140
111
  name: pushover
141
112
  requirement: !ruby/object:Gem::Requirement
@@ -157,11 +128,16 @@ executables: []
157
128
  extensions: []
158
129
  extra_rdoc_files: []
159
130
  files:
131
+ - ".github/CODEOWNERS"
132
+ - ".github/dependabot.yml"
133
+ - ".github/workflows/ci.yml"
160
134
  - ".gitignore"
161
135
  - ".rspec"
162
136
  - ".rubocop.yml"
137
+ - CHANGELOG.md
138
+ - CLAUDE.md
163
139
  - Gemfile
164
- - Gemfile.lock
140
+ - LICENSE
165
141
  - LICENSE.txt
166
142
  - README.md
167
143
  - Rakefile
@@ -169,17 +145,18 @@ files:
169
145
  - bin/setup
170
146
  - lex-pushover.gemspec
171
147
  - lib/legion/extensions/pushover.rb
148
+ - lib/legion/extensions/pushover/client.rb
172
149
  - lib/legion/extensions/pushover/helpers/client.rb
173
150
  - lib/legion/extensions/pushover/runners/message.rb
174
151
  - lib/legion/extensions/pushover/version.rb
175
- homepage: https://bitbucket.org/legion-io/lex-pushover
152
+ homepage: https://github.com/LegionIO/lex-pushover
176
153
  licenses:
177
154
  - MIT
178
155
  metadata:
179
- homepage_uri: https://bitbucket.org/legion-io/lex-pushover
180
- source_code_uri: https://bitbucket.org/legion-io/lex-pushover
181
- changelog_uri: https://bitbucket.org/legion-io/lex-pushover/src/master/CHANGELOG.md
182
- post_install_message:
156
+ homepage_uri: https://github.com/LegionIO/lex-pushover
157
+ source_code_uri: https://github.com/LegionIO/lex-pushover
158
+ changelog_uri: https://github.com/LegionIO/lex-pushover/blob/main/CHANGELOG.md
159
+ rubygems_mfa_required: 'true'
183
160
  rdoc_options: []
184
161
  require_paths:
185
162
  - lib
@@ -187,15 +164,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
164
  requirements:
188
165
  - - ">="
189
166
  - !ruby/object:Gem::Version
190
- version: 2.5.0
167
+ version: '3.4'
191
168
  required_rubygems_version: !ruby/object:Gem::Requirement
192
169
  requirements:
193
170
  - - ">="
194
171
  - !ruby/object:Gem::Version
195
172
  version: '0'
196
173
  requirements: []
197
- rubygems_version: 3.1.2
198
- signing_key:
174
+ rubygems_version: 3.6.9
199
175
  specification_version: 4
200
176
  summary: LEX::Pushover
201
177
  test_files: []
data/Gemfile.lock DELETED
@@ -1,87 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- lex-pushover (0.1.3)
5
- pushover (>= 3.0.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- ast (2.4.1)
11
- codecov (0.2.12)
12
- json
13
- simplecov
14
- diff-lcs (1.4.4)
15
- docile (1.3.2)
16
- excon (0.76.0)
17
- gli (2.19.2)
18
- json (2.3.1)
19
- oj (3.10.14)
20
- parallel (1.19.2)
21
- parser (2.7.2.0)
22
- ast (~> 2.4.1)
23
- pushover (3.0.3)
24
- excon
25
- gli
26
- oj
27
- rainbow (3.0.0)
28
- rake (13.0.1)
29
- regexp_parser (1.8.2)
30
- rexml (3.2.4)
31
- rspec (3.9.0)
32
- rspec-core (~> 3.9.0)
33
- rspec-expectations (~> 3.9.0)
34
- rspec-mocks (~> 3.9.0)
35
- rspec-core (3.9.3)
36
- rspec-support (~> 3.9.3)
37
- rspec-expectations (3.9.2)
38
- diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.9.0)
40
- rspec-mocks (3.9.1)
41
- diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.9.0)
43
- rspec-support (3.9.3)
44
- rspec_junit_formatter (0.4.1)
45
- rspec-core (>= 2, < 4, != 2.12.0)
46
- rubocop (0.93.1)
47
- parallel (~> 1.10)
48
- parser (>= 2.7.1.5)
49
- rainbow (>= 2.2.2, < 4.0)
50
- regexp_parser (>= 1.8)
51
- rexml
52
- rubocop-ast (>= 0.6.0)
53
- ruby-progressbar (~> 1.7)
54
- unicode-display_width (>= 1.4.0, < 2.0)
55
- rubocop-ast (0.8.0)
56
- parser (>= 2.7.1.5)
57
- rubocop-md (0.4.0)
58
- rubocop (~> 0.60)
59
- rubocop-performance (1.8.1)
60
- rubocop (>= 0.87.0)
61
- rubocop-ast (>= 0.4.0)
62
- rubocop-rspec (1.43.2)
63
- rubocop (~> 0.87)
64
- ruby-progressbar (1.10.1)
65
- simplecov (0.19.0)
66
- docile (~> 1.1)
67
- simplecov-html (~> 0.11)
68
- simplecov-html (0.12.3)
69
- unicode-display_width (1.7.0)
70
-
71
- PLATFORMS
72
- ruby
73
-
74
- DEPENDENCIES
75
- bundler
76
- codecov
77
- lex-pushover!
78
- rake
79
- rspec
80
- rspec_junit_formatter
81
- rubocop
82
- rubocop-md
83
- rubocop-performance
84
- rubocop-rspec
85
-
86
- BUNDLED WITH
87
- 2.1.4