look-twitter-search 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/twitter_search.rb +13 -6
- metadata +1 -2
data/lib/twitter_search.rb
CHANGED
@@ -38,6 +38,15 @@ module TwitterSearch
|
|
38
38
|
def [](index)
|
39
39
|
@results[index]
|
40
40
|
end
|
41
|
+
|
42
|
+
def has_next_page?
|
43
|
+
! @next_page.nil?
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_next_page
|
47
|
+
client = Client.new
|
48
|
+
return client.query( CGI.parse( @next_page[1..-1] ) )
|
49
|
+
end
|
41
50
|
end
|
42
51
|
|
43
52
|
class Client
|
@@ -45,9 +54,11 @@ module TwitterSearch
|
|
45
54
|
TWITTER_API_DEFAULT_TIMEOUT = 5
|
46
55
|
|
47
56
|
attr_accessor :agent
|
57
|
+
attr_accessor :timeout
|
48
58
|
|
49
|
-
def initialize(agent = 'twitter-search')
|
59
|
+
def initialize(agent = 'twitter-search', timeout = TWITTER_API_DEFAULT_TIMEOUT)
|
50
60
|
@agent = agent
|
61
|
+
@timeout = timeout
|
51
62
|
end
|
52
63
|
|
53
64
|
def headers
|
@@ -55,14 +66,10 @@ module TwitterSearch
|
|
55
66
|
"User-Agent" => @agent }
|
56
67
|
end
|
57
68
|
|
58
|
-
def timeout
|
59
|
-
TWITTER_API_DEFAULT_TIMEOUT
|
60
|
-
end
|
61
|
-
|
62
69
|
def query(opts = {})
|
63
70
|
url = URI.parse(TWITTER_API_URL)
|
64
71
|
url.query = sanitize_query(opts)
|
65
|
-
|
72
|
+
|
66
73
|
req = Net::HTTP::Get.new(url.path)
|
67
74
|
http = Net::HTTP.new(url.host, url.port)
|
68
75
|
http.read_timeout = timeout
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: look-twitter-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Sallings
|
@@ -35,7 +35,6 @@ files:
|
|
35
35
|
- Rakefile
|
36
36
|
- README.markdown
|
37
37
|
- TODO.markdown
|
38
|
-
- VERSION.yml
|
39
38
|
- lib/twitter_search.rb
|
40
39
|
has_rdoc: false
|
41
40
|
homepage: http://github.com/dancroak/twitter-search
|