yatc 0.0.4 → 0.1.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/yatc.rb +9 -5
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d61ced35adbe95b56b233d432850d038a039de8a
4
- data.tar.gz: 8e1b6ad6ad0d5193a881e78380ef1e4b3b0da5df
3
+ metadata.gz: 1459a7ffd12e7a769afd043c27ded9da196645bd
4
+ data.tar.gz: a1d919995cbf73fb5f7d29ba4751250ed9892baf
5
5
  SHA512:
6
- metadata.gz: 5d0927f46470f12604c590f2067a8d3be7cc42389f3cec2874f0d23669f52b77959d4c18788ee4b675a154b2db3353d1c68f819ab194847c278485f10aa216e4
7
- data.tar.gz: 5cd2c262e9900126a2f0e6bd232ddfe38c3e3c9b3625cce6159dce763fd6cebc1011eb5d5d9195d462b937b11c99a98583795ed028598b235200f2389ccefe9a
6
+ metadata.gz: e28670a1c4f494f592a2861c17423fa1f17ac690e6df1a45396b115afeb26cebcd74ce8e9088640fb2cd4eb7b5cae24d1f50a03c33958053cea594676014f7c8
7
+ data.tar.gz: 7dec133066851c1f58361547df2dabb2e1f45b74cb27f28b2de752995888142d77875cce60474a279902368a2b96b9d156906f4bee732327790ab41cdfe0a42a
@@ -31,13 +31,16 @@ class TwitterClient
31
31
  ids = []
32
32
  cursor = nil
33
33
  force_retrieval = true
34
- while count > 0
35
- params[:count] = [Yatc::Settings::MAX_FOLLOWER_IDS, count].min
36
- count -= params[:count]
37
- unless cursor.nil?
38
- params[:cursor] = cursor
34
+ loop do
35
+ if count == -1
36
+ params[:count] = Yatc::Settings::MAX_FOLLOWER_IDS
37
+ else
38
+ params[:count] = [Yatc::Settings::MAX_FOLLOWER_IDS, count].min
39
+ count -= params[:count]
39
40
  end
40
41
 
42
+ params[:cursor] = cursor unless cursor.nil?
43
+
41
44
  encoded_params = encode_params(params)
42
45
  url = "#{BASE_URL}/followers/ids.json?#{encoded_params}"
43
46
  data = JSON.parse(execute(:get, url))
@@ -45,6 +48,7 @@ class TwitterClient
45
48
  cursor = data['next_cursor']
46
49
  retrieved += params[:count]
47
50
  break if cursor == 0
51
+ break if count == 0
48
52
  end
49
53
  force_retrieval = false
50
54
  ids
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yatc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Rendón Pablo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-17 00:00:00.000000000 Z
11
+ date: 2015-10-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Twitter client.
14
14
  email: rafaelrendonpablo@gmail.com
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  version: '0'
40
40
  requirements: []
41
41
  rubyforge_project:
42
- rubygems_version: 2.4.3
42
+ rubygems_version: 2.4.8
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: Yet Another Twitter Client