DCI Like a BOSS - BostonRB lightning talk

DCI Like a BOSS - BostonRB lightning talk

quick talk on DCI for BostonRB lightning talk night.

Patrick Robertson

September 20, 2012

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

15 slides
  1. DCI

  2. # app/models/user.rb class User < ActiveRecord::Base validates_presence_of :twitter_handle def tweet

    TwitterWrangler.add_to_queue twitter_handle, twitter message end private def twitter_message “Today my BMI is #{body_mass_index} and I’m #{percent_of_body_mass_index_goal} from my goal of #{body_mass_index_goal}!” end end
  3. # app/roles/twit_user.rb module TwitUser def twitter_message “Today my BMI is

    #{body_mass_index} and I’m #{percent_of_body_mass_index_goal} from my goal of #{body_mass_index_goal}!” end end
  4. # app/contexts/bmi_update_tweet.rb class BmiUpdateTweet attr_reader :user def initialize(user) @user =

    user @user.extend TwitUser end def call TwitterWrangler.add_to_queue @user.twitter_handle, @user.twitter_message end end
  5. # app/controllers/tweets_controller.rb class TweetsController < ApplicationController def update user =

    User.find(params[:id]) BmiUpdateTweet.new(user).call respond_with :ok end end

More Decks by Patrick Robertson

Other Decks in Technology