rtmilk 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b642bfac373d10ea9267dac432ff2a3f036f7923
4
- data.tar.gz: 7f01237fb8121129203dedcb0252e3459d23c3ff
3
+ metadata.gz: b24fcbdb16de0d611ec1015598481b661dd8547d
4
+ data.tar.gz: 3f81413f9c3231f2c493b58df9b3575aa008fed9
5
5
  SHA512:
6
- metadata.gz: 87510ca1a9e3d095d449b278d3149d1b087a86a7cff2e413410d3c42d755dcc8402e6d8a5c24f2058d2e45abf6e37528dcbf7b5c44fa9b5f4ee2ed99f4fa7597
7
- data.tar.gz: 2e0ccf26c6124cac4213217a229fa768c1039d3cbbdb944d10654de7135b9ca2b61bf644fb4cc3522eb9203effc690ae85320e9fe0b46cae8b84a522c3dc6df6
6
+ metadata.gz: 2eb2e963e1f9c0c9ac3b32b99668cf81b1bd6d4254fa380b699fed9ece27c37b14c37203f6bfdc6e8ba832ce11f85c9d9bd7be52c4b04d4ff566476178c26196
7
+ data.tar.gz: c5aec2500f82c5c37d53b7f10c2cab3d3529d91a11de3e08cb0858d2da9113c589cca6ee1f613076c09fadfe2d8f2d535ccad746b30d47455e35bd9d2ea56122
@@ -14,11 +14,3 @@ lib/rtmilk/api.rb
14
14
  lib/rtmilk/error.rb
15
15
  lib/rtmilk/version.rb
16
16
  lib/rtmilk.rb
17
- test/auth_api_test.rb
18
- test/lists_api_test.rb
19
- test/make_config.rb
20
- test/notes_api_test.rb
21
- test/Rakefile
22
- test/tasks_api_test.rb
23
- test/test_helper.rb
24
- test/timelines_api_test.rb
data/README.md CHANGED
@@ -1,3 +1,3 @@
1
- = README for rtmilk =
1
+ ![TravisCI](https://travis-ci.org/mootoh/rtmilk.svg?branch=master)
2
2
 
3
3
  rtmilk is a [Remember the Milk](http://www.rememberthemilk.com/) wrapper library.
@@ -16,12 +16,20 @@ module RTM
16
16
  class API
17
17
 
18
18
  private
19
- RTM_URI = 'https://api.rememberthemilk.com'
19
+ RTM_DOMAIN = 'rememberthemilk.com'
20
20
  REST_PATH = '/services/rest/'
21
21
  AUTH_PATH = '/services/auth/'
22
22
  PERMS = ['read', 'write', 'delete']
23
23
 
24
24
  public
25
+ def api_host
26
+ 'https://api.' + RTM_DOMAIN
27
+ end
28
+
29
+ def API.auth_host
30
+ 'http://www.' + RTM_DOMAIN
31
+ end
32
+
25
33
  # initialize the API context.
26
34
  def API.init(key, sec, option=nil)
27
35
  @@key = key
@@ -47,7 +55,7 @@ public
47
55
 
48
56
  # invoke a method
49
57
  def invoke
50
- response = URI.join(RTM_URI, make_url).read
58
+ response = URI.join(api_host, make_url).read
51
59
  # puts '--------------------------------------------------'
52
60
  # puts response
53
61
  # puts '--------------------------------------------------'
@@ -64,7 +72,7 @@ public
64
72
 
65
73
  sig = API.sign(param)
66
74
 
67
- r = 'http://' + RTM_URI + AUTH_PATH + '?'
75
+ r = [auth_host, AUTH_PATH].join + '?'
68
76
  r += param.collect { |k, v| [k, v].join('=') }.sort.join('&')
69
77
  r += '&api_sig=' + sig
70
78
  r
@@ -2,7 +2,7 @@ module Rtmilk #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtmilk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - takayama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-02 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -65,16 +65,6 @@ files:
65
65
  - lib/rtmilk/error.rb
66
66
  - lib/rtmilk/version.rb
67
67
  - setup.rb
68
- - test/Rakefile
69
- - test/auth_api_test.rb
70
- - test/lists_api_test.rb
71
- - test/make_config.rb
72
- - test/notes_api_test.rb
73
- - test/rtm_api_test.rb
74
- - test/rtm_test.rb
75
- - test/tasks_api_test.rb
76
- - test/test_helper.rb
77
- - test/timelines_api_test.rb
78
68
  homepage: https://github.com/mootoh/rtmilk
79
69
  licenses:
80
70
  - MIT
@@ -101,11 +91,4 @@ rubygems_version: 2.4.5
101
91
  signing_key:
102
92
  specification_version: 4
103
93
  summary: a "Remember the Milk" wrapper library.
104
- test_files:
105
- - test/auth_api_test.rb
106
- - test/lists_api_test.rb
107
- - test/notes_api_test.rb
108
- - test/rtm_api_test.rb
109
- - test/rtm_test.rb
110
- - test/tasks_api_test.rb
111
- - test/timelines_api_test.rb
94
+ test_files: []
@@ -1,7 +0,0 @@
1
- task :default => [:test]
2
-
3
- task :test do
4
- ruby 'make_config.rb'
5
- # ruby 'rtm_api_test.rb'
6
- # ruby 'rtm_test.rb'
7
- end
@@ -1,82 +0,0 @@
1
- #
2
- # tests for RTM::Auth API.
3
- #
4
-
5
- require File.dirname(__FILE__) + '/test_helper.rb'
6
-
7
- class RTMAuthAPITest < Test::Unit::TestCase
8
- CONFIG = File.dirname(__FILE__) + '/../config.dat' # config data file
9
-
10
- def setup
11
- conf = begin
12
- Marshal.load(open(CONFIG))
13
- rescue
14
- puts 'please run make_config.rb first.'
15
- exit
16
- end
17
-
18
- RTM::API.init(conf[:key], conf[:sec], conf)
19
- @perms = 'delete'
20
- end
21
-
22
- def teardown
23
- end
24
-
25
- # -----------------------------------------------------------------
26
- # helper
27
- #
28
- def prompt_for_auth(url)
29
- puts 'authorize this url : ' + url
30
- puts 'then, push enter here.'
31
- gets
32
- end
33
-
34
- def get_frob
35
- frob = RTM::Auth::GetFrob.new.invoke
36
- assert_equal(40, frob.length)
37
- return frob
38
- end
39
-
40
- def get_token(frob)
41
- res = RTM::Auth::GetToken.new(frob).invoke
42
- assert_equal(40, res[:token].length)
43
- assert_equal(@perms, res[:perms])
44
- return res[:token]
45
- end
46
-
47
- def get_token_interactive
48
- frob = get_frob
49
- url = RTM::API.get_auth_url(@perms, frob)
50
- prompt_for_auth(url)
51
-
52
- get_token(frob)
53
- end
54
-
55
-
56
- # -----------------------------------------------------------------
57
- # tests
58
- #
59
- def test_getFrob
60
- get_frob
61
- end
62
-
63
- def test_invalidToken
64
- assert_raise(RTM::Error) {
65
- RTM::Auth::GetToken.new('detarame').invoke
66
- }
67
- end
68
-
69
- # this test requires user authentication manually, so disabed normally.
70
- def not_test_getToken
71
- get_token_interactive
72
- end
73
-
74
- # this test requires user authentication manually, so disabed normally.
75
- def not_test_checkToken
76
- token = get_token_interactive
77
-
78
- auth = RTM::Auth::CheckToken.new(token).invoke
79
- assert_equal(@perms, auth[:perms])
80
- end
81
- end
82
- # vim:fdm=indent
@@ -1,82 +0,0 @@
1
- #
2
- # tests for RTM::Lists API.
3
- #
4
-
5
- require File.dirname(__FILE__) + '/test_helper.rb'
6
-
7
- class RTMListsAPITest < Test::Unit::TestCase
8
- CONFIG = File.dirname(__FILE__) + '/../config.dat' # config data file
9
-
10
- def setup
11
- conf = begin
12
- Marshal.load(open(CONFIG))
13
- rescue
14
- puts 'please run make_config.rb first.'
15
- exit
16
- end
17
-
18
- RTM::API.init(conf[:key], conf[:sec], conf)
19
- @perms = 'read'
20
- @token = conf[:token]
21
- end
22
-
23
- def teardown
24
- end
25
-
26
- # -----------------------------------------------------------------
27
- # helper
28
- #
29
-
30
- # -----------------------------------------------------------------
31
- # tests
32
- #
33
- def test_getList
34
- lists = RTM::Lists::GetList.new(@token).invoke
35
- assert_instance_of(Array, lists)
36
- lists.each do |list|
37
- assert_instance_of(Hash, list)
38
- assert_equal(true, list.has_key?('name'))
39
- assert_equal(true, list.has_key?('id'))
40
- assert_equal(true, list.has_key?('deleted'))
41
- assert_equal(true, list.has_key?('smart'))
42
- end
43
- end
44
-
45
- def not_test_add
46
- name = 'testAddList'
47
- added = RTM::Lists::Add.new(@token, name).invoke
48
- assert_equal(added['name'], name)
49
-
50
- # TODO: do filter test
51
- end # add
52
-
53
- def not_test_delete
54
- name = 'testAddList'
55
- added = RTM::Lists::Add.new(@token, name).invoke
56
- assert_equal(added['name'], name)
57
-
58
- deleted = RTM::Lists::Delete.new(@token, added['id']).invoke
59
- assert_equal(added['name'], deleted['name'])
60
- assert_equal(added['id'], deleted['id'])
61
- assert_equal('1', deleted['deleted'])
62
- end # delete
63
-
64
- def test_setName
65
- # add
66
- name = 'testSetName'
67
- new_name = 'testSetNameNew'
68
- added = RTM::Lists::Add.new(@token, name).invoke
69
- assert_equal(added['name'], name)
70
-
71
- # setName
72
- named = RTM::Lists::SetName.new(@token, added['id'], new_name).invoke
73
- assert_equal(new_name, named['name'])
74
-
75
- # delete
76
- deleted = RTM::Lists::Delete.new(@token, added['id']).invoke
77
- assert_equal(named['name'], deleted['name'])
78
- assert_equal(named['id'], deleted['id'])
79
- assert_equal('1', deleted['deleted'])
80
- end
81
- end
82
- # vim:fdm=indent
@@ -1,75 +0,0 @@
1
- #
2
- # make config.dat to store API_KEY, SHARED_SECRET, TOKENs.
3
- #
4
- require File.dirname(__FILE__) + '/test_helper.rb'
5
-
6
- CONFIG = File.dirname(__FILE__) + '/../config.dat' # config data file
7
-
8
- # if file exists, exit
9
- if FileTest.readable?(CONFIG)
10
- exit
11
- end
12
-
13
- done = false
14
-
15
- def getToken(perms, frob)
16
- url = RTM::API.get_auth_url(perms, frob)
17
- puts "follow this link to acqure token (#{perms}) : " + url
18
- puts ', then press enter here.'
19
- gets
20
-
21
- res = RTM::Auth::GetToken.new(frob).invoke
22
- return res[:token]
23
- end
24
-
25
- fh = open(CONFIG, 'w')
26
- begin
27
- hash = {}
28
- puts 'Enter your API key.'
29
- hash[:key] = gets.chomp
30
-
31
- puts 'Enter your shared secret.'
32
- hash[:sec] = gets.chomp
33
-
34
- RTM::API.init(hash[:key], hash[:sec])
35
-
36
- # get a frob
37
- frob = RTM::Auth::GetFrob.new.invoke
38
- puts 'acquired frob : ' + frob
39
-
40
- #
41
- # choose permission
42
- #
43
- puts 'choose permission: [R]ead, [W]rite, or [D]elete .'
44
- selected = gets.chomp
45
-
46
- perms = {
47
- 'r' => 'read',
48
- 'R' => 'read',
49
- 'w' => 'write',
50
- 'W' => 'write',
51
- 'd' => 'delete',
52
- 'D' => 'delete' }
53
-
54
- #
55
- # get tokens
56
- #
57
- token = getToken(perms[selected], frob)
58
- hash[:token] = token
59
-
60
- puts 'acquired token is ' + token
61
-
62
- #
63
- # save
64
- #
65
- Marshal.dump(hash, fh)
66
- puts 'all done !!!'
67
- puts "your informations stored to #{CONFIG}."
68
- done = true
69
- ensure
70
- fh.close
71
-
72
- unless done
73
- File.unlink(CONFIG)
74
- end
75
- end
@@ -1,125 +0,0 @@
1
- #
2
- # tests for RTM::Tasks::Notes API.
3
- #
4
-
5
- require File.dirname(__FILE__) + '/test_helper.rb'
6
-
7
- class RTMTasksNotesAPITest < Test::Unit::TestCase
8
- CONFIG = File.dirname(__FILE__) + '/../config.dat' # config data file
9
-
10
- def setup
11
- conf = begin
12
- Marshal.load(open(CONFIG))
13
- rescue
14
- puts 'please run make_config.rb first.'
15
- exit
16
- end
17
-
18
- RTM::API.init(conf[:key], conf[:sec], conf)
19
- @perms = 'read'
20
- @token = conf[:token]
21
- end
22
-
23
- def teardown
24
- end
25
-
26
- # -----------------------------------------------------------------
27
- # helper
28
- #
29
-
30
- # -----------------------------------------------------------------
31
- # tests
32
- #
33
- def not_test_add
34
- timeline, err = RTM::Timelines::Create.new(@token).invoke
35
- assert_equal('ok', err)
36
- assert_equal(7, timeline.length)
37
-
38
- lists, err = RTM::Lists::GetList.new(@token).invoke
39
- assert_equal('ok', err)
40
- assert_instance_of(Array, lists)
41
- list = lists.first['id']
42
-
43
- list_a, err, transaction_add = RTM::Tasks::Add.new(
44
- @token, timeline, list, 'testTaskAdd').invoke
45
- assert_equal('ok', err)
46
-
47
- taskseries = list_a['taskseries'].first['id']
48
- task = list_a['taskseries'].first['task'].first['id']
49
-
50
- puts 'creating Note with ' +
51
- 'timeline=' + timeline +
52
- ', list=' + list +
53
- ', taskseries=' + taskseries +
54
- ', task=' + task
55
- note, err, transaction = RTM::Tasks::Notes::Add.new(
56
- @token, timeline, list, taskseries, task, 'testNote', 'testNote body.').invoke
57
- assert_equal('ok', err)
58
- assert_instance_of(Hash, note)
59
- assert_not_equal('', note['id'])
60
- end
61
-
62
- def not_test_add_delete
63
- timeline, err = RTM::Timelines::Create.new(@token).invoke
64
- assert_equal('ok', err)
65
- assert_equal(7, timeline.length)
66
-
67
- lists, err = RTM::Lists::GetList.new(@token).invoke
68
- assert_equal('ok', err)
69
- assert_instance_of(Array, lists)
70
- list = lists.first['id']
71
-
72
- list_a, err, transaction_add = RTM::Tasks::Add.new(
73
- @token, timeline, list, 'testTaskAdd').invoke
74
- assert_equal('ok', err)
75
-
76
- taskseries = list_a['taskseries'].first['id']
77
- task = list_a['taskseries'].first['task'].first['id']
78
-
79
- note, err, transaction = RTM::Tasks::Notes::Add.new(
80
- @token, timeline, list, taskseries, task, 'testNote', 'testNote body.').invoke
81
- assert_equal('ok', err)
82
- assert_instance_of(Array, lists)
83
-
84
- raise Error if note['id'] == ''
85
-
86
- err = RTM::Tasks::Notes::Delete.new(@token, timeline, note['id']).invoke
87
- assert_equal('ok', err.first)
88
-
89
- list_d, err, transaction = RTM::Tasks::Delete.new(
90
- @token, timeline, lists.first['id'], taskseries, task).invoke
91
- assert_equal('ok', err)
92
- assert_equal(list_a['id'], list_d['id'])
93
- end
94
-
95
- def test_edit
96
- timeline = RTM::Timelines::Create.new(@token).invoke
97
- assert_equal(7, timeline.length)
98
-
99
- lists = RTM::Lists::GetList.new(@token).invoke
100
- assert_instance_of(Array, lists)
101
- list = lists.first['id']
102
-
103
- list_a, transaction_add = RTM::Tasks::Add.new(
104
- @token, timeline, list, 'testTaskAdd').invoke
105
-
106
- taskseries = list_a['taskseries'].first['id']
107
- task = list_a['taskseries'].first['task'].first['id']
108
-
109
- note, transaction = RTM::Tasks::Notes::Add.new(
110
- @token, timeline, list, taskseries, task, 'testNote', 'testNote body.').invoke
111
-
112
- raise Error if note['id'] == ''
113
-
114
- editted, transaction = RTM::Tasks::Notes::Edit.new(
115
- @token, timeline, note['id'], 'testNote editted', 'testNote body edditted.').invoke
116
- assert_equal(note['id'], editted['id'])
117
-
118
- RTM::Tasks::Notes::Delete.new(@token, timeline, note['id']).invoke
119
-
120
- list_d, transaction = RTM::Tasks::Delete.new(
121
- @token, timeline, lists.first['id'], taskseries, task).invoke
122
- assert_equal(list_a['id'], list_d['id'])
123
- end
124
- end
125
- # vim:fdm=indent
@@ -1,83 +0,0 @@
1
- #
2
- # tests for RTM::API.
3
- #
4
- # see http://d.hatena.ne.jp/secondlife/20060927/1159334813
5
- #
6
-
7
- require File.dirname(__FILE__) + '/test_helper.rb'
8
-
9
- # fake class
10
- class TestAPI
11
- include RTM::API
12
-
13
- def initialize
14
- @method = 'rtm.test.echo'
15
- @param = {'method' => @method}
16
- end
17
-
18
- def parse_result(result)
19
- if result['stat'] == 'ok'
20
- [result['method'].first, result['stat']]
21
- else
22
- ["error", result['stat']]
23
- end
24
- end
25
- end # TestAPI
26
-
27
- class RTMAPITest < Test::Unit::TestCase
28
- CONFIG = File.dirname(__FILE__) + '/../config.dat' # config data file
29
-
30
- KEY = 'aaa' # XXX specify API key
31
- SEC = 'bbb' # XXX specify shared secret
32
-
33
- def setup
34
- conf = begin
35
- Marshal.load(open(CONFIG))
36
- rescue
37
- {
38
- :key => KEY,
39
- :sec => SEC,
40
- }
41
- end
42
-
43
- RTM::API.init(conf[:key], conf[:sec], conf)
44
- end
45
-
46
- def teardown
47
- end
48
-
49
- def test_get_auth_url
50
- def check_include(url)
51
- assert_equal(0, url =~ /http:\/\//)
52
- assert_equal(7, url =~ /www\.rememberthemilk\.com/)
53
- assert_not_nil(url =~ /api_key/)
54
- assert_not_nil(url =~ /perms/)
55
- assert_not_nil(url =~ /api_sig/)
56
- end
57
-
58
- url = RTM::API.get_auth_url('read')
59
- check_include(url)
60
-
61
- url = RTM::API.get_auth_url('delete', 'asb')
62
- check_include(url)
63
- assert_not_nil(url =~ /frob/)
64
-
65
- end
66
-
67
- def test_sign
68
- tapi = TestAPI.new
69
- signed = tapi.sign
70
- assert_equal(32, signed.length)
71
-
72
- signed = RTM::API.sign({'method' => 'get'})
73
- assert_equal(32, signed.length)
74
- end
75
-
76
- def test_invoke
77
- tapi = TestAPI.new
78
- res, err = tapi.invoke
79
- assert_equal('rtm.test.echo', res)
80
- assert_equal('ok', err)
81
- end
82
- end
83
- # vim:fdm=indent
@@ -1,80 +0,0 @@
1
- #
2
- # tests for rtm.rb
3
- #
4
- # see http://d.hatena.ne.jp/secondlife/20060927/1159334813
5
- #
6
- # $Id: test_rtm.rb 10 2006-12-30 06:37:24Z takayama $
7
- #
8
-
9
- require File.dirname(__FILE__) + '/test_helper.rb'
10
-
11
- class RTMTest < Test::Unit::TestCase
12
- CONFIG = File.dirname(__FILE__) + '/../config.dat' # config data file
13
-
14
- KEY = 'aaa' # XXX specify API key
15
- SEC = 'bbb' # XXX specify shared secret
16
- FROB = 'ccc' # XXX enter some frob
17
- TOKEN = 'ddd' # XXX enter some token
18
-
19
- def setup
20
- conf = begin
21
- Marshal.load(open(CONFIG))
22
- rescue
23
- {
24
- :key => KEY,
25
- :secret => SEC,
26
- :frob => FROB,
27
- :token => TOKEN }
28
- end
29
-
30
- RTM::API.init(conf)
31
- @contact = RTM::Contact.new(0)
32
- @group = RTM::Group.new
33
- @list = RTM::List.new(:id => 0)
34
- @lists = RTM::Lists.new
35
- end
36
-
37
- def test_instance
38
- assert_instance_of RTM::Contact, @contact
39
- assert_instance_of RTM::Group, @group
40
- assert_instance_of RTM::List, @list
41
- assert_instance_of RTM::Lists, @lists
42
- end
43
-
44
- # -----------------------------------------------------------------
45
- # Lists
46
- #
47
- def test_lists0
48
- assert_not_nil(@list)
49
- assert_not_nil(@lists)
50
- end
51
-
52
- def test_lists_add
53
- l = RTM::Lists.add('rtmilk test')
54
- assert_not_nil(l)
55
- end
56
-
57
- # -----------------------------------------------------------------
58
- # Tasks
59
- #
60
- def test_tasks_add
61
- t = RTM::Tasks.add('rtmilk test task to add', @lists[0].id)
62
- assert_not_nil(t)
63
- end
64
-
65
- def test_tasks_delete
66
- t = RTM::Tasks.add('rtmilk test task to delete', @lists[0].id)
67
- assert_not_nil(t)
68
-
69
- deleted = RTM::Tasks.delete(t.id, t.task.first.id, @lists[0].id)
70
- assert_not_nil(deleted)
71
- end
72
-
73
- # -----------------------------------------------------------------
74
- # TimeLine
75
- #
76
- def test_get_timeline
77
- timeline = RTM.get_timeline
78
- assert_not_nil(timeline)
79
- end
80
- end
@@ -1,88 +0,0 @@
1
- #
2
- # tests for RTM::Tasks API.
3
- #
4
-
5
- require File.dirname(__FILE__) + '/test_helper.rb'
6
-
7
- class RTMTasksAPITest < Test::Unit::TestCase
8
- CONFIG = File.dirname(__FILE__) + '/../config.dat' # config data file
9
-
10
- def setup
11
- conf = begin
12
- Marshal.load(open(CONFIG))
13
- rescue
14
- puts 'please run make_config.rb first.'
15
- exit
16
- end
17
-
18
- RTM::API.init(conf[:key], conf[:sec], conf)
19
- @perms = 'delete'
20
- @token = conf[:token]
21
- end
22
-
23
- def teardown
24
- end
25
-
26
- # -----------------------------------------------------------------
27
- # helper
28
- #
29
-
30
- # -----------------------------------------------------------------
31
- # tests
32
- #
33
- def not_test_getList
34
- lists, err = RTM::Tasks::GetList.new(@token).invoke
35
- assert_equal('ok', err)
36
- assert_instance_of(Array, lists)
37
- end
38
-
39
- def not_test_add
40
- timeline = RTM::Timelines::Create.new(@token).invoke
41
- assert_equal(7, timeline.length)
42
-
43
- lists, err = RTM::Lists::GetList.new(@token).invoke
44
- assert_equal('ok', err)
45
- assert_instance_of(Array, lists)
46
-
47
- list, err, transaction = RTM::Tasks::Add.new(
48
- @token, timeline, lists.first['id'], 'testTaskAdd').invoke
49
- assert_equal('ok', err)
50
- end
51
-
52
- def not_test_delete
53
- timeline = RTM::Timelines::Create.new(@token).invoke
54
- assert_equal(7, timeline.length)
55
-
56
- lists, err = RTM::Lists::GetList.new(@token).invoke
57
- assert_equal('ok', err)
58
- assert_instance_of(Array, lists)
59
-
60
- taskseries = '2855723' # XXX
61
- task = '4001630' # XXX
62
-
63
- list, err, transaction = RTM::Tasks::Delete.new(
64
- @token, timeline, lists.first['id'], taskseries, task).invoke
65
- assert_equal('ok', err)
66
- end
67
-
68
- def test_add_delete
69
- timeline = RTM::Timelines::Create.new(@token).invoke
70
- assert_equal(7, timeline.length)
71
-
72
- lists = RTM::Lists::GetList.new(@token).invoke
73
- assert_instance_of(Array, lists)
74
- list = lists.first['id']
75
-
76
- list_a, transaction_add = RTM::Tasks::Add.new(
77
- @token, timeline, list, 'testTaskAdd').invoke
78
-
79
- taskseries = list_a['taskseries'].first['id']
80
- task = list_a['taskseries'].first['task'].first['id']
81
-
82
- list_d, transaction = RTM::Tasks::Delete.new(
83
- @token, timeline, lists.first['id'], taskseries, task).invoke
84
- assert_equal(list_a['id'], list_d['id'])
85
- end
86
- end
87
-
88
- # vim:fdm=indent
@@ -1,3 +0,0 @@
1
- require 'test/unit'
2
- $LOAD_PATH << File.dirname(__FILE__) + '/../lib'
3
- require 'rtmilk'
@@ -1,44 +0,0 @@
1
- #
2
- # tests for RTM::Timelines API.
3
- #
4
-
5
- require File.dirname(__FILE__) + '/test_helper.rb'
6
-
7
- class RTMTimelinesAPITest < Test::Unit::TestCase
8
- CONFIG = File.dirname(__FILE__) + '/../config.dat' # config data file
9
-
10
- def setup
11
- conf = begin
12
- Marshal.load(open(CONFIG))
13
- rescue
14
- puts 'please run make_config.rb first.'
15
- exit
16
- end
17
-
18
- RTM::API.init(conf[:key], conf[:sec], conf)
19
- @token = conf[:token]
20
- end
21
-
22
- def teardown
23
- end
24
-
25
- # -----------------------------------------------------------------
26
- # helper
27
- #
28
-
29
- # -----------------------------------------------------------------
30
- # tests
31
- #
32
- def test_create
33
- timeline = RTM::Timelines::Create.new(@token).invoke
34
- assert_equal(7, timeline.length)
35
- end
36
-
37
- def test_instance
38
- timeline = RTM::Timeline.new(@token)
39
- assert_equal(7, timeline.length)
40
- end
41
- end
42
-
43
- # vim:fdm=indent
44
-