Module: Tweetlr::Combinators::TwitterTumblr

Includes:
LogAware
Defined in:
lib/tweetlr/combinators/twitter_tumblr.rb

Class Method Summary collapse

Methods included from LogAware

log=

Class Method Details

.extract_image_url(tweet, embedly_key = nil) ⇒ Object

extract a linked image file’s url from a tweet. first found image will be used.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tweetlr/combinators/twitter_tumblr.rb', line 14

def self.extract_image_url(tweet, embedly_key=nil)
  links = Tweetlr::Processors::Twitter::extract_links tweet
  image_url = nil
  if links
    links.each do |link|
      image_url = Tweetlr::Processors::PhotoService::find_image_url(link, embedly_key)
      return image_url if Tweetlr::Processors::PhotoService::photo? image_url
    end
  end
  image_url
end

.generate_photo_post_from_tweet(tweet, options = {}) ⇒ Object

generate the data for a tumblr photo entry by parsing a tweet



26
27
28
29
# File 'lib/tweetlr/combinators/twitter_tumblr.rb', line 26

def self.generate_photo_post_from_tweet(tweet, options = {})
  log.debug "#{self}.generate_photo_post_from_tweet with options: #{options.inspect}"
  process_options_and_tweet options, tweet
end

.logObject



10
11
12
# File 'lib/tweetlr/combinators/twitter_tumblr.rb', line 10

def self.log
  Tweetlr::LogAware.log #TODO why doesn't the include make the log method accessible?
end