twttr 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b45656a2aa59200a15f8cf6d6b385bbc6c9acee7b974081570da8bb7e149bc9
4
- data.tar.gz: 402f7b33c794039e136f4daaf882332ae3149c7a65edfc4613d51d2f70e9bd27
3
+ metadata.gz: 2fe60301d1d17eb4a2904de32bbd649364bb864e13cbe9c56c5151d987c34ec4
4
+ data.tar.gz: c7c28b855390fe720ce157d49e8d6f7525ae14ad797bc1a1fbdda77ed4efabfb
5
5
  SHA512:
6
- metadata.gz: ec9cbe1cf6040372550e9a5585d980e290042c7a6e14ec67a168e9b4c8d22c016978a13726c156ac624cdf818777bf792b285f434a396abf8f2901939d4212f2
7
- data.tar.gz: 94b0e533804f9dd724f520b05fefa43d00c1fa2273491f7002072c21cf7f13d6e2a11d4c862614757e559a387788497a6d49887055861e97fd668d64c1b93088
6
+ metadata.gz: aa537df933312dea3e75e86dcf6828b7d8ca2cc81138ec46f7b3e867b81dcaa01c542c601306f26f8c8d68590762071bb80d04dd88ef155c5df0798abf568e3d
7
+ data.tar.gz: fe96a4b38af080331a25a6be5a31d9e5cfc98d0b95b54faabfd1b45dce89bdb1e16e37635eace45bb7a8ef9c63983f295024ebe1fd82c4e7ad15a14c9b823795
@@ -19,25 +19,25 @@ module Twttr
19
19
  # @yield [Array<Twttr::Model::User>] Users followed by page.
20
20
  # @return [Array<Twttr::Model::User>] Users followed.
21
21
  # @return [String,NilClass] Pagination token.
22
- def following(user_id, max_results: nil, pagination_token: nil) # rubocop:disable Metrics/MethodLength
23
- loop do
24
- response = get(FOLLOWING_PATH, params: { user_id: user_id },
25
- query_params: {
26
- 'user.fields': config.user_fields,
27
- max_results: max_results,
28
- pagination_token: pagination_token
29
- }.compact)
22
+ def following(user_id, max_results: nil, pagination_token: nil, &block) # rubocop:disable Metrics/MethodLength
23
+ response = get(FOLLOWING_PATH, params: { user_id: user_id },
24
+ query_params: {
25
+ 'user.fields': config.user_fields,
26
+ max_results: max_results,
27
+ pagination_token: pagination_token
28
+ }.compact)
30
29
 
31
- users = response['data'].map { |v| Model::User.new(v, self) }
30
+ return [], nil if response['meta']['result_count'].zero?
32
31
 
33
- pagination_token = response['meta']['pagination_token']
32
+ users = response['data'].map { |v| Model::User.new(v, self) }
34
33
 
35
- return users, pagination_token unless block_given?
34
+ pagination_token = response['meta']['pagination_token']
36
35
 
37
- yield users, pagination_token
36
+ return users, pagination_token unless block_given?
38
37
 
39
- break if pagination_token.nil?
40
- end
38
+ yield users, pagination_token
39
+
40
+ following(user_id, pagination_token, &block) unless pagination_token.nil?
41
41
  end
42
42
  end
43
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twttr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Decurnex
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-30 00:00:00.000000000 Z
11
+ date: 2022-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth