Module: Twog::Twog
Instance Method Summary
collapse
#ensure_text_is_of_length, #tweet, #update_config_file_with_latest_tweet_date, #use_twitter_oauth
#get_new_blog_posts
#map
Methods included from RssParser
#get_content, #parse_feed
Instance Method Details
#get_bitly_from(conf) ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/twog.rb', line 40
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
|
34
35
36
37
38
|
# File 'lib/twog.rb', line 34
def (conf)
posts = parse_feed(conf['rss_feed'])
posts = map(posts)
posts = get_new_blog_posts(posts, conf['last_blog_post_tweeted'])
end
|
#run(conf) ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/twog.rb', line 26
def run(conf)
posts = (conf)
return unless posts&.length&.positive?
bitly = get_bitly_from(conf)
(posts, conf, bitly)
end
|
#version ⇒ Object
48
49
50
51
|
# File 'lib/twog.rb', line 48
def version
yml = YAML.safe_load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
"#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
end
|