Module: TwitterFriendly::REST::Users

Included in:
API
Defined in:
lib/twitter_friendly/rest/users.rb

Constant Summary collapse

MAX_USERS_PER_REQUEST =
100

Instance Method Summary collapse

Instance Method Details

#blocked_ids(*args) ⇒ Object



30
31
32
# File 'lib/twitter_friendly/rest/users.rb', line 30

def blocked_ids(*args)
  @twitter.blocked_ids(*args)&.attrs&.fetch(:ids)
end

#user(*args) ⇒ Object



14
15
16
# File 'lib/twitter_friendly/rest/users.rb', line 14

def user(*args)
  @twitter.user(*args)&.to_hash
end

#user?(*args) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/twitter_friendly/rest/users.rb', line 10

def user?(*args)
  @twitter.user?(*args)
end

#users(values, options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/twitter_friendly/rest/users.rb', line 20

def users(values, options = {})
  if values.size <= MAX_USERS_PER_REQUEST
    @twitter.users(values, options).map(&:to_h)
  else
    parallel(in_threads: 6) do |batch|
      values.each_slice(MAX_USERS_PER_REQUEST) { |targets| batch.users(targets, options) }
    end.flatten
  end
end

#verify_credentials(include_entities: false, skip_status: true, include_email: true) ⇒ Object



6
7
8
# File 'lib/twitter_friendly/rest/users.rb', line 6

def verify_credentials(include_entities: false, skip_status: true, include_email: true)
  @twitter.verify_credentials(include_entities: include_entities, skip_status: skip_status, include_email: include_email)&.to_hash
end