Module: Scrapbooker::Services::TweetMethods
- Included in:
- Scrapbooker::Services
- Defined in:
- lib/scrapbooker/services/twitter_feed.rb
Instance Method Summary collapse
- #hashtags ⇒ Object
- #is_retweet ⇒ Object
- #links ⇒ Object
- #media ⇒ Object
- #mentions ⇒ Object
- #original_tweet ⇒ Object
Instance Method Details
#hashtags ⇒ Object
102 103 104 105 106 107 108 109 110 |
# File 'lib/scrapbooker/services/twitter_feed.rb', line 102 def = Array.new if self.original_tweet['entities'] && self.original_tweet['entities']['hashtags'] for hashtag in self.original_tweet['entities']['hashtags'] do << "##{hashtag['text']}" end end return end |
#is_retweet ⇒ Object
66 67 68 |
# File 'lib/scrapbooker/services/twitter_feed.rb', line 66 def is_retweet self.original_tweet['retweeted_status'] ? true : false end |
#links ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/scrapbooker/services/twitter_feed.rb', line 70 def links links = Array.new if self.original_tweet['entities'] && self.original_tweet['entities']['urls'] for link in self.original_tweet['entities']['urls'] do link_hash = Hash['source', link['expanded_url'], 'display', link['url']] links << link_hash end end return links end |
#media ⇒ Object
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/scrapbooker/services/twitter_feed.rb', line 81 def media media = Array.new if self.original_tweet['entities'] && self.original_tweet['entities']['media'] for entity in self.original_tweet['entities']['media'] do media_hash = Hash['source', entity['media_url'], 'display', entity['url'], 'type', entity['type']] media << media_hash end end return media end |
#mentions ⇒ Object
92 93 94 95 96 97 98 99 100 |
# File 'lib/scrapbooker/services/twitter_feed.rb', line 92 def mentions mentions = Array.new if self.original_tweet['entities'] && self.original_tweet['entities']['user_mentions'] for mention in self.original_tweet['entities']['user_mentions'] do mentions << "#{mention['screen_name']}" end end return mentions end |
#original_tweet ⇒ Object
62 63 64 |
# File 'lib/scrapbooker/services/twitter_feed.rb', line 62 def original_tweet YAML::load(self.raw_feed) end |