Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

adamcooke/twitterfications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Twitterfications

Twitterfications allows you to easily setup twitter notifications from your Rails application.

script/plugin install git://github.com/adamcooke/twitterfications.git

Once installed, simply configure by adding the config below to config/initializers/twitterfications.rb

Twitterfications.method = :direct
Twitterfications::Twitter.username = 'my_username'
Twitterfications::Twitter.password = 'my_password'

The method can be set to :direct or :background. Direct requests are sent in the current thread where as background are forked into another process. To use background processing, you will need to install the spawn plugin.

script/plugin install git://github.com/tra/spawn

ActiveRecord Usage

This plugin can be directly embedded with your ActiveRecord models.

class Person < ActiveRecord::Base
  
  ## Automatically update twitter on create, update, destroy or save
  tweet(:create)    { |p| "#{p.full_name} has been created in the application"}
  tweet(:destroy)   { |p| "#{p.full_name} has been removed from the application"}
  tweet(:update)    { |p| "#{p.full_name} has been updated in the application"}
  
  ## Alternatively, include twitter notifications in your own callbacks
  after_create :my_callback
  
  private
  
  def my_callback
    tweet "This is a tweet about #{self.full_name} from my own callback"
  end
end

ActionController Usage

You can also use the tweet(status) method in any of your controller actions.

Direct usage

If you'd like to tweet from anywhere else in your application, you can post directly, by calling:

Twitterfications.post("Your tweet here")

About

A Rails plugin which allows you to send tweets to alert you of specific activities within your app with considerable ease

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages