Class: PostCommit::Hooks::Twitter
- Defined in:
- lib/post_commit/hooks/twitter.rb
Overview
To send a Twitter post commit, you have to setup your username and password.
post_commit :twitter do
:username => "johndoe", :password => "test"
post "Some message"
end
You can specify the message type. See PostCommit::Hooks::Twitter#post for usage.
Instance Attribute Summary
Attributes inherited from Base
#credentials, #options, #request, #response, #uri
Instance Method Summary collapse
-
#post(message, options = {}) ⇒ Object
Post message to Twitter.
Methods inherited from Base
#authorize, #convert_to_params, #convert_to_xml, inherited, #initialize, #set
Constructor Details
This class inherits a constructor from PostCommit::Hooks::Base
Instance Method Details
#post(message, options = {}) ⇒ Object
Post message to Twitter. You can send public and direct messages.
post "Hi Twitter!"
#=> public message
post "Hi john!", :type => :direct_message, :screen_name => "johndoe"
#=> private message
post "Hi john!", :type => :direct_message, :user_id => 1
#=> private message
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/post_commit/hooks/twitter.rb', line 23 def post(, = {}) = {:type => :status}.merge() case .delete(:type) when :status then status(, ) when :direct_message then (, ) else raise PostCommit::InvalidOptionError, "Twitter's message type should be either :status or :direct_message" end end |