Module: Tweety

Extended by:
Tweety, Profile, Tweets
Included in:
Tweety
Defined in:
lib/tweety.rb,
lib/tweety/version.rb

Overview

Boom! The main Tweety module. You can use this module to call methods with the upmost ease:

>> Tweety profile
Returns information about your Twitter profile

>> Tweety.update(status)
Creates a new tweet

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#configObject

Return a new or existing instance of the config variables



37
38
39
# File 'lib/tweety.rb', line 37

def config
  @config ||= Tweety::Config.new
end

#execute(*args) ⇒ Object

Parses command line arguments and does what needs to be done.



24
25
26
27
28
29
30
31
32
33
# File 'lib/tweety.rb', line 24

def execute(*args)
  @options = parse_options(*args)

  # No args, print help.
  if args.empty?
    puts @options
    exit
  end
  self.send(args[0])
end

#say(key, string = '', newline = true) ⇒ Object

Prints the output in a nice pretty format



54
55
56
57
# File 'lib/tweety.rb', line 54

def say(key, string = '', newline = true)
  # print(newline ? string.to_s + "\n" : string)
  print("\n#{prepend}: #{string}\n")
end

#twitterObject

Returns a new or existing instance of the Twitter client



43
44
45
46
47
48
49
50
51
# File 'lib/tweety.rb', line 43

def twitter
  @twitter ||= Twitter.configure do |conf|
    conf.consumer_key       = config[:consumer_key]
    conf.consumer_secret    = config[:consumer_secret]
    conf.oauth_token        = config[:oauth_token]
    conf.oauth_token_secret = config[:oauth_token_secret]
  end
  Twitter
end