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

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

Creates a saved search for the authenticated user

Raises:

See Also:

Rate Limited?:

  • No

Authentication:

  • Requires user context



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

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

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

Note:

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

Destroys saved searches for the authenticated user

Raises:

See Also:

Rate Limited?:

  • No

Authentication:

  • Requires user context



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

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

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

Retrieve the data for saved searches owned by the authenticating user

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



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

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

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

Returns The saved searches.

Overloads:

Raises:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



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

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