Sha256: 2bc0eec09baeef10d069268b5825c9c70d102a03c5ad1fb137740d9384a8ae51
Contents?: true
Size: 1.18 KB
Versions: 5
Compression:
Stored size: 1.18 KB
Contents
#rubygems require 'rubygems' # 3rd party require 'twitter_oauth' require 'yaml' require 'rss' require 'bitly' # internal requires require 'twog/rss_parser' require 'twog/rss_entry_to_twog_post_mapper' require 'twog/blog_posts_handler' require 'twog/twitter_handler' require 'twog/post' module Twog module Twog include RssParser include RssEntryToTwogPostMapper include BlogPostsHandler include TwitterHandler def run(conf) posts = get_posts_to_tweet(conf) return unless posts && posts.length > 0 bitly = get_bitly_from(conf) tweet(posts, conf, bitly) end def get_posts_to_tweet(conf) posts = parse_feed(conf['rss_feed']) posts = map(posts) posts = get_new_blog_posts(posts, conf['last_blog_post_tweeted']) end def get_bitly_from(conf) bitly_username = conf['bitly_username'] bitly_api_key = conf['bitly_api_key'] return nil unless (bitly_username && bitly_api_key) Bitly.new(bitly_username, bitly_api_key) end def version yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml]))) "#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}" end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
twog-0.3.5 | lib/twog.rb |
twog-0.3.4 | lib/twog.rb |
twog-0.3.3 | lib/twog.rb |
twog-0.3.2 | lib/twog.rb |
twog-0.3.1 | lib/twog.rb |