Class: Tweet

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/campfire/polling_bot/plugins/tweet/tweet.rb

Overview

used by TweetPlugin

Defined Under Namespace

Classes: TwitterError

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.listObject


30
31
32
# File 'lib/campfire/polling_bot/plugins/tweet/tweet.rb', line 30

def self.list
  all(:order => [:timestamp.asc])
end

.tweet(message, user, pass, proxy = nil) ⇒ Object


21
22
23
24
25
26
27
28
# File 'lib/campfire/polling_bot/plugins/tweet/tweet.rb', line 21

def self.tweet(message, user, pass, proxy=nil)
  result = post(message, user, pass, proxy)
  if result.code == 200
    return true
  else
    raise TwitterError.new(result.body)
  end
end

Instance Method Details

#to_sObject


34
35
36
# File 'lib/campfire/polling_bot/plugins/tweet/tweet.rb', line 34

def to_s
  message
end

#tweet(user, pass, proxy = nil) ⇒ Object


17
18
19
# File 'lib/campfire/polling_bot/plugins/tweet/tweet.rb', line 17

def tweet(user, pass, proxy=nil)
  self.class.tweet(message, user, pass, proxy)
end