Module: TwitterFriendly::REST::Lists

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

Constant Summary collapse

MAX_LISTS_PER_REQUEST =
1000
MAX_MEMBERS_PER_REQUEST =
5000

Instance Method Summary collapse

Instance Method Details

#list(*args) ⇒ Object



5
6
7
# File 'lib/twitter_friendly/rest/lists.rb', line 5

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

#list_members(options = {}) ⇒ Hash #list_members(user, options = {}) ⇒ Hash

Returns The members of the specified list.

Parameters:

  • list (Integer, String)

    A Twitter user ID or screen name.

  • options (Hash)

    a customizable set of options

Returns:

  • (Hash)

    The members of the specified list.



40
41
42
43
44
45
46
47
48
49
# File 'lib/twitter_friendly/rest/lists.rb', line 40

def list_members(*args)
  options = {count: MAX_MEMBERS_PER_REQUEST, skip_status: 1}.merge(args.extract_options!)
  args << options

  if options.has_key?(:cursor)
    @twitter.list_members(*args)&.attrs
  else
    fetch_resources_with_cursor(__method__, *args)
  end
end

#list_members(options = {}) ⇒ Hash #list_members(user, options = {}) ⇒ Hash

Returns The lists the specified user has been added to.

Parameters:

  • user (Integer, String)

    A Twitter user ID or screen name.

  • options (Hash)

    a customizable set of options

Returns:

  • (Hash)

    The lists the specified user has been added to.



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

def memberships(*args)
  options = {count: MAX_LISTS_PER_REQUEST}.merge(args.extract_options!)
  args << options

  if options.has_key?(:cursor)
    @twitter.memberships(*args)&.attrs
  else
    fetch_resources_with_cursor(__method__, *args)
  end
end