lib/lolcommits/plugin/lolsrv.rb in lolcommits-lolsrv-0.0.5 vs lib/lolcommits/plugin/lolsrv.rb in lolcommits-lolsrv-0.0.6
- old
+ new
@@ -4,19 +4,10 @@
module Lolcommits
module Plugin
class Lolsrv < Base
##
- # Returns the name of the plugin. Identifies the plugin to lolcommits.
- #
- # @return [String] the plugin name
- #
- def self.name
- 'lolsrv'
- end
-
- ##
# Returns position(s) of when this plugin should run during the capture
# process. Sync/uploading happens when a new capture is ready.
#
# @return [Array] the position(s) (:capture_ready)
#
@@ -31,23 +22,23 @@
#
# @return [Boolean] true/false indicating if plugin is correctly
# configured
#
def valid_configuration?
- !!(configuration['server'] =~ /^http(s)?:\/\//)
+ !!(configuration[:server] =~ /^http(s)?:\/\//)
end
##
# Prompts the user to configure text options.
#
# @return [Hash] of configured plugin options
#
def configure_options!
options = super
- if options['enabled']
+ if options[:enabled]
print "server: "
- options.merge!('server' => parse_user_input(gets.strip))
+ options.merge!(server: parse_user_input(gets.strip))
puts '---------------------------------------------------------------'
puts ' Lolsrv - Sync lolcommits to a remote server'
puts ''
puts ' Handle POST /uplol with these request params'
puts ''
@@ -181,11 +172,11 @@
# Endpoint requested for POST-ing lolcommits
#
# @return [String] `server` config option + '/uplol'
#
def upload_endpoint
- configuration['server'] + '/uplol'
+ configuration[:server] + '/uplol'
end
##
#
# Endpoint requested for GET-ing lolcommits. It must return a JSON array
@@ -193,10 +184,10 @@
# attribute.
#
# @return [String] `server` config option + '/lols'
#
def lols_endpoint
- configuration['server'] + '/lols'
+ configuration[:server] + '/lols'
end
end
end
end