lex-pushbullet 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e033e3d45da88ee033cf614106c52c3bcd6c31ab0d08a864ffa7c565781f6e87
4
+ data.tar.gz: 17dac30acc81a0f31825ea9743dd63906641b9a8577ab5276361a2378a2f473d
5
+ SHA512:
6
+ metadata.gz: c98d23c7d09bc738aec8dc5fd8e70f132494dafd77285628dbf9e9b26056249c92c60e106cc2184a63f856fecd961f1e9ef972e5cb0abcedefaafce2e6405952
7
+ data.tar.gz: b919f6db50640e79e4fe9f75f2fd74c2c5c7b793b009e34de9cbfe7e52c3b61c82d2d8332b5fc0b01665885f494fd371966fc94622789887fe15b82a3d3f23c4
@@ -0,0 +1,7 @@
1
+ # Auto-generated from team-config.yml
2
+ # Team: extensions
3
+ #
4
+ # To apply: scripts/apply-codeowners.sh lex-pushbullet
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 ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,48 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.4
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+
6
+ Layout/LineLength:
7
+ Max: 160
8
+
9
+ Layout/SpaceAroundEqualsInParameterDefault:
10
+ EnforcedStyle: space
11
+
12
+ Layout/HashAlignment:
13
+ EnforcedHashRocketStyle: table
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
+
37
+ Style/Documentation:
38
+ Enabled: false
39
+
40
+ Style/SymbolArray:
41
+ Enabled: true
42
+
43
+ Style/FrozenStringLiteralComment:
44
+ Enabled: true
45
+ EnforcedStyle: always
46
+
47
+ Naming/FileName:
48
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
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
+ - `Helpers::Client` — Faraday connection to `https://api.pushbullet.com/v2` with `Access-Token` Bearer auth
13
+ - `Runners::Push` — `send_note`, `send_link`, `send_file`, `list_pushes`, `delete_push`, `dismiss_push`
14
+ - `Runners::Device` — `list_devices`, `get_device`, `create_device`, `update_device`, `delete_device`
15
+ - `Runners::Channel` — `list_subscriptions`, `subscribe`, `unsubscribe`, `channel_info`
16
+ - Standalone `Client` class including all three runners
17
+ - `faraday >= 2.0` runtime dependency
18
+ - 21 specs covering all runner methods
19
+
20
+ ## [0.1.0] - 2026-03-13
21
+
22
+ ### Added
23
+ - Initial release
data/CLAUDE.md ADDED
@@ -0,0 +1,81 @@
1
+ # lex-pushbullet: Pushbullet Integration 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 Pushbullet push notification service. Provides runners for sending push notifications, managing devices, and managing channel subscriptions via the Pushbullet REST API (Bearer token auth).
10
+
11
+ **GitHub**: https://github.com/LegionIO/lex-pushbullet
12
+ **License**: MIT
13
+ **Version**: 0.2.1
14
+
15
+ ## Architecture
16
+
17
+ ```
18
+ Legion::Extensions::Pushbullet
19
+ ├── Runners/
20
+ │ ├── Push # Send notes/links/files, list, dismiss, delete pushes
21
+ │ ├── Device # List, get, create, update, delete devices
22
+ │ └── Channel # List subscriptions, subscribe, unsubscribe, channel info
23
+ ├── Helpers/
24
+ │ └── Client # Faraday connection builder (Pushbullet API v2, Bearer token)
25
+ └── Client # Standalone client class (includes all runners)
26
+ ```
27
+
28
+ ## Key Files
29
+
30
+ | Path | Purpose |
31
+ |------|---------|
32
+ | `lib/legion/extensions/pushbullet.rb` | Entry point, extension registration |
33
+ | `lib/legion/extensions/pushbullet/client.rb` | Standalone client (initialize with token:) |
34
+ | `lib/legion/extensions/pushbullet/helpers/client.rb` | Faraday builder (Access-Token header auth) |
35
+ | `lib/legion/extensions/pushbullet/runners/push.rb` | Push runner: send_note, send_link, send_file, list_pushes, delete_push, dismiss_push |
36
+ | `lib/legion/extensions/pushbullet/runners/device.rb` | Device runner: list_devices, get_device, create_device, update_device, delete_device |
37
+ | `lib/legion/extensions/pushbullet/runners/channel.rb` | Channel runner: list_subscriptions, subscribe, unsubscribe, channel_info |
38
+ | `lib/legion/extensions/pushbullet/version.rb` | Version constant (0.2.1) |
39
+
40
+ ## API Coverage
41
+
42
+ | Runner | Methods |
43
+ |--------|---------|
44
+ | Push | `send_note`, `send_link`, `send_file`, `list_pushes`, `delete_push`, `dismiss_push` |
45
+ | Device | `list_devices`, `get_device`, `create_device`, `update_device`, `delete_device` |
46
+ | Channel | `list_subscriptions`, `subscribe`, `unsubscribe`, `channel_info` |
47
+
48
+ ## Standalone Usage
49
+
50
+ ```ruby
51
+ require 'legion/extensions/pushbullet/client'
52
+
53
+ client = Legion::Extensions::Pushbullet::Client.new(token: 'your_access_token')
54
+
55
+ client.send_note(title: 'Alert', body: 'Something happened!')
56
+ client.send_note(title: 'Alert', body: 'Device only', device_iden: 'abc123')
57
+ client.send_link(title: 'Check this', url: 'https://example.com')
58
+ client.list_devices
59
+ client.list_subscriptions
60
+ client.subscribe(channel_tag: 'some_channel')
61
+ ```
62
+
63
+ ## Dependencies
64
+
65
+ | Gem | Purpose |
66
+ |-----|---------|
67
+ | `faraday` (>= 2.0) | HTTP client for Pushbullet REST API v2 |
68
+
69
+ ## Development
70
+
71
+ 20 specs total.
72
+
73
+ ```bash
74
+ bundle install
75
+ bundle exec rspec
76
+ bundle exec rubocop
77
+ ```
78
+
79
+ ---
80
+
81
+ **Maintained By**: Matthew Iverson (@Esity)
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem 'bundler', '>= 2'
8
+ gem 'rake'
9
+ gem 'rspec'
10
+ gem 'rubocop'
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/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Esity
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,72 @@
1
+ # lex-pushbullet
2
+
3
+ Pushbullet push notification integration for [LegionIO](https://github.com/LegionIO/LegionIO). Send push notifications to Pushbullet-connected devices from within Legion task chains.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ gem install lex-pushbullet
9
+ ```
10
+
11
+ Or add to your Gemfile:
12
+
13
+ ```ruby
14
+ gem 'lex-pushbullet'
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```ruby
20
+ require 'legion/extensions/pushbullet'
21
+
22
+ client = Legion::Extensions::Pushbullet::Client.new(token: 'your-access-token')
23
+
24
+ # Send a note
25
+ client.send_note(title: 'Hello', body: 'World')
26
+
27
+ # Send a link
28
+ client.send_link(title: 'Check this out', url: 'https://example.com')
29
+
30
+ # Send a file push
31
+ client.send_file(file_name: 'photo.jpg', file_url: 'https://example.com/photo.jpg', file_type: 'image/jpeg')
32
+
33
+ # List recent pushes
34
+ client.list_pushes(limit: 10)
35
+
36
+ # Delete a push
37
+ client.delete_push(iden: 'push_iden_here')
38
+
39
+ # Dismiss a push
40
+ client.dismiss_push(iden: 'push_iden_here')
41
+
42
+ # Device management
43
+ client.list_devices
44
+ client.get_device(iden: 'device_iden')
45
+ client.create_device(nickname: 'My Desktop')
46
+ client.update_device(iden: 'device_iden', nickname: 'New Name')
47
+ client.delete_device(iden: 'device_iden')
48
+
49
+ # Channel subscriptions
50
+ client.list_subscriptions
51
+ client.subscribe(channel_tag: 'some_channel')
52
+ client.unsubscribe(iden: 'subscription_iden')
53
+ client.channel_info(tag: 'some_channel')
54
+ ```
55
+
56
+ ## Runners
57
+
58
+ | Runner | Methods |
59
+ |--------|---------|
60
+ | `Runners::Push` | `send_note`, `send_link`, `send_file`, `list_pushes`, `delete_push`, `dismiss_push` |
61
+ | `Runners::Device` | `list_devices`, `get_device`, `create_device`, `update_device`, `delete_device` |
62
+ | `Runners::Channel` | `list_subscriptions`, `subscribe`, `unsubscribe`, `channel_info` |
63
+
64
+ ## Requirements
65
+
66
+ - Ruby >= 3.4
67
+ - Pushbullet account and API access token
68
+ - [LegionIO](https://github.com/LegionIO/LegionIO) framework (optional — standalone Client works without it)
69
+
70
+ ## License
71
+
72
+ MIT
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/legion/extensions/pushbullet/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'lex-pushbullet'
7
+ spec.version = Legion::Extensions::Pushbullet::VERSION
8
+ spec.authors = ['Esity']
9
+ spec.email = ['matthewdiverson@gmail.com']
10
+
11
+ spec.summary = 'LEX::Pushbullet'
12
+ spec.description = 'LEX::Pushbullet'
13
+ spec.homepage = 'https://github.com/LegionIO/lex-pushbullet'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 3.4'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-pushbullet'
19
+ spec.metadata['documentation_uri'] = 'https://github.com/LegionIO/lex-pushbullet'
20
+ spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-pushbullet'
21
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/LegionIO/lex-pushbullet/issues'
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.add_dependency 'faraday', '>= 2.0'
29
+ spec.add_dependency 'legion-cache', '>= 1.3.11'
30
+ spec.add_dependency 'legion-crypt', '>= 1.4.9'
31
+ spec.add_dependency 'legion-data', '>= 1.4.17'
32
+ spec.add_dependency 'legion-json', '>= 1.2.1'
33
+ spec.add_dependency 'legion-logging', '>= 1.3.2'
34
+ spec.add_dependency 'legion-settings', '>= 1.3.14'
35
+ spec.add_dependency 'legion-transport', '>= 1.3.9'
36
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'helpers/client'
4
+ require_relative 'runners/push'
5
+ require_relative 'runners/device'
6
+ require_relative 'runners/channel'
7
+
8
+ module Legion
9
+ module Extensions
10
+ module Pushbullet
11
+ class Client
12
+ include Helpers::Client
13
+ include Runners::Push
14
+ include Runners::Device
15
+ include Runners::Channel
16
+
17
+ attr_reader :opts
18
+
19
+ def initialize(token:, **extra)
20
+ @opts = { token: token, **extra }
21
+ end
22
+
23
+ def connection(**override)
24
+ super(**@opts, **override)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Pushbullet
8
+ module Helpers
9
+ module Client
10
+ def connection(token: nil, **_opts)
11
+ Faraday.new(url: 'https://api.pushbullet.com/v2') do |conn|
12
+ conn.request :json
13
+ conn.response :json, content_type: /\bjson$/
14
+ conn.headers['Access-Token'] = token if token
15
+ conn.adapter Faraday.default_adapter
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Pushbullet
6
+ module Runners
7
+ module Channel
8
+ def list_subscriptions(**)
9
+ resp = connection(**).get('subscriptions')
10
+ { subscriptions: resp.body }
11
+ end
12
+
13
+ def subscribe(channel_tag:, **)
14
+ resp = connection(**).post('subscriptions', { channel_tag: channel_tag })
15
+ { subscription: resp.body }
16
+ end
17
+
18
+ def unsubscribe(iden:, **)
19
+ connection(**).delete("subscriptions/#{iden}")
20
+ { deleted: true, iden: iden }
21
+ end
22
+
23
+ def channel_info(tag:, **)
24
+ resp = connection(**).get('channel-info', { tag: tag })
25
+ { channel: resp.body }
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Pushbullet
6
+ module Runners
7
+ module Device
8
+ def list_devices(**)
9
+ resp = connection(**).get('devices')
10
+ { devices: resp.body }
11
+ end
12
+
13
+ def get_device(iden:, **)
14
+ resp = connection(**).get("devices/#{iden}")
15
+ { device: resp.body }
16
+ end
17
+
18
+ def create_device(nickname:, model: nil, manufacturer: nil, **)
19
+ payload = { nickname: nickname }
20
+ payload[:model] = model if model
21
+ payload[:manufacturer] = manufacturer if manufacturer
22
+ resp = connection(**).post('devices', payload)
23
+ { device: resp.body }
24
+ end
25
+
26
+ def update_device(iden:, nickname: nil, **)
27
+ payload = {}
28
+ payload[:nickname] = nickname if nickname
29
+ resp = connection(**).post("devices/#{iden}", payload)
30
+ { device: resp.body }
31
+ end
32
+
33
+ def delete_device(iden:, **)
34
+ connection(**).delete("devices/#{iden}")
35
+ { deleted: true, iden: iden }
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Pushbullet
6
+ module Runners
7
+ module Push
8
+ def send_note(title:, body:, device_iden: nil, email: nil, channel_tag: nil, **) # rubocop:disable Metrics/ParameterLists
9
+ payload = { type: 'note', title: title, body: body }
10
+ payload[:device_iden] = device_iden if device_iden
11
+ payload[:email] = email if email
12
+ payload[:channel_tag] = channel_tag if channel_tag
13
+ resp = connection(**).post('pushes', payload)
14
+ { push: resp.body }
15
+ end
16
+
17
+ def send_link(title:, url:, body: nil, device_iden: nil, email: nil, **) # rubocop:disable Metrics/ParameterLists
18
+ payload = { type: 'link', title: title, url: url }
19
+ payload[:body] = body if body
20
+ payload[:device_iden] = device_iden if device_iden
21
+ payload[:email] = email if email
22
+ resp = connection(**).post('pushes', payload)
23
+ { push: resp.body }
24
+ end
25
+
26
+ def send_file(file_name:, file_url:, file_type:, body: nil, device_iden: nil, **) # rubocop:disable Metrics/ParameterLists
27
+ payload = { type: 'file', file_name: file_name, file_url: file_url, file_type: file_type }
28
+ payload[:body] = body if body
29
+ payload[:device_iden] = device_iden if device_iden
30
+ resp = connection(**).post('pushes', payload)
31
+ { push: resp.body }
32
+ end
33
+
34
+ def list_pushes(modified_after: nil, limit: nil, **)
35
+ params = {}
36
+ params[:modified_after] = modified_after if modified_after
37
+ params[:limit] = limit if limit
38
+ resp = connection(**).get('pushes', params)
39
+ { pushes: resp.body }
40
+ end
41
+
42
+ def delete_push(iden:, **)
43
+ connection(**).delete("pushes/#{iden}")
44
+ { deleted: true, iden: iden }
45
+ end
46
+
47
+ def dismiss_push(iden:, **)
48
+ resp = connection(**).post("pushes/#{iden}", { dismissed: true })
49
+ { push: resp.body }
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Pushbullet
6
+ VERSION = '0.2.1'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/pushbullet/version'
4
+ require 'legion/extensions/pushbullet/helpers/client'
5
+ require 'legion/extensions/pushbullet/runners/push'
6
+ require 'legion/extensions/pushbullet/runners/device'
7
+ require 'legion/extensions/pushbullet/runners/channel'
8
+ require 'legion/extensions/pushbullet/client'
9
+
10
+ module Legion
11
+ module Extensions
12
+ module Pushbullet
13
+ extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
14
+ end
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,179 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lex-pushbullet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Esity
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: faraday
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '2.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '2.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: legion-cache
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.3.11
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 1.3.11
40
+ - !ruby/object:Gem::Dependency
41
+ name: legion-crypt
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.4.9
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.4.9
54
+ - !ruby/object:Gem::Dependency
55
+ name: legion-data
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.4.17
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 1.4.17
68
+ - !ruby/object:Gem::Dependency
69
+ name: legion-json
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 1.2.1
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 1.2.1
82
+ - !ruby/object:Gem::Dependency
83
+ name: legion-logging
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 1.3.2
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 1.3.2
96
+ - !ruby/object:Gem::Dependency
97
+ name: legion-settings
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 1.3.14
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 1.3.14
110
+ - !ruby/object:Gem::Dependency
111
+ name: legion-transport
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 1.3.9
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: 1.3.9
124
+ description: LEX::Pushbullet
125
+ email:
126
+ - matthewdiverson@gmail.com
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files: []
130
+ files:
131
+ - ".github/CODEOWNERS"
132
+ - ".github/dependabot.yml"
133
+ - ".github/workflows/ci.yml"
134
+ - ".gitignore"
135
+ - ".rspec"
136
+ - ".rubocop.yml"
137
+ - CHANGELOG.md
138
+ - CLAUDE.md
139
+ - Gemfile
140
+ - LICENSE
141
+ - LICENSE.txt
142
+ - README.md
143
+ - Rakefile
144
+ - lex-pushbullet.gemspec
145
+ - lib/legion/extensions/pushbullet.rb
146
+ - lib/legion/extensions/pushbullet/client.rb
147
+ - lib/legion/extensions/pushbullet/helpers/client.rb
148
+ - lib/legion/extensions/pushbullet/runners/channel.rb
149
+ - lib/legion/extensions/pushbullet/runners/device.rb
150
+ - lib/legion/extensions/pushbullet/runners/push.rb
151
+ - lib/legion/extensions/pushbullet/version.rb
152
+ homepage: https://github.com/LegionIO/lex-pushbullet
153
+ licenses:
154
+ - MIT
155
+ metadata:
156
+ homepage_uri: https://github.com/LegionIO/lex-pushbullet
157
+ source_code_uri: https://github.com/LegionIO/lex-pushbullet
158
+ documentation_uri: https://github.com/LegionIO/lex-pushbullet
159
+ changelog_uri: https://github.com/LegionIO/lex-pushbullet
160
+ bug_tracker_uri: https://github.com/LegionIO/lex-pushbullet/issues
161
+ rubygems_mfa_required: 'true'
162
+ rdoc_options: []
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '3.4'
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ requirements: []
176
+ rubygems_version: 3.6.9
177
+ specification_version: 4
178
+ summary: LEX::Pushbullet
179
+ test_files: []