class RTM::List

more friendly class.

Public Class Methods

alive_all() click to toggle source

find all alive Lists.

# File lib/rtmilk/api/lists.rb, line 158
def List.alive_all
   lists = RTM::Lists::GetList.new(RTM::API.token).invoke
   lists.find_all do |list|
      list['archived'] == '0' && list['deleted'] == '0'
   end.collect do |x|
      List.new(x)
   end
end
find(name, alive_only=true) click to toggle source

find a List by name.

# File lib/rtmilk/api/lists.rb, line 132
def List.find(name, alive_only=true) # by name
   lists = RTM::Lists::GetList.new(RTM::API.token).invoke
   lists.find do |list|
      if alive_only
         list['name'] == name && list['archived'] == '0' && list['deleted'] == '0'
      else
         list['name'] == name
      end
   end
end
find_all(name, alive_only=true) click to toggle source

find all Lists.

# File lib/rtmilk/api/lists.rb, line 144
def List.find_all(name, alive_only=true) # by name
   lists = RTM::Lists::GetList.new(RTM::API.token).invoke
   lists.find_all do |list|
      if alive_only
         list['name'] == name && list['archived'] == '0' && list['deleted'] == '0'
      else
         list['name'] == name
      end
   end.collect do |x|
      List.new(x)
   end
end
get() click to toggle source

www.rememberthemilk.com/services/api/methods/rtm.lists.getList.rtm

# File lib/rtmilk/api/lists.rb, line 168
def List.get
end
inbox() click to toggle source
# File lib/rtmilk/api/lists.rb, line 171
def List.inbox
   List.find('Inbox')
end
new(arg) click to toggle source

attr_reader :name, :smart, :id, :archived, :deleted, :position, :locked

# File lib/rtmilk/api/lists.rb, line 85
def initialize(arg)
   if arg.class == String # name
      @hash = RTM::Lists::Add.new(RTM::API.token, arg).invoke
   elsif arg.class == Hash # already constructed
      @hash = arg
   else
      raise RTM::Error, "invalid argument"
   end
end

Public Instance Methods

archive() click to toggle source

archive this list. www.rememberthemilk.com/services/api/methods/rtm.lists.archive.rtm

# File lib/rtmilk/api/lists.rb, line 109
def archive
end
archived?() click to toggle source
# File lib/rtmilk/api/lists.rb, line 99
def archived?; @hash['archived'] == '1'; end
delete() click to toggle source

delete this list. www.rememberthemilk.com/services/api/methods/rtm.lists.delete.rtm

# File lib/rtmilk/api/lists.rb, line 118
def delete
   deleted = RTM::Lists::Delete.new(RTM::API.token, @hash['id']).invoke
end
deleted?() click to toggle source
# File lib/rtmilk/api/lists.rb, line 101
def deleted?; @hash['deleted'] == '1'; end
id() click to toggle source
# File lib/rtmilk/api/lists.rb, line 96
def id; @hash['id']; end
locked?() click to toggle source
# File lib/rtmilk/api/lists.rb, line 100
def locked?; @hash['locked'] == '1'; end
name() click to toggle source
# File lib/rtmilk/api/lists.rb, line 95
def name; @hash['name']; end
name=(new_name) click to toggle source
# File lib/rtmilk/api/lists.rb, line 103
def name=(new_name)
   RTM::API::SetName(RTM::API.token, @id, new_name)
end
position() click to toggle source
# File lib/rtmilk/api/lists.rb, line 97
def position; @hash['position']; end
set_default() click to toggle source

set this list as default. www.rememberthemilk.com/services/api/methods/rtm.lists.setDefaultList.rtm

# File lib/rtmilk/api/lists.rb, line 124
def set_default
end
smart?() click to toggle source
# File lib/rtmilk/api/lists.rb, line 98
def smart?; @hash['smart'] == '1'; end
unarchive() click to toggle source

unarchive this list.

# File lib/rtmilk/api/lists.rb, line 113
def unarchive
end