Module: Skittles::Client::List

Included in:
Skittles::Client
Defined in:
lib/skittles/client/list.rb

Overview

Define methods related to lists.

Instance Method Summary collapse

Instance Method Details

#add_list(name, options = {}) ⇒ Hashie::Mash

Allows users to create a new list.

Parameters:

  • name (String)

    Name of the list.

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

    A customizable set of options.

Options Hash (options):

  • description (String)

    Description of the list.

  • collaborative (String)

    Boolean indicating if this list can be edited by friends.

  • photoId (String)

    The id of a photo that should be set as the list photo.

Returns:

  • (Hashie::Mash)

    The list that was just created.

See Also:

Requires Acting User:

  • Yes


16
17
18
# File 'lib/skittles/client/list.rb', line 16

def add_list(name, options = {})
  post("lists/add", { :name => name }.merge(options)).list
end

#list(id) ⇒ Hashie::Mash

Gives detail about a list.

Parameters:

  • id (String)

    The id of the list to retrieve additional information for.

Returns:

  • (Hashie::Mash)

    A list object.

See Also:

Requires Acting User:

  • No


26
27
28
# File 'lib/skittles/client/list.rb', line 26

def list(id)
  get("lists/#{id}").list
end

#list_followers(id) ⇒ Hashie::Mash

Note:

Only valid on user-created lists.

Returns users following this list.

Parameters:

  • id (String)

    The id of the user created list to retrieve additional information for.

Returns:

  • (Hashie::Mash)

    A pageable list of compact user.

See Also:

Requires Acting User:

  • Yes


37
38
39
# File 'lib/skittles/client/list.rb', line 37

def list_followers(id)
  get("lists/#{id}/followers").followers
end

#list_suggestphoto(list_id, item_id) ⇒ Hashie::Mash

Note:

Only valid on user-created lists.

Suggests photos that may be appropriate for this item.

Parameters:

  • list_id (String)

    The id of the user created list to retrieve additional information for.

  • item_id (String)

    The id of the item to retrieve for a list.

Returns:

  • (Hashie::Mash)

    Returns groups user and others containing lists of photos.

See Also:

Requires Acting User:

  • Yes


60
61
62
# File 'lib/skittles/client/list.rb', line 60

def list_suggestphoto(list_id, item_id)
  get("lists/#{list_id}/suggestphoto", { :item_id => item_id }).photos
end

#list_suggesttip(list_id, item_id) ⇒ Hashie::Mash

Note:

Only valid on user-created lists.

Suggests tips that may be appropriate for this item.

Parameters:

  • list_id (String)

    The id of the user created list to retrieve additional information for.

  • item_id (String)

    The id of the item to retrieve for a list.

Returns:

  • (Hashie::Mash)

    Returns groups user and others containing lists of photos.

See Also:

Requires Acting User:

  • Yes


72
73
74
# File 'lib/skittles/client/list.rb', line 72

def list_suggesttip(list_id, item_id)
  get("lists/#{list_id}/suggesttip", { :item_id => item_id }).tips
end

#list_suggestvenues(id) ⇒ Hashie::Mash

Note:

Only valid on user-created lists.

Suggests venues that may be appropriate for this list.

Parameters:

  • id (String)

    The id of the user created list to retrieve additional information for.

Returns:

  • (Hashie::Mash)

    An array of compact venues.

See Also:

Requires Acting User:

  • Yes


48
49
50
# File 'lib/skittles/client/list.rb', line 48

def list_suggestvenues(id)
  get("lists/#{id}/suggestvenues").suggestedVenues
end