wrike3 0.3.3 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wrike3/account.rb +6 -6
- data/lib/wrike3/attachment.rb +9 -9
- data/lib/wrike3/base.rb +15 -12
- data/lib/wrike3/comment.rb +9 -9
- data/lib/wrike3/contact.rb +4 -4
- data/lib/wrike3/folder.rb +8 -8
- data/lib/wrike3/task.rb +10 -10
- data/lib/wrike3/timelog.rb +10 -10
- data/lib/wrike3/user.rb +4 -4
- data/lib/wrike3/version.rb +1 -1
- data/lib/wrike3/workflow.rb +8 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6730c885c7485faeecd911bd9507eca5ec2e4e78
|
4
|
+
data.tar.gz: 19a45be13b7f254c1a4b8ebed370528f85ce2ac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 521c81c0174a56a342009fe6435fcdd763d80aaf452d02a9c1fd498dea8bb991a7cb9c8e1234e08373c209a29a02466ac16af78a2a1b69fbc88478cd1d36548d
|
7
|
+
data.tar.gz: 728d95421482246b203150fb287d0e33d0b89353439f3f34dde13e6d91e640e046d8ea406ea83b793c455d5d6ffeceab8ef76413b954dd4f1807fa30535fa817
|
data/lib/wrike3/account.rb
CHANGED
@@ -7,17 +7,17 @@ module Wrike3
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# Get account list
|
10
|
-
def list(
|
11
|
-
wrike.execute(:get, api_url('accounts'),
|
10
|
+
def list(params = {})
|
11
|
+
wrike.execute(:get, api_url('accounts'), params)
|
12
12
|
end
|
13
13
|
|
14
|
-
def details(id,
|
15
|
-
wrike.execute(:get, api_url("accounts/#{id}"),
|
14
|
+
def details(id, params = {})
|
15
|
+
wrike.execute(:get, api_url("accounts/#{id}"), params)
|
16
16
|
end
|
17
17
|
|
18
18
|
# Update account
|
19
|
-
def update(id,
|
20
|
-
wrike.execute(:put, api_url("accounts/#{id}"),
|
19
|
+
def update(id, params = {})
|
20
|
+
wrike.execute(:put, api_url("accounts/#{id}"), params)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/wrike3/attachment.rb
CHANGED
@@ -6,29 +6,29 @@ module Wrike3
|
|
6
6
|
@wrike = wrike
|
7
7
|
end
|
8
8
|
|
9
|
-
def list(attachable_type = nil, attachable_id = nil,
|
10
|
-
wrike.execute(:get, api_url(nested_path('attachments', attachable_type, attachable_id)),
|
9
|
+
def list(attachable_type = nil, attachable_id = nil, params = {})
|
10
|
+
wrike.execute(:get, api_url(nested_path('attachments', attachable_type, attachable_id)), params)
|
11
11
|
end
|
12
12
|
|
13
13
|
# Get attachment details
|
14
|
-
def details(id,
|
15
|
-
wrike.execute(:get, api_url("attachments/#{id}"),
|
14
|
+
def details(id, params = {})
|
15
|
+
wrike.execute(:get, api_url("attachments/#{id}"), params)
|
16
16
|
end
|
17
17
|
|
18
18
|
# Upload attachment for specified task
|
19
|
-
def upload(attachable_type, attachable_id, stream
|
19
|
+
def upload(attachable_type, attachable_id, stream)
|
20
20
|
body, headers = http_multipart_data({:stream => stream})
|
21
21
|
wrike.execute(:post, api_url(nested_path('attachments', attachable_type, attachable_id)), body, headers)
|
22
22
|
end
|
23
23
|
|
24
24
|
# Get file binary stream
|
25
|
-
def download(id,
|
26
|
-
wrike.execute(:get, api_url("attachments/#{id}/download"),
|
25
|
+
def download(id, params = {})
|
26
|
+
wrike.execute(:get, api_url("attachments/#{id}/download"), params)
|
27
27
|
end
|
28
28
|
|
29
29
|
# Delete attachments
|
30
|
-
def delete(id,
|
31
|
-
wrike.execute(:delete, api_url("attachments/#{id}"),
|
30
|
+
def delete(id, params = {})
|
31
|
+
wrike.execute(:delete, api_url("attachments/#{id}"), params)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/wrike3/base.rb
CHANGED
@@ -58,24 +58,27 @@ module Wrike3
|
|
58
58
|
@token ||= Wrike3::Token.new(self)
|
59
59
|
end
|
60
60
|
|
61
|
-
def auth_headers(options = {})
|
62
|
-
options.merge!('Authorization' => "Bearer #{Wrike3.access_token}")
|
63
|
-
options
|
64
|
-
end
|
65
|
-
|
66
61
|
def execute(method, url, parameters = {}, request_headers = {}, include_auth_header = true)
|
67
|
-
request_headers =
|
68
|
-
response = HTTParty.send(method.to_s,
|
62
|
+
request_headers = auth_headers(request_headers) if include_auth_header
|
63
|
+
response = HTTParty.send(method.to_s, url, {:query => to_j(parameters), headers: request_headers})
|
69
64
|
response.parsed_response
|
70
65
|
end
|
71
66
|
|
72
67
|
private
|
73
68
|
|
74
|
-
def
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
69
|
+
def to_j(parameters = {})
|
70
|
+
parameters.each do |item|
|
71
|
+
if item.last.is_a?(Hash) || item.last.is_a?(Array)
|
72
|
+
parameters[item.first.to_s] = item.last.to_json
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
parameters
|
77
|
+
end
|
78
|
+
|
79
|
+
def auth_headers(options = {})
|
80
|
+
options.merge!('Authorization' => "Bearer #{Wrike3.access_token}")
|
81
|
+
options
|
79
82
|
end
|
80
83
|
end
|
81
84
|
|
data/lib/wrike3/comment.rb
CHANGED
@@ -7,30 +7,30 @@ module Wrike3
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# Returns list of comments
|
10
|
-
def list(account_id = nil,
|
10
|
+
def list(account_id = nil, params={})
|
11
11
|
path = 'comments'
|
12
12
|
path = "accounts/#{account_id}/#{path}" if account_id.present?
|
13
|
-
wrike.execute(:get, api_url(path),
|
13
|
+
wrike.execute(:get, api_url(path), params)
|
14
14
|
end
|
15
15
|
|
16
16
|
# Returns list of comments
|
17
|
-
def details(id,
|
18
|
-
wrike.execute(:get, api_url("comments/#{id}"),
|
17
|
+
def details(id, params = {})
|
18
|
+
wrike.execute(:get, api_url("comments/#{id}"), params)
|
19
19
|
end
|
20
20
|
|
21
21
|
# Add a new comment to a task
|
22
|
-
def add(commentable_type, commentable_id,
|
23
|
-
wrike.execute(:post, api_url(nested_path('comments', commentable_type, commentable_id)),
|
22
|
+
def add(commentable_type, commentable_id, params = {})
|
23
|
+
wrike.execute(:post, api_url(nested_path('comments', commentable_type, commentable_id)), params)
|
24
24
|
end
|
25
25
|
|
26
26
|
# Update a comment
|
27
|
-
def update(id,
|
28
|
-
wrike.execute(:put, api_url("comments/#{id}"),
|
27
|
+
def update(id, params = {})
|
28
|
+
wrike.execute(:put, api_url("comments/#{id}"), params)
|
29
29
|
end
|
30
30
|
|
31
31
|
# Delete a comment
|
32
32
|
def delete(id)
|
33
|
-
wrike.execute(:delete, api_url("comments/#{id}")
|
33
|
+
wrike.execute(:delete, api_url("comments/#{id}"))
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
data/lib/wrike3/contact.rb
CHANGED
@@ -6,12 +6,12 @@ module Wrike3
|
|
6
6
|
@wrike = wrike
|
7
7
|
end
|
8
8
|
|
9
|
-
def list(
|
10
|
-
wrike.execute(:get, api_url('contacts'),
|
9
|
+
def list(params = {})
|
10
|
+
wrike.execute(:get, api_url('contacts'), params)
|
11
11
|
end
|
12
12
|
|
13
|
-
def details(ids,
|
14
|
-
wrike.execute(:get, api_url("contacts/#{ids}"),
|
13
|
+
def details(ids, params = {})
|
14
|
+
wrike.execute(:get, api_url("contacts/#{ids}"), params)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/wrike3/folder.rb
CHANGED
@@ -6,29 +6,29 @@ module Wrike3
|
|
6
6
|
@wrike = wrike
|
7
7
|
end
|
8
8
|
|
9
|
-
def tree(folderable_type = nil, folderable_id = nil,
|
10
|
-
wrike.execute(:get, api_url(nested_path('folders', folderable_type, folderable_id)),
|
9
|
+
def tree(folderable_type = nil, folderable_id = nil, params = {})
|
10
|
+
wrike.execute(:get, api_url(nested_path('folders', folderable_type, folderable_id)), params)
|
11
11
|
end
|
12
12
|
|
13
13
|
# Get folder data
|
14
|
-
def details(ids, params={})
|
15
|
-
wrike.execute(:get, api_url("folders/#{ids}"),
|
14
|
+
def details(ids, params = {})
|
15
|
+
wrike.execute(:get, api_url("folders/#{ids}"), params)
|
16
16
|
end
|
17
17
|
|
18
18
|
# create a folder
|
19
19
|
def create(folder_id = nil, params = {})
|
20
20
|
wrike_url = "folders#{(folder_id.present? ? "/#{folder_id}/folders" : '')}"
|
21
|
-
wrike.execute(:post, api_url(wrike_url),
|
21
|
+
wrike.execute(:post, api_url(wrike_url), params)
|
22
22
|
end
|
23
23
|
|
24
24
|
# Update a folder
|
25
25
|
def update(id, params = {})
|
26
|
-
wrike.execute(:put, api_url("folders/#{id}"),
|
26
|
+
wrike.execute(:put, api_url("folders/#{id}"), params)
|
27
27
|
end
|
28
28
|
|
29
29
|
# Delete folders and all descendants
|
30
|
-
def delete(id, params={})
|
31
|
-
wrike.execute(:delete, api_url("folders/#{id}"),
|
30
|
+
def delete(id, params = {})
|
31
|
+
wrike.execute(:delete, api_url("folders/#{id}"), params)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/wrike3/task.rb
CHANGED
@@ -7,27 +7,27 @@ module Wrike3
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# Get task list
|
10
|
-
def list(taskable_type = nil, taskable_id = nil,
|
11
|
-
wrike.execute(:get, api_url(nested_path('tasks', taskable_type, taskable_id)),
|
10
|
+
def list(taskable_type = nil, taskable_id = nil, params = {})
|
11
|
+
wrike.execute(:get, api_url(nested_path('tasks', taskable_type, taskable_id)), params)
|
12
12
|
end
|
13
13
|
|
14
|
-
def details(id,
|
15
|
-
wrike.execute(:get, api_url("tasks/#{id}"),
|
14
|
+
def details(id, params = {})
|
15
|
+
wrike.execute(:get, api_url("tasks/#{id}"), params)
|
16
16
|
end
|
17
17
|
|
18
18
|
# Add a new task
|
19
|
-
def add(folder_id,
|
20
|
-
wrike.execute(:post, api_url("folders/#{folder_id}/tasks"),
|
19
|
+
def add(folder_id, params = {})
|
20
|
+
wrike.execute(:post, api_url("folders/#{folder_id}/tasks"), params)
|
21
21
|
end
|
22
22
|
|
23
23
|
# Update a task
|
24
|
-
def update(id,
|
25
|
-
wrike.execute(:put, api_url("tasks/#{id}"),
|
24
|
+
def update(id, params = {})
|
25
|
+
wrike.execute(:put, api_url("tasks/#{id}"), params)
|
26
26
|
end
|
27
27
|
|
28
28
|
# Delete an existing task
|
29
|
-
def delete(id,
|
30
|
-
wrike.execute(:delete, api_url("tasks/#{id}"),
|
29
|
+
def delete(id, params = {})
|
30
|
+
wrike.execute(:delete, api_url("tasks/#{id}"), params)
|
31
31
|
end
|
32
32
|
|
33
33
|
end
|
data/lib/wrike3/timelog.rb
CHANGED
@@ -6,27 +6,27 @@ module Wrike3
|
|
6
6
|
@wrike = wrike
|
7
7
|
end
|
8
8
|
|
9
|
-
def list(logable_type = nil, logable_id = nil,
|
10
|
-
wrike.execute(:get, api_url(nested_path('timelogs', logable_type, logable_id)),
|
9
|
+
def list(logable_type = nil, logable_id = nil, params = {})
|
10
|
+
wrike.execute(:get, api_url(nested_path('timelogs', logable_type, logable_id)), params)
|
11
11
|
end
|
12
12
|
|
13
|
-
def details(id,
|
14
|
-
wrike.execute(:get, api_url("timelogs/#{id}"),
|
13
|
+
def details(id, params = {})
|
14
|
+
wrike.execute(:get, api_url("timelogs/#{id}"), params)
|
15
15
|
end
|
16
16
|
|
17
17
|
# Add a new time log
|
18
|
-
def add(task_id,
|
19
|
-
wrike.execute(:get, api_url("tasks/#{task_id}/timelogs"),
|
18
|
+
def add(task_id, params = {})
|
19
|
+
wrike.execute(:get, api_url("tasks/#{task_id}/timelogs"), params)
|
20
20
|
end
|
21
21
|
|
22
22
|
# Update time log
|
23
|
-
def update(id,
|
24
|
-
wrike.execute(:put, api_url("timelogs/#{id}"),
|
23
|
+
def update(id, params = {})
|
24
|
+
wrike.execute(:put, api_url("timelogs/#{id}"), params)
|
25
25
|
end
|
26
26
|
|
27
27
|
# Delete timelog
|
28
|
-
def delete(id,
|
29
|
-
wrike.execute(:delete, api_url("timelogs/#{id}"),
|
28
|
+
def delete(id, params = {})
|
29
|
+
wrike.execute(:delete, api_url("timelogs/#{id}"), params)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/lib/wrike3/user.rb
CHANGED
@@ -6,12 +6,12 @@ module Wrike3
|
|
6
6
|
@wrike = wrike
|
7
7
|
end
|
8
8
|
|
9
|
-
def details(id,
|
10
|
-
wrike.execute(:get, api_url("users/#{id}"),
|
9
|
+
def details(id, params = {})
|
10
|
+
wrike.execute(:get, api_url("users/#{id}"), params)
|
11
11
|
end
|
12
12
|
|
13
|
-
def update(id,
|
14
|
-
wrike.execute(:put, api_url("users/#{id}"),
|
13
|
+
def update(id, params = {})
|
14
|
+
wrike.execute(:put, api_url("users/#{id}"), params)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/wrike3/version.rb
CHANGED
data/lib/wrike3/workflow.rb
CHANGED
@@ -7,23 +7,23 @@ module Wrike3
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# Get task list
|
10
|
-
def list(account_id,
|
11
|
-
wrike.execute(:get, api_url("accounts/#{account_id}/workflows"),
|
10
|
+
def list(account_id, params = {})
|
11
|
+
wrike.execute(:get, api_url("accounts/#{account_id}/workflows"), params)
|
12
12
|
end
|
13
13
|
|
14
|
-
def details(account_id, id,
|
15
|
-
matters = wrike.execute(:get, api_url("accounts/#{account_id}/workflows"),
|
14
|
+
def details(account_id, id, params = {})
|
15
|
+
matters = wrike.execute(:get, api_url("accounts/#{account_id}/workflows"), params)
|
16
16
|
matters['data'].find { |m| m['id'] == id }
|
17
17
|
end
|
18
18
|
|
19
19
|
# Add a new task
|
20
|
-
def add(account_id,
|
21
|
-
wrike.execute(:post, api_url("accounts/#{account_id}/workflows"),
|
20
|
+
def add(account_id, params = {})
|
21
|
+
wrike.execute(:post, api_url("accounts/#{account_id}/workflows"), params)
|
22
22
|
end
|
23
23
|
|
24
24
|
# Update a task
|
25
|
-
def update(id,
|
26
|
-
wrike.execute(:put, api_url("workflows/#{id}"),
|
25
|
+
def update(id, params = {})
|
26
|
+
wrike.execute(:put, api_url("workflows/#{id}"), params)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|