Created
April 4, 2011 22:41
-
-
Save racbarn/902623 to your computer and use it in GitHub Desktop.
the whole thing :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'jumpstart_auth' | |
class JSTwitter | |
attr_reader :client | |
def initialize | |
puts "Initializing" | |
@client = JumpstartAuth.twitter | |
end | |
def tweet (message) | |
if message.length <= 140 | |
@client.update(message) | |
puts "Hooray! It worked." | |
else | |
puts "Your message is #{message.length - 140} characters too long! Oh my gosh!" | |
end | |
end | |
def run | |
puts "Welcome to the JSLTwitter Client" | |
command = "" | |
until command == "q" | |
puts "Enter Command:" | |
input = gets.chomp | |
command = input.split.first | |
message = input.split[1..-1].join(" ") | |
if command =="t" | |
tweet(message) | |
else | |
puts "Sorry, I don't know how to (#{command.inspect})" | |
end | |
end | |
end | |
def dm(target, message) | |
puts "Trying to send #{target} this direct message:" | |
puts message | |
when 'dm'then dm(parts[1], parts[1..-1].join(" ")) | |
puts "d, " ", jumpstartfoundry, " ", this is a tweet for jsf" | |
end | |
end | |
# Script | |
jst = JSTwitter.new | |
jst.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try working with this:
require 'rubygems'
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end
def tweet (message)
end
def run
puts "Welcome to the JSLTwitter Client"
end
def dm(target, message)
puts "Trying to send #{target} this direct message:"
puts message
tweet("???")
end
end
Script
jst = JSTwitter.new
jst.run