Module: Croudia::API::Favorites

Included in:
Client
Defined in:
lib/croudia/api/favorites.rb

Instance Method Summary collapse

Instance Method Details

#favorite(status_id, params = {}) ⇒ Croudia::Status

Favorite a status

Parameters:

  • status_id (String, Integer, Croudia::Status)

    ID of the status to favorite

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

    Additional query parameters

Options Hash (params):

  • :include_entities (String)

    Set false to exclude entities

Returns:

See Also:



27
28
29
30
31
# File 'lib/croudia/api/favorites.rb', line 27

def favorite(status_id, params={})
  status_id = get_id(status_id)
  resp = post("/favorites/create/#{status_id}.json", params)
  Croudia::Status.new(resp)
end

#favorites(params = {}) ⇒ Array<Croudia::Status>

List of favorited statuses

Parameters:

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

    Additional query parameters

Options Hash (params):

  • :count (String, Integer)

    Number of statuses in the response

  • :include_entities (String)

    Set false to exclude entities

  • :max_id (String, Integer)

    Paging parameter

  • :since_id (String, Integer)

    Paging parameter

Returns:

See Also:



15
16
17
18
# File 'lib/croudia/api/favorites.rb', line 15

def favorites(params={})
  resp = get('/favorites.json', params)
  objects(Croudia::Status, resp)
end

#unfavorite(status_id, params = {}) ⇒ Croudia::Status

Unfavorite a status

Parameters:

  • status_id (String, Integer, Croudia::Status)

    ID of the status to unfavorite

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

    Additional query parameters

Options Hash (params):

  • :include_entities (String)

    Set false to exclude entities

Returns:

See Also:



40
41
42
43
44
# File 'lib/croudia/api/favorites.rb', line 40

def unfavorite(status_id, params={})
  status_id = get_id(status_id)
  resp = delete("/favorites/destroy/#{status_id}.json", params)
  Croudia::Status.new(resp)
end