grizzly-weibo 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +2 -2
- data/lib/grizzly/cursor.rb +1 -7
- data/lib/grizzly/version.rb +1 -1
- metadata +3 -3
data/README.markdown
CHANGED
@@ -83,13 +83,13 @@ end
|
|
83
83
|
```
|
84
84
|
|
85
85
|
For something a little more robust we can iterate over pages as well. This will get all of a users friends iterating
|
86
|
-
over them in blocks of fifties. Note that each time you access friends.
|
86
|
+
over them in blocks of fifties. Note that each time you access friends.each an new request to the weibo api will be
|
87
87
|
generated.
|
88
88
|
|
89
89
|
```ruby
|
90
90
|
friends = client.friends(user_id)
|
91
91
|
while friends.next_page? #Loops untill end of collection
|
92
|
-
friends.
|
92
|
+
friends.each do |friend|
|
93
93
|
... # Loops 50 times
|
94
94
|
end
|
95
95
|
end
|
data/lib/grizzly/cursor.rb
CHANGED
@@ -11,14 +11,9 @@ module Grizzly
|
|
11
11
|
|
12
12
|
#Each will return the first page of results
|
13
13
|
def each(&block)
|
14
|
+
@current_page += 1
|
14
15
|
fetch_current_page if !@fetched_current_page
|
15
16
|
@items.each { |i| block.call i }
|
16
|
-
end
|
17
|
-
|
18
|
-
#Next page will return the result set
|
19
|
-
def next_page(&block)
|
20
|
-
fetch_current_page if !@fetched_current_page
|
21
|
-
@items.each { |i| block.call i }
|
22
17
|
@fetched_current_page = false
|
23
18
|
end
|
24
19
|
|
@@ -45,7 +40,6 @@ module Grizzly
|
|
45
40
|
end
|
46
41
|
|
47
42
|
def fetch_current_page
|
48
|
-
@current_page += 1
|
49
43
|
options = @options.merge({ :page => @current_page, :count => @items_per_page })
|
50
44
|
response = page_request(@url, options)
|
51
45
|
@total_items = response["total_number"]
|
data/lib/grizzly/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grizzly-weibo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-10 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: 4461030230960757339
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|