Class: Lolcommits::Plugin::Protonet
- Inherits:
-
Base
- Object
- Base
- Lolcommits::Plugin::Protonet
- Defined in:
- lib/lolcommits/plugin/protonet.rb
Instance Method Summary collapse
-
#configure_options! ⇒ Hash
Prompts the user to configure plugin options.
-
#initialize(runner: nil, config: nil, name: nil) ⇒ Protonet
constructor
Initialize plugin with runner, config and set all configurable options.
-
#run_capture_ready ⇒ RestClient::Response, Nil
Post-capture hook, runs after lolcommits captures a snapshot.
Constructor Details
#initialize(runner: nil, config: nil, name: nil) ⇒ Protonet
Initialize plugin with runner, config and set all configurable options.
13 14 15 16 |
# File 'lib/lolcommits/plugin/protonet.rb', line 13 def initialize(runner: nil, config: nil, name: nil) super .concat([:api_endpoint, :api_token]) end |
Instance Method Details
#configure_options! ⇒ Hash
Prompts the user to configure plugin options.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/lolcommits/plugin/protonet.rb', line 23 def puts "-----------------------------------------------------------------" puts " Lolcommits Protonet Plugin Config" puts "-----------------------------------------------------------------" puts "\n" puts "We'll need an API endpoint & token. Find API info on your box at " puts "Help/Protonet Rest API. Visit https://protonet.com for more info." puts "-----------------------------------------------------------------" puts "\n" super end |
#run_capture_ready ⇒ RestClient::Response, Nil
Post-capture hook, runs after lolcommits captures a snapshot. Posts the lolcommit image with a message to the Protonet box. API Documentation can be found on the Protonet box under Help/“Protonet REST API”
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/lolcommits/plugin/protonet.rb', line 43 def run_capture_ready debug "Posting image (and message) to #{configuration[:api_endpoint]}" RestClient.post( configuration[:api_endpoint], { files: [File.new(runner.lolcommit_path)], message: }, 'X-Protonet-Token' => configuration[:api_token] ) rescue => e log_error(e, "ERROR: RestClient POST FAILED #{e.class} - #{e.}") nil end |