Sha256: ed9e3d06284bbb7ffd66f961e2b3485cbe78cb55a79a4b5709591c28f03234ee
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
module Agents class TransmissionAgent < Agent default_schedule 'never' can_dry_run! description <<-MD Add a Agent description here MD include FormConfigurable form_configurable :username form_configurable :password form_configurable :url def default_options { username: "username", password: "password", url: "http://127.0.0.1:9091/transmission/rpc" } end def validate_options %i(username password url).all? { |key| options[:key].present? } end def working? !recent_error_logs? end def check begin client.all rescue => e error("Error connecting to transmission: #{e.class} - #{e.message}") raise e end end def receive(incoming_events) incoming_events.each do |event| log "Adding torrent: #{event.payload['description']}" client.create(event.payload['url']) end end def client @client ||= TransmissionApi::Client.new( username: options[:username], password: options[:password], url: options[:url] ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
huginn_transmission_agent-0.1 | lib/huginn_transmission_agent/transmission_agent.rb |