teamwork_api 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +11 -1
  4. data/.travis.yml +14 -1
  5. data/CHANGELOG.md +14 -0
  6. data/Gemfile +4 -2
  7. data/Gemfile.lock +65 -10
  8. data/Guardfile +12 -0
  9. data/README.md +5 -5
  10. data/Rakefile +2 -0
  11. data/lib/teamwork_api.rb +3 -0
  12. data/lib/teamwork_api/api/companies.rb +4 -0
  13. data/lib/teamwork_api/api/params.rb +18 -11
  14. data/lib/teamwork_api/api/people.rb +52 -29
  15. data/lib/teamwork_api/api/project_owner.rb +6 -1
  16. data/lib/teamwork_api/api/projects.rb +70 -47
  17. data/lib/teamwork_api/api/task_lists.rb +8 -4
  18. data/lib/teamwork_api/client.rb +24 -20
  19. data/lib/teamwork_api/error.rb +7 -1
  20. data/lib/teamwork_api/version.rb +3 -1
  21. data/spec/fixtures/companies.json +64 -0
  22. data/spec/fixtures/company.json +32 -0
  23. data/spec/fixtures/create_project.json +4 -0
  24. data/spec/fixtures/create_task_list.json +4 -0
  25. data/spec/fixtures/delete.json +3 -0
  26. data/spec/fixtures/people.json +80 -0
  27. data/spec/fixtures/person.json +77 -0
  28. data/spec/fixtures/project.json +68 -0
  29. data/spec/fixtures/project_owner.json +91 -0
  30. data/spec/fixtures/projects.json +135 -0
  31. data/spec/fixtures/task_list.json +18 -0
  32. data/spec/fixtures/task_lists.json +22 -0
  33. data/spec/fixtures/update.json +3 -0
  34. data/spec/spec_helper.rb +60 -7
  35. data/spec/teamwork_api/api/companies_spec.rb +69 -0
  36. data/spec/teamwork_api/api/people_spec.rb +78 -0
  37. data/spec/teamwork_api/api/project_owner_spec.rb +35 -0
  38. data/spec/teamwork_api/api/projects_spec.rb +117 -0
  39. data/spec/teamwork_api/api/task_lists_spec.rb +98 -0
  40. data/spec/teamwork_api/client_spec.rb +202 -0
  41. data/teamwork_api.gemspec +10 -2
  42. metadata +116 -8
  43. data/spec/teamwork_api_spec.rb +0 -9
@@ -0,0 +1,77 @@
1
+ {
2
+ "STATUS": "OK",
3
+ "person": {
4
+ "marketoId": "0",
5
+ "permissions": {
6
+ "can-access-templates": false,
7
+ "can-add-projects": false,
8
+ "can-manage-people": false
9
+ },
10
+ "avatar-url": "",
11
+ "last-changed-on": "2018-08-09T14:21:19Z",
12
+ "email-address": "d2@demo1company.com",
13
+ "last-login": "",
14
+ "documentEditorInstalled": false,
15
+ "user-name": "d2@demo1company.com",
16
+ "id": "1",
17
+ "phone-number-fax": "",
18
+ "site-owner": false,
19
+ "company-name": "Company",
20
+ "user-invited-date": "",
21
+ "user-type": "collaborator",
22
+ "phone-number-mobile": "",
23
+ "openId": "",
24
+ "address": {
25
+ "city": "",
26
+ "country": "",
27
+ "countrycode": "",
28
+ "zipcode": "",
29
+ "state": "",
30
+ "line1": "",
31
+ "line2": ""
32
+ },
33
+ "phone-number-office": "",
34
+ "im-handle": "",
35
+ "twoFactorAuthEnabled": false,
36
+ "tags": [],
37
+ "has-access-to-new-projects": false,
38
+ "im-service": "",
39
+ "deleted": false,
40
+ "notes": "",
41
+ "in-owner-company": "1",
42
+ "profile": "",
43
+ "user-invited-status": "PENDING",
44
+ "userUUID": "",
45
+ "user-invited": "2",
46
+ "created-at": "2018-06-14T14:07:29Z",
47
+ "companyId": "1",
48
+ "has-desk-account": true,
49
+ "integrations": {
50
+ "microsoftConnector": {
51
+ "enabled": false
52
+ }
53
+ },
54
+ "phone-number-home": "",
55
+ "profile-text": "",
56
+ "private-notes-text": "",
57
+ "company-id": "1",
58
+ "pid": "",
59
+ "phone-number-mobile-parts": {
60
+ "countryCode": "",
61
+ "prefix": "",
62
+ "phone": ""
63
+ },
64
+ "login-count": "0",
65
+ "private-notes": "",
66
+ "email-alt-1": "",
67
+ "administrator": false,
68
+ "email-alt-2": "",
69
+ "email-alt-3": "",
70
+ "last-name": "User",
71
+ "title": "",
72
+ "first-name": "Demo 2",
73
+ "phone-number-office-ext": "",
74
+ "twitter": "",
75
+ "lengthOfDay": "8.0"
76
+ }
77
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "project": {
3
+ "replyByEmailEnabled": true,
4
+ "starred": false,
5
+ "show-announcement": false,
6
+ "harvest-timers-enabled": false,
7
+ "subStatus": "current",
8
+ "status": "active",
9
+ "defaultPrivacy": "open",
10
+ "integrations": {
11
+ "xero": {
12
+ "countrycode": "",
13
+ "enabled": false,
14
+ "connected": "NO",
15
+ "organisation": "",
16
+ "basecurrency": ""
17
+ },
18
+ "microsoftConnectors": {
19
+ "enabled": false
20
+ },
21
+ "onedrivebusiness": {
22
+ "enabled": false
23
+ }
24
+ },
25
+ "created-on": "2018-03-22T09:44:27Z",
26
+ "filesAutoNewVersion": false,
27
+ "category": {
28
+ "name": "",
29
+ "id": "",
30
+ "color": ""
31
+ },
32
+ "tags": [],
33
+ "overview-start-page": "activity",
34
+ "logo": "",
35
+ "startDate": "",
36
+ "id": "1",
37
+ "last-changed-on": "2018-07-25T08:56:54Z",
38
+ "type": "normal",
39
+ "endDate": "",
40
+ "company": {
41
+ "name": "Teamwork.com",
42
+ "id": "1"
43
+ },
44
+ "tasks-start-page": "list",
45
+ "active-pages": {
46
+ "links": "1",
47
+ "tasks": "1",
48
+ "time": "0",
49
+ "billing": "1",
50
+ "notebooks": "1",
51
+ "files": "1",
52
+ "comments": "1",
53
+ "riskRegister": "0",
54
+ "milestones": "1",
55
+ "messages": "1"
56
+ },
57
+ "name": "API Documentation",
58
+ "privacyEnabled": false,
59
+ "description": "",
60
+ "logoFromCompany": true,
61
+ "directFileUploadsEnabled": true,
62
+ "start-page": "tasks",
63
+ "skipWeekends": false,
64
+ "notifyeveryone": false,
65
+ "boardData": {}
66
+ },
67
+ "STATUS": "OK"
68
+ }
@@ -0,0 +1,91 @@
1
+ {
2
+ "project": {
3
+ "replyByEmailEnabled": true,
4
+ "starred": false,
5
+ "show-announcement": false,
6
+ "harvest-timers-enabled": false,
7
+ "subStatus": "current",
8
+ "status": "active",
9
+ "integrations": {
10
+ "xero": {
11
+ "countrycode": "",
12
+ "enabled": false,
13
+ "connected": "NO",
14
+ "organisation": "",
15
+ "basecurrency": ""
16
+ },
17
+ "microsoftConnectors": {
18
+ "enabled": false
19
+ },
20
+ "onedrivebusiness": {
21
+ "enabled": false
22
+ }
23
+ },
24
+ "defaultPrivacy": "open",
25
+ "owner": {
26
+ "avatarUrl": "",
27
+ "firstName": "Holly",
28
+ "fullName": "Holly Bracken",
29
+ "id": "1",
30
+ "lastName": "Bracken"
31
+ },
32
+ "created-on": "2018-03-28T10:18:21Z",
33
+ "filesAutoNewVersion": false,
34
+ "category": {
35
+ "name": "",
36
+ "id": "",
37
+ "color": ""
38
+ },
39
+ "tags": [],
40
+ "overview-start-page": "default",
41
+ "logo": "9.png",
42
+ "startDate": "",
43
+ "id": "1",
44
+ "last-changed-on": "2018-07-20T15:18:54Z",
45
+ "type": "normal",
46
+ "endDate": "",
47
+ "company": {
48
+ "name": "Marketing Ltd.",
49
+ "id": "1"
50
+ },
51
+ "tasks-start-page": "default",
52
+ "active-pages": {
53
+ "links": "1",
54
+ "tasks": "1",
55
+ "time": "1",
56
+ "billing": "1",
57
+ "notebooks": "1",
58
+ "files": "1",
59
+ "comments": "1",
60
+ "riskRegister": "0",
61
+ "milestones": "1",
62
+ "messages": "1"
63
+ },
64
+ "name": "Holly's testing Project",
65
+ "privacyEnabled": false,
66
+ "description": "",
67
+ "announcement": "",
68
+ "logoFromCompany": true,
69
+ "directFileUploadsEnabled": true,
70
+ "start-page": "tasks",
71
+ "skipWeekends": false,
72
+ "notifyeveryone": false,
73
+ "boardData": {
74
+ "board": {
75
+ "name": "1",
76
+ "id": "1",
77
+ "color": "#BDC3C7"
78
+ },
79
+ "card": {
80
+ "id": "1"
81
+ },
82
+ "column": {
83
+ "name": "1",
84
+ "id": "1",
85
+ "color": "#8E44AD"
86
+ }
87
+ },
88
+ "announcementHTML": ""
89
+ },
90
+ "STATUS": "OK"
91
+ }
@@ -0,0 +1,135 @@
1
+ {
2
+ "STATUS": "OK",
3
+ "projects": [
4
+ {
5
+ "startDate": "",
6
+ "last-changed-on": "2019-01-03T11:46:14Z",
7
+ "logo": "",
8
+ "created-on": "2018-12-12T10:04:47Z",
9
+ "privacyEnabled": false,
10
+ "status": "active",
11
+ "boardData": {},
12
+ "replyByEmailEnabled": true,
13
+ "harvest-timers-enabled": false,
14
+ "description": "",
15
+ "category": {
16
+ "color": "",
17
+ "id": "",
18
+ "name": ""
19
+ },
20
+ "id": "322852",
21
+ "overview-start-page": "default",
22
+ "start-page": "projectoverview",
23
+ "integrations": {
24
+ "xero": {
25
+ "basecurrency": "",
26
+ "countrycode": "",
27
+ "enabled": false,
28
+ "connected": "NO",
29
+ "organisation": ""
30
+ },
31
+ "sharepoint": {
32
+ "account": "",
33
+ "foldername": "root",
34
+ "enabled": false,
35
+ "folder": "root"
36
+ },
37
+ "microsoftConnectors": {
38
+ "enabled": false
39
+ },
40
+ "onedrivebusiness": {
41
+ "account": "",
42
+ "foldername": "root",
43
+ "enabled": false,
44
+ "folder": "root"
45
+ }
46
+ },
47
+ "defaults": {
48
+ "privacy": ""
49
+ },
50
+ "notifyeveryone": false,
51
+ "filesAutoNewVersion": false,
52
+ "defaultPrivacy": "open",
53
+ "tasks-start-page": "default",
54
+ "starred": false,
55
+ "announcementHTML": "",
56
+ "isProjectAdmin": true,
57
+ "name": "Project 2",
58
+ "company": {
59
+ "is-owner": "1",
60
+ "id": "78494",
61
+ "name": "MCG Company"
62
+ },
63
+ "endDate": "",
64
+ "announcement": "",
65
+ "show-announcement": false,
66
+ "subStatus": "current",
67
+ "tags": []
68
+ },
69
+ {
70
+ "startDate": "",
71
+ "last-changed-on": "2018-12-11T17:52:57Z",
72
+ "logo": "",
73
+ "created-on": "2018-11-26T11:11:00Z",
74
+ "privacyEnabled": false,
75
+ "status": "active",
76
+ "boardData": {},
77
+ "replyByEmailEnabled": true,
78
+ "harvest-timers-enabled": false,
79
+ "description": "",
80
+ "category": {
81
+ "color": "",
82
+ "id": "",
83
+ "name": ""
84
+ },
85
+ "id": "321041",
86
+ "overview-start-page": "default",
87
+ "start-page": "projectoverview",
88
+ "integrations": {
89
+ "xero": {
90
+ "basecurrency": "",
91
+ "countrycode": "",
92
+ "enabled": false,
93
+ "connected": "NO",
94
+ "organisation": ""
95
+ },
96
+ "sharepoint": {
97
+ "account": "",
98
+ "foldername": "root",
99
+ "enabled": false,
100
+ "folder": "root"
101
+ },
102
+ "microsoftConnectors": {
103
+ "enabled": false
104
+ },
105
+ "onedrivebusiness": {
106
+ "account": "",
107
+ "foldername": "root",
108
+ "enabled": false,
109
+ "folder": "root"
110
+ }
111
+ },
112
+ "defaults": {
113
+ "privacy": ""
114
+ },
115
+ "notifyeveryone": false,
116
+ "filesAutoNewVersion": false,
117
+ "defaultPrivacy": "open",
118
+ "tasks-start-page": "default",
119
+ "starred": false,
120
+ "announcementHTML": "",
121
+ "isProjectAdmin": true,
122
+ "name": "Project One",
123
+ "company": {
124
+ "is-owner": "1",
125
+ "id": "78494",
126
+ "name": "MCG Company"
127
+ },
128
+ "endDate": "",
129
+ "announcement": "",
130
+ "show-announcement": false,
131
+ "subStatus": "current",
132
+ "tags": []
133
+ }
134
+ ]
135
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "todo-list": {
3
+ "projectid": "999",
4
+ "name": "Inbox",
5
+ "description": "",
6
+ "milestone-id": "",
7
+ "uncompleted-count": "1",
8
+ "complete": false,
9
+ "private": "0",
10
+ "overdue-count": "0",
11
+ "project-name": "demo",
12
+ "pinned": false,
13
+ "id": "999",
14
+ "position": "3999",
15
+ "completed-count": "1"
16
+ },
17
+ "STATUS": "OK"
18
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "STATUS": "OK",
3
+ "tasklists": [
4
+ {
5
+ "id": "1",
6
+ "name": "task list 1",
7
+ "description": "",
8
+ "position": 1,
9
+ "projectId": "1",
10
+ "projectName": "My testing project",
11
+ "updatedAfter": "2018-09-13T14:57:03Z",
12
+ "private": false,
13
+ "isTemplate": false,
14
+ "tags": [],
15
+ "milestone-id": "",
16
+ "pinned": false,
17
+ "complete": false,
18
+ "uncompleted-count": 17,
19
+ "status": "new"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "STATUS": "OK"
3
+ }
@@ -1,14 +1,67 @@
1
- require 'bundler/setup'
2
- require 'teamwork_api'
1
+ # frozen_string_literal: true
3
2
 
4
- RSpec.configure do |config|
5
- # Enable flags like --only-failures and --next-failure
6
- config.example_status_persistence_file_path = '.rspec_status'
3
+ require 'simplecov'
4
+
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
6
+ [SimpleCov::Formatter::HTMLFormatter]
7
+ )
8
+
9
+ SimpleCov.start do
10
+ add_filter '/spec/'
11
+ end
7
12
 
8
- # Disable RSpec exposing methods globally on `Module` and `main`
9
- config.disable_monkey_patching!
13
+ require 'teamwork_api'
14
+ require 'rspec'
15
+ require 'webmock/rspec'
10
16
 
17
+ RSpec.configure do |config|
11
18
  config.expect_with :rspec do |c|
12
19
  c.syntax = :expect
13
20
  end
14
21
  end
22
+
23
+ WebMock.disable_net_connect!(allow_localhost: true)
24
+
25
+ def a_delete(path)
26
+ a_request(:delete, path)
27
+ end
28
+
29
+ def a_get(path)
30
+ a_request(:get, path)
31
+ end
32
+
33
+ def a_post(path)
34
+ a_request(:post, path)
35
+ end
36
+
37
+ def a_put(path)
38
+ a_request(:put, path)
39
+ end
40
+
41
+ def stub_delete(path)
42
+ stub_request(:delete, path)
43
+ end
44
+
45
+ def stub_get(path)
46
+ stub_request(:get, path)
47
+ end
48
+
49
+ def stub_post(path)
50
+ stub_request(:post, path)
51
+ end
52
+
53
+ def stub_put(path)
54
+ stub_request(:put, path)
55
+ end
56
+
57
+ def fixture_path
58
+ File.expand_path('fixtures', __dir__)
59
+ end
60
+
61
+ def fixture(file)
62
+ File.new(fixture_path + '/' + file)
63
+ end
64
+
65
+ def escape_params(params)
66
+ params.map { |k, v| [CGI.escape(k), v].join('=') }.join('&')
67
+ end