taskmapper-bcx 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,87 @@
1
+ module TaskMapper::Provider
2
+ module Bcx
3
+ class Ticket < TaskMapper::Provider::Base::Ticket
4
+ def initialize(*object)
5
+ object = object.first if object.is_a?(Array)
6
+ super object if object.is_a?(Hash)
7
+ end
8
+
9
+ def description
10
+ self[:content]
11
+ end
12
+
13
+ def description=(string)
14
+ self[:content] = string
15
+ end
16
+
17
+ def status
18
+ self[:completed] ? 'closed' : 'open'
19
+ end
20
+
21
+ def updated_at
22
+ begin
23
+ Time.parse(self[:updated_at])
24
+ rescue
25
+ self[:updated_at]
26
+ end
27
+ end
28
+
29
+ def save
30
+ api.update_todo self
31
+ end
32
+
33
+ def close
34
+ self[:completed] = true
35
+ save
36
+ end
37
+
38
+ def reopen
39
+ self[:completed] = false
40
+ save
41
+ end
42
+
43
+ def created_at
44
+ begin
45
+ Time.parse(self[:created_at])
46
+ rescue
47
+ self[:created_at]
48
+ end
49
+ end
50
+
51
+ class << self
52
+ def find_by_attributes(project_id, attributes = {})
53
+ search_by_attribute(self.find_all(project_id), attributes)
54
+ end
55
+
56
+ def find_all(project_id)
57
+ todos = api.todos project_id
58
+ todos = todos.select { |todo| todo.is_a?(Hash) }
59
+ todos.each { |t| t.merge!({:project_id => project_id})}
60
+ todos.collect { |todo| self.new todo }
61
+ end
62
+
63
+ def find_by_id(project_id, ticket_id)
64
+ todo = api.todo project_id, ticket_id
65
+ todo = Hash[todo].merge({:project_id => project_id})
66
+ self.new todo
67
+ end
68
+
69
+ def create(attributes)
70
+ todo = api.create_todo attributes
71
+ todo = Hash[todo].merge({:project_id => attributes[:project_id]})
72
+ self.new todo
73
+ end
74
+
75
+ private
76
+ def api
77
+ TaskMapper::Provider::Bcx.api
78
+ end
79
+ end
80
+
81
+ private
82
+ def api
83
+ TaskMapper::Provider::Bcx.api
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,7 @@
1
+ class TaskMapper
2
+ module Provider
3
+ module Bcx
4
+ VERSION = "0.0.1" unless defined?(Bcx::VERSION)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'time'
2
+
3
+ require 'taskmapper'
4
+
5
+ require 'provider/api'
6
+ require 'provider/bcx'
7
+ require 'provider/project'
8
+ require 'provider/ticket'
9
+ require 'provider/comment'
10
+ require 'provider/version'
File without changes
@@ -0,0 +1 @@
1
+ There's no Basecamp account at this address. Sign in to Launchpad to see your accounts.
@@ -0,0 +1,20 @@
1
+ {
2
+ "id": 149087659,
3
+ "identity_id": 982871737,
4
+ "name": "Jason Fried",
5
+ "email_address": "jason@37signals.com",
6
+ "admin": true,
7
+ "avatar_url": "https://asset0.37img.com/global/4113d0a133a32931be8934e70b2ea21efeff72c1/avatar.96.gif?r=3",
8
+ "created_at": "2012-03-22T16:56:51-05:00",
9
+ "updated_at": "2012-03-23T13:55:43-05:00",
10
+ "events": {
11
+ "count": 19,
12
+ "updated_at": "2012-03-23T13:55:43-05:00",
13
+ "url": "https://basecamp.com/999999999/api/v1/people/149087659-jason-fried/events.json"
14
+ },
15
+ "assigned_todos": {
16
+ "count": 80,
17
+ "updated_at": "2013-06-26T16:22:05.000-04:00",
18
+ "url": "https://basecamp.com/999999999/api/v1/people/149087659-jason-fried/assigned_todos.json"
19
+ }
20
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": 1028592764,
3
+ "content": "New Comment!",
4
+ "created_at": "2012-03-22T16:56:48-05:00",
5
+ "updated_at": "2012-03-22T16:56:48-05:00",
6
+ "creator": {
7
+ "id": 149087659,
8
+ "name": "Jason Fried",
9
+ "avatar_url": "https://asset0.37img.com/global/4113d0a133a32931be8934e70b2ea21efeff72c1/avatar.96.gif?r=3"
10
+ },
11
+ "topic_url": "https://basecamp.com/9999999/api/v1/messages/888888.json"
12
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "id": 2,
3
+ "todolist_id": 968316918,
4
+ "position": 1,
5
+ "content": "A New Ticket",
6
+ "completed": false,
7
+ "due_at": "2012-03-27",
8
+ "created_at": "2012-03-24T09:53:35-05:00",
9
+ "updated_at": "2012-03-24T10:56:33-05:00",
10
+ "comments_count": 1,
11
+ "creator": {
12
+ "id": 127326141,
13
+ "name": "David Heinemeier Hansson",
14
+ "avatar_url": "https://asset0.37img.com/global/9d2148cb8ed8e2e8ecbc625dd1cbe7691896c7d9/avatar.96.gif?r=3"
15
+ },
16
+ "assignee": {
17
+ "id": 149087659,
18
+ "type": "Person",
19
+ "name": "Jason Fried"
20
+ },
21
+ "comments": [
22
+ {
23
+ "id": 1028592764,
24
+ "content": "+1",
25
+ "created_at": "2012-03-24T09:53:34-05:00",
26
+ "updated_at": "2012-03-24T09:53:34-05:00",
27
+ "creator": {
28
+ "id": 127326141,
29
+ "name": "David Heinemeier Hansson",
30
+ "avatar_url": "https://asset0.37img.com/global/9d2148cb8ed8e2e8ecbc625dd1cbe7691896c7d9/avatar.96.gif?r=3"
31
+ }
32
+ }
33
+ ],
34
+ "subscribers": [
35
+ {
36
+ "id": 149087659,
37
+ "name": "Jason Fried"
38
+ },
39
+ {
40
+ "id": 1071630348,
41
+ "name": "Jeremy Kemper"
42
+ }
43
+ ]
44
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "id": 605816632,
3
+ "name": "BCX",
4
+ "description": "The Next Generation",
5
+ "archived": false,
6
+ "created_at": "2012-03-22T16:56:51-05:00",
7
+ "updated_at": "2012-03-23T13:55:43-05:00",
8
+ "starred": true,
9
+ "creator": {
10
+ "id": 149087659,
11
+ "name": "Jason Fried",
12
+ "avatar_url": "https://asset0.37img.com/global/4113d0a133a32931be8934e70b2ea21efeff72c1/avatar.96.gif?r=3"
13
+ },
14
+ "accesses": {
15
+ "count": 5,
16
+ "updated_at": "2012-03-23T13:55:43-05:00",
17
+ "url": "https://basecamp.com/999999999/api/v1/projects/605816632-bcx/accesses.json"
18
+ },
19
+ "attachments": {
20
+ "count": 0,
21
+ "updated_at": null,
22
+ "url": "https://basecamp.com/999999999/api/v1/projects/605816632-bcx/attachments.json"
23
+ },
24
+ "calendar_events": {
25
+ "count": 3,
26
+ "updated_at": "2012-03-22T17:35:50-05:00",
27
+ "url": "https://basecamp.com/999999999/api/v1/projects/605816632-bcx/calendar_events.json"
28
+ },
29
+ "documents": {
30
+ "count": 0,
31
+ "updated_at": null,
32
+ "url": "https://basecamp.com/999999999/api/v1/projects/605816632-bcx/documents.json"
33
+ },
34
+ "topics": {
35
+ "count": 2,
36
+ "updated_at": "2012-03-22T17:35:50-05:00",
37
+ "url": "https://basecamp.com/999999999/api/v1/projects/605816632-bcx/topics.json"
38
+ },
39
+ "todolists": {
40
+ "remaining_count": 4,
41
+ "completed_count": 0,
42
+ "updated_at": "2012-03-23T12:59:23-05:00",
43
+ "url": "https://basecamp.com/999999999/api/v1/projects/605816632-bcx/todolists.json"
44
+ }
45
+ }
@@ -0,0 +1,20 @@
1
+ [
2
+ {
3
+ "id": 605816632,
4
+ "name": "BCX",
5
+ "description": "The Next Generation",
6
+ "updated_at": "2012-03-23T13:55:43-05:00",
7
+ "url": "https://basecamp.com/999999999/api/v1/projects/605816632-bcx.json",
8
+ "archived": false,
9
+ "starred": true
10
+ },
11
+ {
12
+ "id": 684146117,
13
+ "name": "Nothing here!",
14
+ "description": null,
15
+ "updated_at": "2012-03-22T16:56:51-05:00",
16
+ "url": "https://basecamp.com/999999999/api/v1/projects/684146117-nothing-here.json",
17
+ "archived": false,
18
+ "starred": false
19
+ }
20
+ ]
@@ -0,0 +1,44 @@
1
+ {
2
+ "id": 1,
3
+ "todolist_id": 1000,
4
+ "position": 1,
5
+ "content": "Design it",
6
+ "completed": false,
7
+ "due_at": "2012-03-27",
8
+ "created_at": "2012-03-24T09:53:35-05:00",
9
+ "updated_at": "2012-03-24T10:56:33-05:00",
10
+ "comments_count": 1,
11
+ "creator": {
12
+ "id": 127326141,
13
+ "name": "David Heinemeier Hansson",
14
+ "avatar_url": "https://asset0.37img.com/global/9d2148cb8ed8e2e8ecbc625dd1cbe7691896c7d9/avatar.96.gif?r=3"
15
+ },
16
+ "assignee": {
17
+ "id": 149087659,
18
+ "type": "Person",
19
+ "name": "Jason Fried"
20
+ },
21
+ "comments": [
22
+ {
23
+ "id": 1028592764,
24
+ "content": "+1",
25
+ "created_at": "2012-03-24T09:53:34-05:00",
26
+ "updated_at": "2012-03-24T09:53:34-05:00",
27
+ "creator": {
28
+ "id": 127326141,
29
+ "name": "David Heinemeier Hansson",
30
+ "avatar_url": "https://asset0.37img.com/global/9d2148cb8ed8e2e8ecbc625dd1cbe7691896c7d9/avatar.96.gif?r=3"
31
+ }
32
+ }
33
+ ],
34
+ "subscribers": [
35
+ {
36
+ "id": 149087659,
37
+ "name": "Jason Fried"
38
+ },
39
+ {
40
+ "id": 1071630348,
41
+ "name": "Jeremy Kemper"
42
+ }
43
+ ]
44
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "id": 2,
3
+ "todolist_id": 1000,
4
+ "position": 2,
5
+ "content": "Test it",
6
+ "completed": false,
7
+ "due_at": "2012-03-27",
8
+ "created_at": "2012-03-24T09:53:35-05:00",
9
+ "updated_at": "2012-03-24T10:56:33-05:00",
10
+ "comments_count": 1,
11
+ "creator": {
12
+ "id": 127326141,
13
+ "name": "David Heinemeier Hansson",
14
+ "avatar_url": "https://asset0.37img.com/global/9d2148cb8ed8e2e8ecbc625dd1cbe7691896c7d9/avatar.96.gif?r=3"
15
+ },
16
+ "assignee": {
17
+ "id": 149087659,
18
+ "type": "Person",
19
+ "name": "Jason Fried"
20
+ },
21
+ "comments": [
22
+ {
23
+ "id": 1028592764,
24
+ "content": "+1",
25
+ "created_at": "2012-03-24T09:53:34-05:00",
26
+ "updated_at": "2012-03-24T09:53:34-05:00",
27
+ "creator": {
28
+ "id": 127326141,
29
+ "name": "David Heinemeier Hansson",
30
+ "avatar_url": "https://asset0.37img.com/global/9d2148cb8ed8e2e8ecbc625dd1cbe7691896c7d9/avatar.96.gif?r=3"
31
+ }
32
+ }
33
+ ],
34
+ "subscribers": [
35
+ {
36
+ "id": 149087659,
37
+ "name": "Jason Fried"
38
+ },
39
+ {
40
+ "id": 1071630348,
41
+ "name": "Jeremy Kemper"
42
+ }
43
+ ]
44
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "id": 3,
3
+ "todolist_id": 1000,
4
+ "position": 3,
5
+ "content": "Think of it",
6
+ "completed": true,
7
+ "due_at": "2012-03-27",
8
+ "created_at": "2012-03-24T09:53:35-05:00",
9
+ "updated_at": "2012-03-24T10:56:33-05:00",
10
+ "completed_at": "2012-03-24T09:59:35-05:00",
11
+ "comments_count": 1,
12
+ "creator": {
13
+ "id": 127326141,
14
+ "name": "David Heinemeier Hansson",
15
+ "avatar_url": "https://asset0.37img.com/global/9d2148cb8ed8e2e8ecbc625dd1cbe7691896c7d9/avatar.96.gif?r=3"
16
+ },
17
+ "completer": {
18
+ "id": 149087659,
19
+ "name": "Jason Fried"
20
+ },
21
+ "assignee": {
22
+ "id": 149087659,
23
+ "type": "Person",
24
+ "name": "Jason Fried"
25
+ },
26
+ "comments": [
27
+ {
28
+ "id": 1028592764,
29
+ "content": "+1",
30
+ "created_at": "2012-03-24T09:53:34-05:00",
31
+ "updated_at": "2012-03-24T09:53:34-05:00",
32
+ "creator": {
33
+ "id": 127326141,
34
+ "name": "David Heinemeier Hansson",
35
+ "avatar_url": "https://asset0.37img.com/global/9d2148cb8ed8e2e8ecbc625dd1cbe7691896c7d9/avatar.96.gif?r=3"
36
+ }
37
+ }
38
+ ],
39
+ "subscribers": [
40
+ {
41
+ "id": 149087659,
42
+ "name": "Jason Fried"
43
+ },
44
+ {
45
+ "id": 1071630348,
46
+ "name": "Jeremy Kemper"
47
+ }
48
+ ]
49
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "id": 968316918,
3
+ "name": "Launch list",
4
+ "description": "What we need for launch!",
5
+ "created_at": "2012-03-24T09:53:35-05:00",
6
+ "updated_at": "2012-03-24T09:59:35-05:00",
7
+ "completed": false,
8
+ "position": 1,
9
+ "completed_count": 3,
10
+ "remaining_count": 5,
11
+ "creator": {
12
+ "id": 127326141,
13
+ "name": "David Heinemeier Hansson",
14
+ "avatar_url": "https://asset0.37img.com/global/9d2148cb8ed8e2e8ecbc625dd1cbe7691896c7d9/avatar.96.gif?r=3"
15
+ },
16
+ "todos": {
17
+ "remaining": [
18
+ {
19
+ "id": 1,
20
+ "content": "Design it",
21
+ "due_at": "2012-03-24",
22
+ "comments_count": 0,
23
+ "created_at": "2012-03-24T09:53:35-05:00",
24
+ "updated_at": "2012-03-24T09:55:52-05:00",
25
+ "assignee": {
26
+ "id": 149087659,
27
+ "type": "Person",
28
+ "name": "Jason Fried"
29
+ },
30
+ "position": 1,
31
+ "url": "https://basecamp.com/999999999/api/v1/projects/605816632-bcx/todos/223304243-design-it.json"
32
+ },
33
+ {
34
+ "id": 2,
35
+ "content": "Test it",
36
+ "due_at": null,
37
+ "comments_count": 0,
38
+ "created_at": "2012-03-24T09:53:35-05:00",
39
+ "updated_at": "2012-03-24T09:53:35-05:00",
40
+ "assignee": {},
41
+ "position": 2,
42
+ "url": "https://basecamp.com/999999999/api/v1/projects/605816632-bcx/todos/411008527-test-it.json"
43
+ }
44
+ ],
45
+ "completed": [
46
+ {
47
+ "id": 3,
48
+ "content": "Think of it",
49
+ "due_at": null,
50
+ "comments_count": 0,
51
+ "created_at": "2012-03-24T09:59:33-05:00",
52
+ "updated_at": "2012-03-24T09:59:35-05:00",
53
+ "completed_at": "2012-03-24T09:59:35-05:00",
54
+ "url": "https://basecamp.com/999999999/api/v1/projects/605816632-bcx/todos/1046098401-think-of-it.json",
55
+ "assignee": {},
56
+ "position": 3,
57
+ "completer": {
58
+ "id": 149087659,
59
+ "name": "Jason Fried"
60
+ }
61
+ }
62
+ ]
63
+ },
64
+ "comments": [
65
+ {
66
+ "id": 1028592764,
67
+ "content": "+1",
68
+ "created_at": "2012-03-24T09:53:34-05:00",
69
+ "updated_at": "2012-03-24T09:53:34-05:00",
70
+ "creator": {
71
+ "id": 127326141,
72
+ "name": "David Heinemeier Hansson",
73
+ "avatar_url": "https://asset0.37img.com/global/9d2148cb8ed8e2e8ecbc625dd1cbe7691896c7d9/avatar.96.gif?r=3"
74
+ }
75
+ }
76
+ ],
77
+ "subscribers": [
78
+ {
79
+ "id": 149087659,
80
+ "name": "Jason Fried"
81
+ },
82
+ {
83
+ "id": 1071630348,
84
+ "name": "Jeremy Kemper"
85
+ }
86
+ ]
87
+ }