class Fluent::Plugin::TwitterOutput

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_twitter.rb, line 12
def initialize
  super
end

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_twitter.rb, line 16
def configure(conf)
  super

  @twitter = Twitter::REST::Client.new(
    consumer_key: @consumer_key,
    consumer_secret: @consumer_secret,
    access_token: @access_token,
    access_token_secret: @access_token_secret
  )
end
process(tag, es) click to toggle source
# File lib/fluent/plugin/out_twitter.rb, line 27
def process(tag, es)
  es.each do |_time, record|
    tweet(record['message'])
  end
end
tweet(message) click to toggle source
# File lib/fluent/plugin/out_twitter.rb, line 33
def tweet(message)
  begin
    @twitter.update(message)
  rescue Twitter::Error => e
    log.error("Twitter Error: #{e.message}")
  end
end