tweetlr 0.1.7pre → 0.1.7pre4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +0,0 @@
1
- module TumblrProcessor
2
-
3
- end
@@ -1,39 +0,0 @@
1
- require 'http_processor'
2
-
3
- module TwitterProcessor
4
-
5
- #checks if the message is a retweet
6
- def self.retweet?(message)
7
- message.index('RT @') || message.index(%{"@}) || message.index("\u201c@") #detect retweets
8
- end
9
-
10
- #extract the links from a given tweet
11
- def self.extract_links(tweet)
12
- if tweet
13
- text = tweet['text']
14
- text.gsub(/https?:\/\/[\S]+/).to_a if text
15
- end
16
- end
17
-
18
- #fire a new search
19
- def self.search(config)
20
- search_call = "#{config[:api_endpoint_twitter]}?ors=#{config[:search_term]}&result_type=#{config[:result_type]}&rpp=#{config[:results_per_page]}"
21
- HttpProcessor::http_get search_call
22
- end
23
-
24
- # lazy update - search for a term or refresh the search if a response is available already
25
- def self.lazy_search(config)
26
- result = nil
27
- refresh_url = config[:refresh_url]
28
- log = config[:logger]
29
- if refresh_url
30
- search_url = "#{config[:api_endpoint_twitter]}#{refresh_url}&result_type=#{config[:result_type]}&rpp=#{config[:results_per_page]}"
31
- log.info "lazy search using '#{search_url}'" if log
32
- result = HttpProcessor::http_get search_url
33
- else
34
- log.debug "regular search using '#{config[:search_term]}'" if log
35
- result = search(config)
36
- end
37
- result
38
- end
39
- end