Sha256: 2edc79ab66bd6248ee6af8692c5dfcb7eb5de2730a17050c855ab03382313928

Contents?: true

Size: 957 Bytes

Versions: 8

Compression:

Stored size: 957 Bytes

Contents

# Twitter4R mistakenly uses ActiveSupport extensions 
module TimeParse
  def Time.parse(args)
    Date.parse(args)
  end
end
Time.extend TimeParse

require 'rubygems'
require 'cerberus/publisher/base'
require 'cerberus/utils'

class Cerberus::Publisher::Twitter < Cerberus::Publisher::Base
  def self.publish(state, manager, options)
    begin
      gem 'twitter4r', '0.3.0'
      require 'twitter'

      twitter_options = options[:publisher, :twitter]
      raise "There is no login info for Twitter publisher" unless twitter_options[:login] and twitter_options[:password]

      subject,body = Cerberus::Publisher::Base.formatted_message(state, manager, options)

      client = Twitter::Client.new( :login => twitter_options[:login], :password => twitter_options[:password] )
      status = client.status( :post, subject )

    rescue Gem::LoadError
      puts "Twitter publisher requires that you install the 'twitter4r' gem first." 
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cerberus-0.4.0 lib/cerberus/publisher/twitter.rb
cerberus-0.4.4 lib/cerberus/publisher/twitter.rb
cerberus-0.4.3 lib/cerberus/publisher/twitter.rb
cerberus-0.4.1 lib/cerberus/publisher/twitter.rb
cerberus-0.4.2 lib/cerberus/publisher/twitter.rb
cerberus-0.4.5.1 lib/cerberus/publisher/twitter.rb
cerberus-0.4.5 lib/cerberus/publisher/twitter.rb
cerberus-0.5 lib/cerberus/publisher/twitter.rb