rtmapi 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rtmapi.rb +19 -20
- data/test/data/test_rtm_tasks_getList_empty.1.xml +2 -0
- data/test/test-rtmapi.rb +7 -2
- metadata +3 -2
data/lib/rtmapi.rb
CHANGED
@@ -244,10 +244,10 @@ class RememberTheMilk
|
|
244
244
|
data = new_hash
|
245
245
|
elsif data.class == RememberTheMilkHash # only one list
|
246
246
|
data = process_task_list( data[:id], data.arrayify_value(:taskseries) )
|
247
|
-
elsif data.class == NilClass
|
247
|
+
elsif data.class == NilClass || (data.class == String && data == args['list_id']) # empty list
|
248
248
|
data = new_hash
|
249
249
|
else # who knows...
|
250
|
-
debug( "got a class of (%s) when processing tasks. passing it on through", data.class )
|
250
|
+
debug( "got a class of (%s [%s]) when processing tasks. passing it on through", data.class, data )
|
251
251
|
end
|
252
252
|
when :groups
|
253
253
|
# contacts expected to be array, so look at each group and fix it's contact
|
@@ -336,28 +336,26 @@ class RememberTheMilk
|
|
336
336
|
|
337
337
|
def call_api_method( method, args={} )
|
338
338
|
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
339
|
+
args['method'] = "rtm.#{method}"
|
340
|
+
args['api_key'] = @api_key
|
341
|
+
args['auth_token'] ||= @auth_token if @auth_token
|
342
|
+
|
343
|
+
# make sure everything in our arguments is a string
|
344
|
+
args.each do |key,value|
|
345
|
+
key_s = key.to_s
|
346
|
+
args.delete(key) if key.class != String
|
347
|
+
args[key_s] = value.to_s
|
348
|
+
end
|
349
|
+
|
350
|
+
args['api_sig'] = sign_request(args)
|
350
351
|
|
351
|
-
|
352
|
+
debug( 'rtm.%s(%s)', method, args.inspect )
|
352
353
|
|
353
|
-
debug( 'rtm.%s(%s)', method, args.inspect )
|
354
|
-
end
|
355
|
-
|
356
354
|
attempts_left = @max_connection_attempts
|
357
355
|
|
358
356
|
begin
|
359
|
-
if args.has_key?(
|
360
|
-
@xml_parser.string = args[
|
357
|
+
if args.has_key?('test_data')
|
358
|
+
@xml_parser.string = args['test_data']
|
361
359
|
else
|
362
360
|
attempts_left -= 1
|
363
361
|
response = Net::HTTP.get_response(@uri.host, "#{@uri.path}?#{args.keys.collect {|k| "#{CGI::escape(k).gsub(/ /,'+')}=#{CGI::escape(args[k]).gsub(/ /,'+')}"}.join('&')}")
|
@@ -547,7 +545,8 @@ class RememberTheMilkTask < RememberTheMilkHash
|
|
547
545
|
other_due = (other.has_key?(:tasks) && other.tasks.class == Array) ? other.task[:due] : nil
|
548
546
|
other_due = @@BeginningOfEpoch unless other_due.class == Time
|
549
547
|
|
550
|
-
# sort based on
|
548
|
+
# sort based on priority, then due date, then name
|
549
|
+
# which is the rememberthemilk default
|
551
550
|
# if 0 was false in ruby, we could have done
|
552
551
|
# prio <=> other_due || due <=> other_due || self['name'].to_s <=> other['name'].to_s
|
553
552
|
# but it's not, so oh well....
|
data/test/test-rtmapi.rb
CHANGED
@@ -258,6 +258,13 @@ class TestRememberTheMilk < Test::Unit::TestCase
|
|
258
258
|
assert_equal "only one task in this list", data.values[0].name
|
259
259
|
end
|
260
260
|
|
261
|
+
def test_rtm_tasks_getList_empty
|
262
|
+
list_id = "759197"
|
263
|
+
data = @rtm.tasks.getList( :list_id => list_id )
|
264
|
+
assert_equal RememberTheMilkHash, data.class
|
265
|
+
assert_equal 0, data.keys.size
|
266
|
+
end
|
267
|
+
|
261
268
|
|
262
269
|
def test_rtm_get_task_and_is_complete
|
263
270
|
data = @rtm.tasks.getList( :list_id => '421865' )
|
@@ -497,8 +504,6 @@ class TestRememberTheMilk < Test::Unit::TestCase
|
|
497
504
|
|
498
505
|
end
|
499
506
|
|
500
|
-
# TODO: add-- def test_rtm_tasks_getList_empty
|
501
|
-
|
502
507
|
def test_rtm_tasks_setRecurrence
|
503
508
|
list_id = @APITestListId
|
504
509
|
tasks = @rtm.tasks.getList( :list_id => list_id )
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.1
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rtmapi
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.6.
|
7
|
-
date: 2007-02-
|
6
|
+
version: 0.6.2
|
7
|
+
date: 2007-02-05 00:00:00 -05:00
|
8
8
|
summary: Simple library for interfacing with rememberthemilk.com.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- test/data/test_rtm_tasks_add.3.xml
|
68
68
|
- test/data/test_rtm_tasks_getList.1.xml
|
69
69
|
- test/data/test_rtm_tasks_getList_all.1.xml
|
70
|
+
- test/data/test_rtm_tasks_getList_empty.1.xml
|
70
71
|
- test/data/test_rtm_tasks_getList_from_smartlist.1.xml
|
71
72
|
- test/data/test_rtm_tasks_getList_with_only_one_task.1.xml
|
72
73
|
- test/data/test_rtm_tasks_setDueDate.1.xml
|