Module: Twitter::Client::SavedSearches

Included in:
Twitter::Client
Defined in:
lib/twitter/client/saved_searches.rb

Overview

Defines methods related to saved searches

Instance Method Summary collapse

Instance Method Details

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

Retrieve the data for a saved search owned by the authenticating user specified by the given ID

Examples:

Retrieve the data for a saved search owned by the authenticating user with the ID 16129012

Twitter.saved_search(16129012)

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

Requires Authentication?:

  • Yes



35
36
37
38
# File 'lib/twitter/client/saved_searches.rb', line 35

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

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

Creates a saved search for the authenticated user

Examples:

Create a saved search for the authenticated user with the query "twitter"

Twitter.saved_search_create("twitter")

Parameters:

  • query (String)

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

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

    A customizable set of options.

Returns:

See Also:

Rate Limited?:

  • No

Requires Authentication?:

  • Yes



50
51
52
53
# File 'lib/twitter/client/saved_searches.rb', line 50

def saved_search_create(query, options={})
  saved_search = post("/1/saved_searches/create.json", options.merge(:query => query))
  Twitter::SavedSearch.new(saved_search)
end

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

Note:

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

Destroys a saved search for the authenticated user

Examples:

Destroys a saved search for the authenticated user with the ID 16129012

Twitter.saved_search_destroy(16129012)

Parameters:

  • id (Integer)

    The ID of the saved search.

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

    A customizable set of options.

Returns:

See Also:

Rate Limited?:

  • No

Requires Authentication?:

  • Yes



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

def saved_search_destroy(id, options={})
  saved_search = delete("/1/saved_searches/destroy/#{id}.json", options)
  Twitter::SavedSearch.new(saved_search)
end

#saved_searches(options = {}) ⇒ Array<Twitter::SavedSearch>

Returns the authenticated user's saved search queries

Examples:

Return the authenticated user's saved search queries

Twitter.saved_searches

Parameters:

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

    A customizable set of options.

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Requires Authentication?:

  • Yes



18
19
20
21
22
# File 'lib/twitter/client/saved_searches.rb', line 18

def saved_searches(options={})
  get("/1/saved_searches.json", options).map do |saved_search|
    Twitter::SavedSearch.new(saved_search)
  end
end