uppityrobot 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a43403fa79d70d7486e910da91559419ad6c354d1ae226ff9d2314334f7b843a
4
+ data.tar.gz: a7df2cd6f2354ee75bc240ecadab18bb72ca8bfd1c341c59906e84089b3a5f61
5
+ SHA512:
6
+ metadata.gz: 52658001a0f1d6b424bf5e2ffab409f5757b36bcba4022d7bb692cae8d603913c3bad0db13048f157517a03fe41a9d18ffc68d829633e7017c9a36e029521be3
7
+ data.tar.gz: 980c09f8b48d92d1b770ef8af8d9d37f51c1231633808aa786c60b36a8db6297f883c2932a5e815d4041ba8775835c5c0a27e4dff78557f4b8ea17c849419cb0
@@ -0,0 +1,16 @@
1
+ name: UppityRobot
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.7.4
14
+ bundler-cache: true
15
+ - name: Run the default task
16
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /vendor/
10
+
11
+ # local data files
12
+ *.csv
13
+ test.json
14
+
15
+ # rspec failure tracking
16
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,20 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.7
4
+
5
+ Style/StringLiterals:
6
+ Enabled: true
7
+ EnforcedStyle: double_quotes
8
+
9
+ Style/StringLiteralsInInterpolation:
10
+ Enabled: true
11
+ EnforcedStyle: double_quotes
12
+
13
+ Layout/LineLength:
14
+ Max: 120
15
+
16
+ Metrics/BlockLength:
17
+ IgnoredMethods: ['describe', 'context']
18
+
19
+ Metrics/MethodLength:
20
+ Max: 20
@@ -0,0 +1,3 @@
1
+ {
2
+ "ruby.rubocop.useBundler": true
3
+ }
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in uppityrobot.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,195 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ uppityrobot (0.2.0)
5
+ dry-cli (~> 0.7)
6
+ json (~> 2.5)
7
+ uptimerobot (~> 0.2)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.8.0)
13
+ public_suffix (>= 2.0.2, < 5.0)
14
+ aruba (2.0.0)
15
+ bundler (>= 1.17, < 3.0)
16
+ childprocess (>= 2.0, < 5.0)
17
+ contracts (>= 0.16.0, < 0.18.0)
18
+ cucumber (>= 4.0, < 8.0)
19
+ rspec-expectations (~> 3.4)
20
+ thor (~> 1.0)
21
+ ast (2.4.2)
22
+ builder (3.2.4)
23
+ capybara (3.35.3)
24
+ addressable
25
+ mini_mime (>= 0.1.3)
26
+ nokogiri (~> 1.8)
27
+ rack (>= 1.6.0)
28
+ rack-test (>= 0.6.3)
29
+ regexp_parser (>= 1.5, < 3.0)
30
+ xpath (~> 3.2)
31
+ capybara_discoball (0.1.0)
32
+ capybara (>= 2.7, < 4)
33
+ childprocess (4.1.0)
34
+ coderay (1.1.3)
35
+ contracts (0.16.1)
36
+ crack (0.4.5)
37
+ rexml
38
+ cucumber (7.0.0)
39
+ builder (~> 3.2, >= 3.2.4)
40
+ cucumber-core (~> 10.0, >= 10.0.1)
41
+ cucumber-create-meta (~> 6.0, >= 6.0.1)
42
+ cucumber-cucumber-expressions (~> 12.1, >= 12.1.1)
43
+ cucumber-gherkin (~> 20.0, >= 20.0.1)
44
+ cucumber-html-formatter (~> 16.0, >= 16.0.1)
45
+ cucumber-messages (~> 17.0, >= 17.0.1)
46
+ cucumber-wire (~> 6.0, >= 6.0.1)
47
+ diff-lcs (~> 1.4, >= 1.4.4)
48
+ mime-types (~> 3.3, >= 3.3.1)
49
+ multi_test (~> 0.1, >= 0.1.2)
50
+ sys-uname (~> 1.2, >= 1.2.2)
51
+ cucumber-core (10.0.1)
52
+ cucumber-gherkin (~> 20.0, >= 20.0.1)
53
+ cucumber-messages (~> 17.0, >= 17.0.1)
54
+ cucumber-tag-expressions (~> 3.0, >= 3.0.1)
55
+ cucumber-create-meta (6.0.1)
56
+ cucumber-messages (~> 17.0, >= 17.0.1)
57
+ sys-uname (~> 1.2, >= 1.2.2)
58
+ cucumber-cucumber-expressions (12.1.3)
59
+ cucumber-gherkin (20.0.1)
60
+ cucumber-messages (~> 17.0, >= 17.0.1)
61
+ cucumber-html-formatter (16.0.1)
62
+ cucumber-messages (~> 17.0, >= 17.0.1)
63
+ cucumber-messages (17.1.0)
64
+ cucumber-tag-expressions (3.0.1)
65
+ cucumber-wire (6.1.1)
66
+ cucumber-core (~> 10.0, >= 10.0.1)
67
+ cucumber-cucumber-expressions (~> 12.1, >= 12.1.2)
68
+ cucumber-messages (~> 17.0, >= 17.0.1)
69
+ diff-lcs (1.4.4)
70
+ dry-cli (0.7.0)
71
+ faraday (1.7.2)
72
+ faraday-em_http (~> 1.0)
73
+ faraday-em_synchrony (~> 1.0)
74
+ faraday-excon (~> 1.1)
75
+ faraday-httpclient (~> 1.0.1)
76
+ faraday-net_http (~> 1.0)
77
+ faraday-net_http_persistent (~> 1.1)
78
+ faraday-patron (~> 1.0)
79
+ faraday-rack (~> 1.0)
80
+ multipart-post (>= 1.2, < 3)
81
+ ruby2_keywords (>= 0.0.4)
82
+ faraday-em_http (1.0.0)
83
+ faraday-em_synchrony (1.0.0)
84
+ faraday-excon (1.1.0)
85
+ faraday-httpclient (1.0.1)
86
+ faraday-net_http (1.0.1)
87
+ faraday-net_http_persistent (1.2.0)
88
+ faraday-patron (1.0.0)
89
+ faraday-rack (1.0.0)
90
+ faraday_middleware (1.1.0)
91
+ faraday (~> 1.0)
92
+ ffi (1.15.4)
93
+ hashdiff (1.0.1)
94
+ json (2.5.1)
95
+ json_spec (1.1.5)
96
+ multi_json (~> 1.0)
97
+ rspec (>= 2.0, < 4.0)
98
+ method_source (1.0.0)
99
+ mime-types (3.3.1)
100
+ mime-types-data (~> 3.2015)
101
+ mime-types-data (3.2021.0901)
102
+ mini_mime (1.1.1)
103
+ mini_portile2 (2.6.1)
104
+ multi_json (1.15.0)
105
+ multi_test (0.1.2)
106
+ multipart-post (2.1.1)
107
+ mustermann (1.1.1)
108
+ ruby2_keywords (~> 0.0.1)
109
+ nokogiri (1.12.4)
110
+ mini_portile2 (~> 2.6.1)
111
+ racc (~> 1.4)
112
+ nokogiri (1.12.4-x86_64-linux)
113
+ racc (~> 1.4)
114
+ parallel (1.20.1)
115
+ parser (3.0.2.0)
116
+ ast (~> 2.4.1)
117
+ pry (0.14.1)
118
+ coderay (~> 1.1)
119
+ method_source (~> 1.0)
120
+ public_suffix (4.0.6)
121
+ racc (1.5.2)
122
+ rack (2.2.3)
123
+ rack-protection (2.1.0)
124
+ rack
125
+ rack-test (1.1.0)
126
+ rack (>= 1.0, < 3)
127
+ rainbow (3.0.0)
128
+ rake (13.0.6)
129
+ regexp_parser (2.1.1)
130
+ rexml (3.2.5)
131
+ rspec (3.10.0)
132
+ rspec-core (~> 3.10.0)
133
+ rspec-expectations (~> 3.10.0)
134
+ rspec-mocks (~> 3.10.0)
135
+ rspec-core (3.10.1)
136
+ rspec-support (~> 3.10.0)
137
+ rspec-expectations (3.10.1)
138
+ diff-lcs (>= 1.2.0, < 2.0)
139
+ rspec-support (~> 3.10.0)
140
+ rspec-mocks (3.10.2)
141
+ diff-lcs (>= 1.2.0, < 2.0)
142
+ rspec-support (~> 3.10.0)
143
+ rspec-support (3.10.2)
144
+ rubocop (1.20.0)
145
+ parallel (~> 1.10)
146
+ parser (>= 3.0.0.0)
147
+ rainbow (>= 2.2.2, < 4.0)
148
+ regexp_parser (>= 1.8, < 3.0)
149
+ rexml
150
+ rubocop-ast (>= 1.9.1, < 2.0)
151
+ ruby-progressbar (~> 1.7)
152
+ unicode-display_width (>= 1.4.0, < 3.0)
153
+ rubocop-ast (1.11.0)
154
+ parser (>= 3.0.1.1)
155
+ ruby-progressbar (1.11.0)
156
+ ruby2_keywords (0.0.5)
157
+ sinatra (2.1.0)
158
+ mustermann (~> 1.0)
159
+ rack (~> 2.2)
160
+ rack-protection (= 2.1.0)
161
+ tilt (~> 2.0)
162
+ sys-uname (1.2.2)
163
+ ffi (~> 1.1)
164
+ thor (1.1.0)
165
+ tilt (2.0.10)
166
+ unicode-display_width (2.0.0)
167
+ uptimerobot (0.2.0)
168
+ faraday (>= 0.8)
169
+ faraday_middleware
170
+ webmock (3.13.0)
171
+ addressable (>= 2.3.6)
172
+ crack (>= 0.3.2)
173
+ hashdiff (>= 0.4.0, < 2.0.0)
174
+ xpath (3.2.0)
175
+ nokogiri (~> 1.8)
176
+
177
+ PLATFORMS
178
+ ruby
179
+ x86_64-linux
180
+
181
+ DEPENDENCIES
182
+ aruba
183
+ capybara_discoball
184
+ cucumber
185
+ json_spec
186
+ pry
187
+ rake (~> 13.0)
188
+ rspec (~> 3.2)
189
+ rubocop (~> 1.7)
190
+ sinatra
191
+ uppityrobot!
192
+ webmock
193
+
194
+ BUNDLED WITH
195
+ 2.2.21
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Mark Cooper
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,129 @@
1
+ # UppityRobot
2
+
3
+ Command line wrapper for the [UptimeRobot API](https://uptimerobot.com/api/) (wrapper).
4
+
5
+ ## Installation
6
+
7
+ Requirements:
8
+
9
+ - [Ruby](https://www.ruby-lang.org/en/)
10
+ - [Bundler](https://bundler.io/)
11
+ - `UPTIMEROBOT_API_KEY` environment variable
12
+
13
+ ```bash
14
+ gem install uppityrobot
15
+ ```
16
+
17
+ To avoid having to prefix `UPTIMEROBOT_API_KEY` before each command run:
18
+
19
+ ```bash
20
+ export UPTIMEROBOT_API_KEY=${key}
21
+ ```
22
+
23
+ To persist between terminal sessions add the key to `.bashrc` or equivalent.
24
+
25
+ ## Usage
26
+
27
+ ### Raw API
28
+
29
+ ```bash
30
+ uppityrobot exec --help
31
+ uppityrobot e --help # `e` can be used if preferred
32
+ uppityrobot exec getAlertContacts | jq . # pretty formatted using jq
33
+ uppityrobot exec getMonitors
34
+ ```
35
+
36
+ ### Monitors
37
+
38
+ ```bash
39
+ uppityrobot monitors --help
40
+ uppityrobot m --help # `m` can be used if preferred
41
+ ```
42
+
43
+ Group commands:
44
+
45
+ ```bash
46
+ # LIST
47
+ uppityrobot monitors list # all monitors
48
+ uppityrobot monitors list --csv ~/monitors.csv # output to terminal (json) and save as csv
49
+ uppityrobot monitors list --search aspace # search within friendly_name and url
50
+ uppityrobot monitors list --filter '{"friendly_name": "^aspace-"}' # monitors matching regex
51
+ uppityrobot monitors list --filter '{"friendly_name": "^aspace-"}' --csv ~/aspace.csv
52
+ # filter operates on the response data so can be combined with search (and csv)
53
+ uppityrobot monitors list --search aspace --filter '{"status": 0}' # technically a regex: ^0$'
54
+
55
+ # EXEC
56
+ uppityrobot monitors exec pause aspace # pause all monitors matching "aspace"
57
+ uppityrobot monitors exec start aspace # start all monitors matching "aspace"
58
+ uppityrobot monitors exec pause aspace --filter '{"status": 2}' # only pause running monitors
59
+ uppityrobot monitors exec start aspace --filter '{"status": 0}' # only start paused monitors
60
+
61
+ # UPDATE
62
+ uppityrobot monitors update --help
63
+ uppityrobot monitors update csv ~/aspace.csv # update monitors from csv
64
+ uppityrobot monitors update json ~/aspace.json # update monitors from json file
65
+ uppityrobot monitors update json '[{"id": 1, "friendly_name": "newName"}]' # rename monitor using json string
66
+ ```
67
+
68
+ Individual commands:
69
+
70
+ ```bash
71
+ # CREATE
72
+ uppityrobot monitors create archivesspace https://staff.archivesspace.edu 123-456
73
+
74
+ # DELETE
75
+ uppityrobot monitors delete id 1
76
+ uppityrobot monitors delete name archivesspace
77
+ ```
78
+
79
+ ## Development
80
+
81
+ Clone the repository then run:
82
+
83
+ ```bash
84
+ # install dependencies
85
+ ./bin/setup
86
+
87
+ # interactive console
88
+ ./bin/console
89
+
90
+ # run the tests
91
+ bundle exec rake # runs all tests and rubocop
92
+ bundle exec cucumber features
93
+ bundle exec rspec
94
+
95
+ # install locally
96
+ bundle exec rake install
97
+ gem uninstall uppityrobot
98
+ ```
99
+
100
+ ### Console examples
101
+
102
+ ```ruby
103
+ client = UppityRobot::Client.new(:getMonitors, {})
104
+ client.paginate.each { |r, o, t| puts o; puts r.inspect; }
105
+
106
+ client = UppityRobot::Client.new(:getMonitors, {search: 'aspace'})
107
+ client.filter({'friendly_name' => 'columbia'}).each { |m| puts m.inspect; }
108
+ ```
109
+
110
+ ## Release
111
+
112
+ To release a new version:
113
+
114
+ - Update the version number in `version.rb`
115
+ - Run `bundle exec rake release`
116
+
117
+ This:
118
+
119
+ - Creates a git tag for the version
120
+ - Pushes git commits and the created tag
121
+ - Pushes the `.gem` file to [rubygems.org](https://rubygems.org).
122
+
123
+ ## Contributing
124
+
125
+ Bug reports and pull requests are welcome on GitHub at https://github.com/lyrasis/uppityrobot.
126
+
127
+ ## License
128
+
129
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+
5
+ require "rspec/core/rake_task"
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+ RuboCop::RakeTask.new
10
+
11
+ require "cucumber/rake/task"
12
+ Cucumber::Rake::Task.new
13
+
14
+ task default: %i[spec cucumber rubocop]