Module: Twitter::REST::SavedSearches

Includes:
Utils, Utils
Included in:
API
Defined in:
lib/twitter/rest/saved_searches.rb

Constant Summary

Constant Summary

Constants included from Utils

Utils::DEFAULT_CURSOR, Utils::URI_SUBSTRING

Instance Method Summary (collapse)

Methods included from Utils

flat_pmap, pmap

Instance Method Details

- (Twitter::SavedSearch) create_saved_search(query, options = {})

Creates a saved search for the authenticated user

Parameters:

  • query (String)

    The query of the search the user would like to save.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

Raises:

See Also:

Rate Limited?:

  • No

Authentication:

  • Requires user context



66
67
68
# File 'lib/twitter/rest/saved_searches.rb', line 66

def create_saved_search(query, options = {})
  perform_with_object(:post, '/1.1/saved_searches/create.json', options.merge(:query => query), Twitter::SavedSearch)
end

- (Array<Twitter::SavedSearch>) destroy_saved_search(*ids) - (Array<Twitter::SavedSearch>) destroy_saved_search(*ids, options)

Note:

The search specified by ID must be owned by the authenticating user.

Destroys saved searches for the authenticated user

Overloads:

  • - (Array<Twitter::SavedSearch>) destroy_saved_search(*ids)

    Parameters:

    • ids (Enumerable<Integer>)

      A collection of saved search IDs.

  • - (Array<Twitter::SavedSearch>) destroy_saved_search(*ids, options)

    Parameters:

    • ids (Enumerable<Integer>)

      A collection of saved search IDs.

    • options (Hash)

      A customizable set of options.

Returns:

Raises:

See Also:

Rate Limited?:

  • No

Authentication:

  • Requires user context



84
85
86
87
88
89
# File 'lib/twitter/rest/saved_searches.rb', line 84

def destroy_saved_search(*args)
  arguments = Twitter::Arguments.new(args)
  pmap(arguments) do |id|
    perform_with_object(:post, "/1.1/saved_searches/destroy/#{id}.json", arguments.options, Twitter::SavedSearch)
  end
end

- (Twitter::SavedSearch) saved_search(id, options = {})

Retrieve the data for saved searches owned by the authenticating user

Parameters:

  • id (Integer)

    The ID of the saved search.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



53
54
55
# File 'lib/twitter/rest/saved_searches.rb', line 53

def saved_search(id, options = {})
  perform_with_object(:get, "/1.1/saved_searches/show/#{id}.json", options, Twitter::SavedSearch)
end

- (Array<Twitter::SavedSearch>) saved_search(options = {}) - (Array<Twitter::SavedSearch>) saved_search(*ids) - (Array<Twitter::SavedSearch>) saved_search(*ids, options)

Returns The saved searches.

Overloads:

Returns:

Raises:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



33
34
35
36
37
38
39
40
41
42
# File 'lib/twitter/rest/saved_searches.rb', line 33

def saved_searches(*args)
  arguments = Twitter::Arguments.new(args)
  if arguments.empty?
    perform_with_objects(:get, '/1.1/saved_searches/list.json', arguments.options, Twitter::SavedSearch)
  else
    pmap(arguments) do |id|
      saved_search(id, arguments.options)
    end
  end
end