wrike3 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +33 -0
- data/Rakefile +12 -0
- data/lib/wrike3.rb +26 -0
- data/lib/wrike3/account.rb +23 -0
- data/lib/wrike3/attachment.rb +34 -0
- data/lib/wrike3/base.rb +82 -0
- data/lib/wrike3/comment.rb +37 -0
- data/lib/wrike3/common.rb +16 -0
- data/lib/wrike3/contact.rb +13 -0
- data/lib/wrike3/error.rb +54 -0
- data/lib/wrike3/folder.rb +29 -0
- data/lib/wrike3/task.rb +34 -0
- data/lib/wrike3/timelog.rb +32 -0
- data/lib/wrike3/token.rb +20 -0
- data/lib/wrike3/user.rb +17 -0
- data/lib/wrike3/utils.rb +33 -0
- data/lib/wrike3/version.rb +3 -0
- data/lib/wrike3/workflow.rb +29 -0
- data/test/.keep +0 -0
- data/wrike3.gemspec +30 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 73eb5f8da96a607d4340eebefbcddd7b26c468cf
|
4
|
+
data.tar.gz: bd8cafeef9fd121b4cbd6a12a3779fed3ef8956a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 216c6d0a4fa709fe938916bd4031e2922c57341682e8727c34531fccb7055965db14f15406dcc889c4996daf80d87f461f8473d48004e31ea44e5ec512da21da
|
7
|
+
data.tar.gz: 0c8f340f47acaa2b79bcd68c22023d53c0b94499c70837d63c0cf6c2636a2bd5a3367d26fb4b9cd918d621ade286b5f29dcb1706febe018460371670ec249646
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) Morshed Alam
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Wrike
|
2
|
+
|
3
|
+
This gem is to communicate through Wrike.com API
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add to your Gemfile:
|
9
|
+
|
10
|
+
<pre><code>gem 'wrike3', :github => 'morshedalam/wrike3'</code></pre>
|
11
|
+
|
12
|
+
Then run:
|
13
|
+
|
14
|
+
<pre>$ bundle install</pre>
|
15
|
+
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
We mimic the ActiveRecord-style interface.
|
20
|
+
|
21
|
+
|
22
|
+
#### Configuration
|
23
|
+
```ruby
|
24
|
+
# Initialize your Wrike object:
|
25
|
+
Wrike3.configure do |config|
|
26
|
+
config.client_id = 'client-id'
|
27
|
+
config.access_token = 'access-token'
|
28
|
+
end
|
29
|
+
|
30
|
+
@wrike = Wrike3()
|
31
|
+
|
32
|
+
# or alternatively:
|
33
|
+
@wrike = Wrike3(:client_id => 'client-id')
|
data/Rakefile
ADDED
data/lib/wrike3.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# require 'oauth2'
|
2
|
+
require 'httparty'
|
3
|
+
require 'mime/types'
|
4
|
+
|
5
|
+
require 'wrike3/error'
|
6
|
+
require 'wrike3/common'
|
7
|
+
require 'wrike3/utils'
|
8
|
+
|
9
|
+
require 'wrike3/base'
|
10
|
+
require 'wrike3/token'
|
11
|
+
require 'wrike3/account'
|
12
|
+
require 'wrike3/user'
|
13
|
+
require 'wrike3/workflow'
|
14
|
+
require 'wrike3/contact'
|
15
|
+
require 'wrike3/folder'
|
16
|
+
require 'wrike3/task'
|
17
|
+
require 'wrike3/comment'
|
18
|
+
require 'wrike3/timelog'
|
19
|
+
require 'wrike3/attachment'
|
20
|
+
|
21
|
+
def Wrike3(options={})
|
22
|
+
# Settings
|
23
|
+
options[:access_token] = Wrike3.access_token if Wrike3.access_token
|
24
|
+
# Initialize wrike object
|
25
|
+
Wrike3::Base.new(options)
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Account
|
3
|
+
include Wrike3::Common
|
4
|
+
|
5
|
+
def initialize(wrike)
|
6
|
+
@wrike = wrike
|
7
|
+
end
|
8
|
+
|
9
|
+
# Get account list
|
10
|
+
def list(options = {})
|
11
|
+
wrike.execute(:get, api_url('accounts'), options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def details(id, options={})
|
15
|
+
wrike.execute(:get, api_url("accounts/#{id}"), options)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Update account
|
19
|
+
def update(id, data = {}, options={})
|
20
|
+
wrike.execute(:put, api_url("accounts/#{id}"), options.merge(data))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Attachment
|
3
|
+
include Wrike3::Common
|
4
|
+
|
5
|
+
def initialize(wrike)
|
6
|
+
@wrike = wrike
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(attachable_type = nil, attachable_id = nil, options={})
|
10
|
+
wrike.execute(:get, api_url(nested_path('attachments', attachable_type, attachable_id)), options)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Get attachment details
|
14
|
+
def details(id, options={})
|
15
|
+
wrike.execute(:get, api_url("attachments/#{id}"), options)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Upload attachment for specified task
|
19
|
+
def upload(attachable_type, attachable_id, stream, options={})
|
20
|
+
body, headers = http_multipart_data({:stream => stream})
|
21
|
+
wrike.execute(:post, api_url(nested_path('attachments', attachable_type, attachable_id)), body, headers)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Get file binary stream
|
25
|
+
def download(id, options={})
|
26
|
+
wrike.execute(:get, api_url("attachments/#{id}/download"), options)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Delete attachments
|
30
|
+
def delete(id, options={})
|
31
|
+
wrike.execute(:delete, api_url("attachments/#{id}"), options)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/wrike3/base.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Base
|
3
|
+
def initialize(options={})
|
4
|
+
# API settings
|
5
|
+
Wrike3.api_version = options.fetch(:api_version) { 'v3' }
|
6
|
+
Wrike3.protocol = options.fetch(:protocol) { 'https' }
|
7
|
+
Wrike3.api_host = options.fetch(:api_host) { 'www.wrike.com' }
|
8
|
+
# Access settings
|
9
|
+
Wrike3.access_token = options.fetch(:access_token) { '' }
|
10
|
+
end
|
11
|
+
|
12
|
+
# Returns the base url used in all Wrike API calls
|
13
|
+
def base_url
|
14
|
+
"#{Wrike3.protocol}://#{Wrike3.api_host}/api/#{Wrike3.api_version}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def account
|
18
|
+
@account ||= Wrike3::Account.new(self)
|
19
|
+
end
|
20
|
+
|
21
|
+
def attachment
|
22
|
+
@attachment ||= Wrike3::Attachment.new(self)
|
23
|
+
end
|
24
|
+
|
25
|
+
def comment
|
26
|
+
@comment ||= Wrike3::Comment.new(self)
|
27
|
+
end
|
28
|
+
|
29
|
+
def contact
|
30
|
+
@contact ||= Wrike3::Contact.new(self)
|
31
|
+
end
|
32
|
+
|
33
|
+
def folder
|
34
|
+
@folder ||= Wrike3::Folder.new(self)
|
35
|
+
end
|
36
|
+
|
37
|
+
def task
|
38
|
+
@task ||= Wrike3::Task.new(self)
|
39
|
+
end
|
40
|
+
|
41
|
+
def timelog
|
42
|
+
@timelog ||= Wrike3::Timelog.new(self)
|
43
|
+
end
|
44
|
+
|
45
|
+
def user
|
46
|
+
@user ||= Wrike3::User.new(self)
|
47
|
+
end
|
48
|
+
|
49
|
+
def workflow
|
50
|
+
@workflow ||= Wrike3::Workflow.new(self)
|
51
|
+
end
|
52
|
+
|
53
|
+
def token
|
54
|
+
@token ||= Wrike3::Token.new(self)
|
55
|
+
end
|
56
|
+
|
57
|
+
def auth_headers(options = {})
|
58
|
+
options.merge!('Authorization' => "Bearer #{Wrike3.access_token}")
|
59
|
+
options
|
60
|
+
end
|
61
|
+
|
62
|
+
def execute(method, url, parameters = {}, request_headers = {}, include_auth_header = true)
|
63
|
+
request_headers = self.auth_headers(request_headers) if include_auth_header
|
64
|
+
response = HTTParty.send(method.to_s, url, query: parameters, headers: request_headers)
|
65
|
+
response.parsed_response
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class << self
|
70
|
+
attr_accessor :api_host,
|
71
|
+
:protocol,
|
72
|
+
:api_version,
|
73
|
+
:access_token
|
74
|
+
|
75
|
+
def configure
|
76
|
+
yield self
|
77
|
+
true
|
78
|
+
end
|
79
|
+
|
80
|
+
alias :config :configure
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Comment
|
3
|
+
include Wrike3::Common
|
4
|
+
|
5
|
+
def initialize(wrike)
|
6
|
+
@wrike = wrike
|
7
|
+
end
|
8
|
+
|
9
|
+
# Returns list of comments
|
10
|
+
def list(account_id = nil, options={})
|
11
|
+
path = 'comments'
|
12
|
+
path = "accounts/#{account_id}/#{path}" if account_id.present?
|
13
|
+
wrike.execute(:get, api_url(path), options)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns list of comments
|
17
|
+
def details(id, options={})
|
18
|
+
wrike.execute(:get, api_url("comments/#{id}"), options)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Add a new comment to a task
|
22
|
+
def add(commentable_type, commentable_id, data = {}, options={})
|
23
|
+
wrike.execute(:post, api_url(nested_path('comments', commentable_type, commentable_id)), options.merge(data))
|
24
|
+
end
|
25
|
+
|
26
|
+
# Update a comment
|
27
|
+
def update(id, data = {}, options={})
|
28
|
+
wrike.execute(:put, api_url("comments/#{id}"), options.merge(data))
|
29
|
+
end
|
30
|
+
|
31
|
+
# Delete a comment
|
32
|
+
def delete(id)
|
33
|
+
wrike.execute(:delete, api_url("comments/#{id}"), options)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Wrike3
|
2
|
+
module Common
|
3
|
+
attr_accessor :wrike
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def api_url(path)
|
8
|
+
"#{wrike.base_url}/#{path}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def nested_path(path = '', type = nil, id = nil)
|
12
|
+
path = "#{type}/#{id}/#{path}" if type.present? && id.present?
|
13
|
+
path
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/wrike3/error.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Error
|
3
|
+
attr_accessor :error
|
4
|
+
|
5
|
+
def initialize(options={})
|
6
|
+
@error =
|
7
|
+
case options[:code]
|
8
|
+
when 200
|
9
|
+
# Not an error
|
10
|
+
when 404, 402, 403
|
11
|
+
Wrike3::NotFound.new(options[:message])
|
12
|
+
when 400
|
13
|
+
Wrike3::BadRequest.new(options[:message])
|
14
|
+
when 401
|
15
|
+
Wrike3::Unauthorized.new(options[:message])
|
16
|
+
when 402
|
17
|
+
Wrike3::RequestFailed.new(options[:message])
|
18
|
+
when 500, 502, 503, 504
|
19
|
+
Wrike3::ServerError.new(options[:message])
|
20
|
+
else
|
21
|
+
Wrike3::ErrorBase.new(options[:message])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def handle
|
26
|
+
return error.handle
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class ErrorBase < StandardError
|
31
|
+
# Handles the error if needed
|
32
|
+
# by default returns an error
|
33
|
+
#
|
34
|
+
# @return [type] [description]
|
35
|
+
def handle
|
36
|
+
return self
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class NotFound < ErrorBase
|
41
|
+
def handle
|
42
|
+
return nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class BadRequest < ErrorBase
|
47
|
+
end
|
48
|
+
|
49
|
+
class Unauthorized < ErrorBase
|
50
|
+
end
|
51
|
+
|
52
|
+
class RequestFailed < ErrorBase
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Folder
|
3
|
+
include Wrike3::Common
|
4
|
+
|
5
|
+
def initialize(wrike)
|
6
|
+
@wrike = wrike
|
7
|
+
end
|
8
|
+
|
9
|
+
def tree(folderable_type = nil, folderable_id = nil, options = {})
|
10
|
+
wrike.execute(:get, api_url(nested_path('folders', folderable_type, folderable_id)), options)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Get folder data
|
14
|
+
def details(ids, options={})
|
15
|
+
wrike.execute(:get, api_url("folders/#{ids}"), options)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Update a folder
|
19
|
+
def update(id, data = {}, options={})
|
20
|
+
wrike.execute(:put, api_url("folders/#{id}"), options.merge(data))
|
21
|
+
end
|
22
|
+
|
23
|
+
# Delete folders and all descendants
|
24
|
+
def delete(id, options={})
|
25
|
+
wrike.execute(:delete, api_url("folders/#{id}"), options)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
data/lib/wrike3/task.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Task
|
3
|
+
include Wrike3::Common
|
4
|
+
|
5
|
+
def initialize(wrike)
|
6
|
+
@wrike = wrike
|
7
|
+
end
|
8
|
+
|
9
|
+
# Get task list
|
10
|
+
def list(taskable_type = nil, taskable_id = nil, options = {})
|
11
|
+
wrike.execute(:get, api_url(nested_path('tasks', taskable_type, taskable_id)), options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def details(id, options={})
|
15
|
+
wrike.execute(:get, api_url("tasks/#{id}"), options)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Add a new task
|
19
|
+
def add(folder_id, data = {}, options={})
|
20
|
+
wrike.execute(:post, api_url("folders/#{folder_id}/tasks"), options.merge(data))
|
21
|
+
end
|
22
|
+
|
23
|
+
# Update a task
|
24
|
+
def update(id, data = {}, options={})
|
25
|
+
wrike.execute(:put, api_url("tasks/#{id}"), options.merge(data))
|
26
|
+
end
|
27
|
+
|
28
|
+
# Delete an existing task
|
29
|
+
def delete(id, options={})
|
30
|
+
wrike.execute(:delete, api_url("tasks/#{id}"), options)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Timelog
|
3
|
+
include Wrike3::Common
|
4
|
+
|
5
|
+
def initialize(wrike)
|
6
|
+
@wrike = wrike
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(logable_type = nil, logable_id = nil, options={})
|
10
|
+
wrike.execute(:get, api_url(nested_path('timelogs', logable_type, logable_id)), options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def details(id, options = {})
|
14
|
+
wrike.execute(:get, api_url("timelogs/#{id}"), options)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Add a new time log
|
18
|
+
def add(task_id, data = {}, options = {})
|
19
|
+
wrike.execute(:get, api_url("tasks/#{task_id}/timelogs"), options.merge(data))
|
20
|
+
end
|
21
|
+
|
22
|
+
# Update time log
|
23
|
+
def update(id, data = {}, options={})
|
24
|
+
wrike.execute(:put, api_url("timelogs/#{id}"), options.merge(data))
|
25
|
+
end
|
26
|
+
|
27
|
+
# Delete timelog
|
28
|
+
def delete(id, options = {})
|
29
|
+
wrike.execute(:delete, api_url("timelogs/#{id}"), options)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/wrike3/token.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Token
|
3
|
+
include Wrike3::Common
|
4
|
+
|
5
|
+
def initialize(wrike)
|
6
|
+
@wrike = wrike
|
7
|
+
end
|
8
|
+
|
9
|
+
def refresh(client_id, client_secret, refresh_token)
|
10
|
+
parameters = {
|
11
|
+
:client_id => client_id,
|
12
|
+
:grant_type => 'refresh_token',
|
13
|
+
:client_secret => client_secret,
|
14
|
+
:refresh_token => refresh_token
|
15
|
+
}
|
16
|
+
wrike.execute(:post, "#{Wrike3.protocol}://#{Wrike3.api_host}/oauth2/token", parameters, {}, false)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
data/lib/wrike3/user.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class User
|
3
|
+
include Wrike3::Common
|
4
|
+
|
5
|
+
def initialize(wrike)
|
6
|
+
@wrike = wrike
|
7
|
+
end
|
8
|
+
|
9
|
+
def details(id, options = {})
|
10
|
+
wrike.execute(:get, api_url("users/#{id}"), options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def update(id, data = {}, options = {})
|
14
|
+
wrike.execute(:put, api_url("users/#{id}"), options.merge(data))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/wrike3/utils.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Helper
|
3
|
+
CRLF = "\r\n"
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def http_multipart_data(params)
|
7
|
+
body = ''
|
8
|
+
headers = {}
|
9
|
+
boundary = Time.now.to_i.to_s(16)
|
10
|
+
headers["Content-Type"] = "multipart/form-data; boundary=#{boundary}"
|
11
|
+
|
12
|
+
# params.each do |key, value|
|
13
|
+
# esc_key = OAuth::Helper.escape(key.to_s)
|
14
|
+
# body << "--#{boundary}#{CRLF}"
|
15
|
+
#
|
16
|
+
# if value.respond_to?(:read)
|
17
|
+
# mime_type = MIME::Types.type_for(value.path)[0] || MIME::Types["application/octet-stream"][0]
|
18
|
+
# body << "Content-Disposition: form-data; name=\"#{esc_key}\"; filename=\"#{File.basename(value.path)}\"#{CRLF}"
|
19
|
+
# body << "Content-Type: #{mime_type.simplified}#{CRLF*2}"
|
20
|
+
# body << value.read
|
21
|
+
# else
|
22
|
+
# body << "Content-Disposition: form-data; name=\"#{esc_key}\"#{CRLF*2}#{value}"
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
|
26
|
+
body << "--#{boundary}--#{CRLF*2}"
|
27
|
+
headers["Content-Length"] = body.size.to_s
|
28
|
+
|
29
|
+
return [body, headers]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Wrike3
|
2
|
+
class Workflow
|
3
|
+
include Wrike3::Common
|
4
|
+
|
5
|
+
def initialize(wrike)
|
6
|
+
@wrike = wrike
|
7
|
+
end
|
8
|
+
|
9
|
+
# Get task list
|
10
|
+
def list(account_id, options = {})
|
11
|
+
wrike.execute(:get, api_url("accounts/#{account_id}/workflows"), options)
|
12
|
+
end
|
13
|
+
|
14
|
+
def details(account_id, id, options={})
|
15
|
+
matters = wrike.execute(:get, api_url("accounts/#{account_id}/workflows"), options)
|
16
|
+
matters['data'].find { |m| m['id'] == id }
|
17
|
+
end
|
18
|
+
|
19
|
+
# Add a new task
|
20
|
+
def add(account_id, data = {}, options={})
|
21
|
+
wrike.execute(:post, api_url("accounts/#{account_id}/workflows"), options.merge(data))
|
22
|
+
end
|
23
|
+
|
24
|
+
# Update a task
|
25
|
+
def update(id, data = {}, options={})
|
26
|
+
wrike.execute(:put, api_url("workflows/#{id}"), options.merge(data))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/test/.keep
ADDED
File without changes
|
data/wrike3.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/wrike3/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'wrike3'
|
6
|
+
s.version = Wrike3::VERSION
|
7
|
+
|
8
|
+
s.homepage = 'http://github.com/morshedalam/wrike3'
|
9
|
+
s.authors = ['Morshed Alam']
|
10
|
+
s.date = '2016-02-20'
|
11
|
+
s.email = 'morshed201@gmail.com'
|
12
|
+
|
13
|
+
s.description = 'Ruby client to access Wrike API V3.'
|
14
|
+
s.summary = 'Wrike API extension'
|
15
|
+
|
16
|
+
s.license = 'MIT'
|
17
|
+
s.rubyforge_project = 'wrike3'
|
18
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE']
|
19
|
+
s.rdoc_options = ['--inline-source', '--charset=UTF-8']
|
20
|
+
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.test_files = `git ls-files -- {test}/*`.split("\n")
|
23
|
+
s.require_paths = ['lib']
|
24
|
+
s.rubygems_version = '1.9.3'
|
25
|
+
|
26
|
+
s.add_runtime_dependency('httparty', '~> 0.13.7')
|
27
|
+
s.add_runtime_dependency('mime-types', '~> 2.99', '>= 2.99.1')
|
28
|
+
s.add_runtime_dependency('shoulda', '~> 3.5')
|
29
|
+
s.add_runtime_dependency('mocha', '~> 1.1')
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wrike3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Morshed Alam
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.13.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.13.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mime-types
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.99'
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 2.99.1
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2.99'
|
44
|
+
- - '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.99.1
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: shoulda
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.5'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.5'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: mocha
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.1'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ~>
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '1.1'
|
75
|
+
description: Ruby client to access Wrike API V3.
|
76
|
+
email: morshed201@gmail.com
|
77
|
+
executables: []
|
78
|
+
extensions: []
|
79
|
+
extra_rdoc_files:
|
80
|
+
- README.md
|
81
|
+
- LICENSE
|
82
|
+
files:
|
83
|
+
- .gitignore
|
84
|
+
- Gemfile
|
85
|
+
- LICENSE
|
86
|
+
- README.md
|
87
|
+
- Rakefile
|
88
|
+
- lib/wrike3.rb
|
89
|
+
- lib/wrike3/account.rb
|
90
|
+
- lib/wrike3/attachment.rb
|
91
|
+
- lib/wrike3/base.rb
|
92
|
+
- lib/wrike3/comment.rb
|
93
|
+
- lib/wrike3/common.rb
|
94
|
+
- lib/wrike3/contact.rb
|
95
|
+
- lib/wrike3/error.rb
|
96
|
+
- lib/wrike3/folder.rb
|
97
|
+
- lib/wrike3/task.rb
|
98
|
+
- lib/wrike3/timelog.rb
|
99
|
+
- lib/wrike3/token.rb
|
100
|
+
- lib/wrike3/user.rb
|
101
|
+
- lib/wrike3/utils.rb
|
102
|
+
- lib/wrike3/version.rb
|
103
|
+
- lib/wrike3/workflow.rb
|
104
|
+
- test/.DS_Store
|
105
|
+
- test/.keep
|
106
|
+
- wrike3.gemspec
|
107
|
+
homepage: http://github.com/morshedalam/wrike3
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options:
|
113
|
+
- --inline-source
|
114
|
+
- --charset=UTF-8
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project: wrike3
|
129
|
+
rubygems_version: 2.4.5
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: Wrike API extension
|
133
|
+
test_files: []
|