producteev 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -0
- data/Gemfile.lock +16 -0
- data/README.md +59 -0
- data/lib/producteev/activities.rb +24 -0
- data/lib/producteev/api.rb +57 -0
- data/lib/producteev/client.rb +38 -0
- data/lib/producteev/dashboards.rb +73 -0
- data/lib/producteev/labels.rb +32 -0
- data/lib/producteev/tasks.rb +115 -0
- data/lib/producteev/users.rb +28 -0
- data/lib/producteev.rb +22 -0
- data/producteev.gemspec +18 -0
- metadata +78 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Producteev Api
|
2
|
+
|
3
|
+
A Ruby wrapper for the Producteev REST API
|
4
|
+
|
5
|
+
Supports all the API methods. If i have missed any let me know.
|
6
|
+
|
7
|
+
I need to write some tests i know, but if you feel like doing it just raise a merge request.
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Install the gem by issuing
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem install producteev
|
14
|
+
```
|
15
|
+
|
16
|
+
or put it in your Gemfile and run `bundle install`
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem "producteev"
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Create a new client instance
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'rubygems'
|
28
|
+
require 'producteev'
|
29
|
+
|
30
|
+
#no debug
|
31
|
+
producteevclient = Producteev.new("api_key_from_producteev","api_secret_from_producteev")
|
32
|
+
#debug
|
33
|
+
producteevclient = Producteev.new("api_key_from_producteev","api_secret_from_producteev",true)
|
34
|
+
```
|
35
|
+
|
36
|
+
Login in as a user
|
37
|
+
```ruby
|
38
|
+
producteevclient.login("username","password")
|
39
|
+
```
|
40
|
+
|
41
|
+
Get the server time
|
42
|
+
```ruby
|
43
|
+
producteevclient.time
|
44
|
+
```
|
45
|
+
|
46
|
+
Get as list of tasks
|
47
|
+
```ruby
|
48
|
+
producteevclient.tasks.show_list
|
49
|
+
```
|
50
|
+
|
51
|
+
Get as list of lables
|
52
|
+
```ruby
|
53
|
+
producteevclient.labels.show_list
|
54
|
+
```
|
55
|
+
|
56
|
+
Dashboards, users and activities can also be used in the same way. Please note all httparty exceptions you will have to deal with. All function calls return a hash.
|
57
|
+
|
58
|
+
|
59
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Producteev
|
2
|
+
class Activities
|
3
|
+
@api = nil
|
4
|
+
def initialize(api)
|
5
|
+
@api = api
|
6
|
+
end
|
7
|
+
|
8
|
+
def show_activities(options = {})
|
9
|
+
return @api.sendRequest("/activities/show_activities.json",options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def show_notifications(options = {})
|
13
|
+
return @api.sendRequest("/activities/show_notifications.json",options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def notifications_set_read(options = {})
|
17
|
+
return @api.sendRequest("/activities/notifications_set_read.json",options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_read(options = {})
|
21
|
+
return @api.sendRequest("/activities/set_read.json",options)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Producteev
|
2
|
+
class Api
|
3
|
+
include HTTParty
|
4
|
+
base_uri 'https://api.producteev.com/'
|
5
|
+
|
6
|
+
def initialize(apikey,secret, debug)
|
7
|
+
@apikey = apikey
|
8
|
+
@secret = secret
|
9
|
+
@token = nil
|
10
|
+
@debug = debug
|
11
|
+
end
|
12
|
+
|
13
|
+
def login(email,password)
|
14
|
+
param = {:email => email, :password => password}
|
15
|
+
@token = self.sendRequest("/users/login.json",param)['login']['token']
|
16
|
+
end
|
17
|
+
|
18
|
+
def generateSig(parameters)
|
19
|
+
signature = ""
|
20
|
+
|
21
|
+
#sort the hash alphabetically
|
22
|
+
parameters = parameters.sort
|
23
|
+
|
24
|
+
parameters.each { |key,value|
|
25
|
+
if (value.kind_of? String or value.kind_of? Integer)
|
26
|
+
signature = "#{signature}#{key}#{value}"
|
27
|
+
end
|
28
|
+
}
|
29
|
+
signature = signature+@secret
|
30
|
+
signature = Digest::MD5.hexdigest(signature)
|
31
|
+
return signature
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def sendRequest(path, options={})
|
36
|
+
options.merge!({:api_key => @apikey})
|
37
|
+
|
38
|
+
if @token != nil
|
39
|
+
options.merge!({:token => @token})
|
40
|
+
end
|
41
|
+
options.merge!({:api_sig => generateSig(options)})
|
42
|
+
|
43
|
+
if @debug
|
44
|
+
response = self.class.get(path, {:query => options, :debug_output => $stderr})
|
45
|
+
else
|
46
|
+
response = self.class.get(path, {:query => options})
|
47
|
+
end
|
48
|
+
|
49
|
+
if response.success?
|
50
|
+
return JSON.parse(response.body)
|
51
|
+
else
|
52
|
+
raise response.response
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Producteev
|
2
|
+
class Client
|
3
|
+
@api = nil
|
4
|
+
|
5
|
+
def initialize(apikey,secret, debug = false)
|
6
|
+
@api = Producteev::Api.new(apikey,secret, debug)
|
7
|
+
end
|
8
|
+
|
9
|
+
def login(email,password)
|
10
|
+
@api.login(email,password)
|
11
|
+
end
|
12
|
+
|
13
|
+
def tasks()
|
14
|
+
return Producteev::Tasks.new(@api)
|
15
|
+
end
|
16
|
+
|
17
|
+
def labels()
|
18
|
+
return Producteev::Labels.new(@api)
|
19
|
+
end
|
20
|
+
|
21
|
+
def time()
|
22
|
+
return @api.sendRequest("/time.json")
|
23
|
+
end
|
24
|
+
|
25
|
+
def activities()
|
26
|
+
return Producteev::Activities.new(@api)
|
27
|
+
end
|
28
|
+
|
29
|
+
def dashboards()
|
30
|
+
return Producteev::Dashboards.new(@api)
|
31
|
+
end
|
32
|
+
|
33
|
+
def users()
|
34
|
+
return Producteev::Users.new(@api)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Producteev
|
2
|
+
class Dashboards
|
3
|
+
@api = nil
|
4
|
+
def initialize(api)
|
5
|
+
@api = api
|
6
|
+
end
|
7
|
+
|
8
|
+
def create(options = {})
|
9
|
+
return @api.sendRequest("/dashboards/create.json",options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def view(options = {})
|
13
|
+
return @api.sendRequest("/dashboards/view.json",options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def show_list(options = {})
|
17
|
+
return @api.sendRequest("/dashboards/show_list.json",options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def access(options = {})
|
21
|
+
return @api.sendRequest("/dashboards/access.json",options)
|
22
|
+
end
|
23
|
+
|
24
|
+
def leave(options = {})
|
25
|
+
return @api.sendRequest("/dashboards/leave.json",options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_title(options = {})
|
29
|
+
return @api.sendRequest("/dashboards/set_title.json",options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def set_smart_labels(options = {})
|
33
|
+
return @api.sendRequest("/dashboards/set_smart_labels.json",options)
|
34
|
+
end
|
35
|
+
|
36
|
+
def delete(options = {})
|
37
|
+
return @api.sendRequest("/dashboards/delete.json",options)
|
38
|
+
end
|
39
|
+
|
40
|
+
def tasks(options = {})
|
41
|
+
return @api.sendRequest("/dashboards/tasks.json",options)
|
42
|
+
end
|
43
|
+
|
44
|
+
def confirm(options = {})
|
45
|
+
return @api.sendRequest("/dashboards/confirm.json",options)
|
46
|
+
end
|
47
|
+
|
48
|
+
def refuse(options = {})
|
49
|
+
return @api.sendRequest("/dashboards/refuse.json",options)
|
50
|
+
end
|
51
|
+
|
52
|
+
def invite_user_by_id(options = {})
|
53
|
+
return @api.sendRequest("/dashboards/invite_user_by_id.json",options)
|
54
|
+
end
|
55
|
+
|
56
|
+
def invite_user_by_email(options = {})
|
57
|
+
return @api.sendRequest("/dashboards/invite_user_by_email.json",options)
|
58
|
+
end
|
59
|
+
|
60
|
+
def need_upgrade_list(options = {})
|
61
|
+
return @api.sendRequest("/dashboards/need_upgrade_list.json",options)
|
62
|
+
end
|
63
|
+
|
64
|
+
def needs_upgrade(options = {})
|
65
|
+
return @api.sendRequest("/dashboards/needs_upgrade.json",options)
|
66
|
+
end
|
67
|
+
|
68
|
+
def reorder(options = {})
|
69
|
+
return @api.sendRequest("/dashboards/reorder.json",options)
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Producteev
|
2
|
+
class Labels
|
3
|
+
@api = nil
|
4
|
+
def initialize(api)
|
5
|
+
@api = api
|
6
|
+
end
|
7
|
+
|
8
|
+
def create(options = {})
|
9
|
+
return @api.sendRequest("/labels/create.json",options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def delete(options = {})
|
13
|
+
return @api.sendRequest("/labels/delete.json",options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def view(options = {})
|
17
|
+
return @api.sendRequest("/labels/view.json",options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def show_list(options = {})
|
21
|
+
return @api.sendRequest("/labels/show_list.json",options)
|
22
|
+
end
|
23
|
+
|
24
|
+
def tasks(options = {})
|
25
|
+
return @api.sendRequest("/labels/tasks.json",options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_title(options = {})
|
29
|
+
return @api.sendRequest("/labels/set_title.json",options)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module Producteev
|
2
|
+
class Tasks
|
3
|
+
@api = nil
|
4
|
+
def initialize(api)
|
5
|
+
@api = api
|
6
|
+
end
|
7
|
+
|
8
|
+
def create(options = {})
|
9
|
+
return @api.sendRequest("/tasks/create.json",options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def delete(options = {})
|
13
|
+
return @api.sendRequest("/tasks/delete.json",options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def view(options = {})
|
17
|
+
return @api.sendRequest("/tasks/view.json",options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def show_list(options = {})
|
21
|
+
return @api.sendRequest("/tasks/show_list.json",options)
|
22
|
+
end
|
23
|
+
|
24
|
+
def my_tasks(options = {})
|
25
|
+
return @api.sendRequest("/tasks/show_list.json",options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def my_tasks(options = {})
|
29
|
+
return @api.sendRequest("/tasks/archived.json",options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def my_team_tasks(options = {})
|
33
|
+
return @api.sendRequest("/tasks/my_team_tasks.json",options)
|
34
|
+
end
|
35
|
+
|
36
|
+
def set_title(options = {})
|
37
|
+
return @api.sendRequest("/tasks/set_title.json",options)
|
38
|
+
end
|
39
|
+
|
40
|
+
def set_status(options = {})
|
41
|
+
return @api.sendRequest("/tasks/set_status.json",options)
|
42
|
+
end
|
43
|
+
|
44
|
+
def set_star(options = {})
|
45
|
+
return @api.sendRequest("/tasks/set_star.json",options)
|
46
|
+
end
|
47
|
+
|
48
|
+
def set_responsible(options = {})
|
49
|
+
return @api.sendRequest("/tasks/set_responsible.json",options)
|
50
|
+
end
|
51
|
+
|
52
|
+
def unset_responsible(options = {})
|
53
|
+
return @api.sendRequest("/tasks/unset_responsible.json",options)
|
54
|
+
end
|
55
|
+
|
56
|
+
def set_deadline(options = {})
|
57
|
+
return @api.sendRequest("/tasks/set_deadline.json",options)
|
58
|
+
end
|
59
|
+
|
60
|
+
def unset_deadline(options = {})
|
61
|
+
return @api.sendRequest("/tasks/unset_deadline.json",options)
|
62
|
+
end
|
63
|
+
|
64
|
+
def set_reminder(options = {})
|
65
|
+
return @api.sendRequest("/tasks/set_reminder.json",options)
|
66
|
+
end
|
67
|
+
|
68
|
+
def set_repeating(options = {})
|
69
|
+
return @api.sendRequest("/tasks/set_repeating.json",options)
|
70
|
+
end
|
71
|
+
|
72
|
+
def unset_repeating(options = {})
|
73
|
+
return @api.sendRequest("/tasks/unset_repeating.json",options)
|
74
|
+
end
|
75
|
+
|
76
|
+
def labels(options = {})
|
77
|
+
return @api.sendRequest("/tasks/labels.json",options)
|
78
|
+
end
|
79
|
+
|
80
|
+
def change_labels(options = {})
|
81
|
+
return @api.sendRequest("/tasks/change_labels.json",options)
|
82
|
+
end
|
83
|
+
|
84
|
+
def set_workspace(options = {})
|
85
|
+
return @api.sendRequest("/tasks/set_workspace.json",options)
|
86
|
+
end
|
87
|
+
|
88
|
+
def note_view(options = {})
|
89
|
+
return @api.sendRequest("/tasks/note_view.json",options)
|
90
|
+
end
|
91
|
+
|
92
|
+
def notes_get(options = {})
|
93
|
+
return @api.sendRequest("/tasks/notes_get.json",options)
|
94
|
+
end
|
95
|
+
|
96
|
+
def note_create(options = {})
|
97
|
+
return @api.sendRequest("/tasks/note_create.json",options)
|
98
|
+
end
|
99
|
+
|
100
|
+
def note_delete(options = {})
|
101
|
+
return @api.sendRequest("/tasks/note_delete.json",options)
|
102
|
+
end
|
103
|
+
|
104
|
+
def activity_view(options = {})
|
105
|
+
return @api.sendRequest("/tasks/activity_view.json",options)
|
106
|
+
end
|
107
|
+
|
108
|
+
def activities_get(options = {})
|
109
|
+
return @api.sendRequest("/tasks/activities_get.json",options)
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Producteev
|
2
|
+
class Users
|
3
|
+
@api = nil
|
4
|
+
def initialize(api)
|
5
|
+
@api = api
|
6
|
+
end
|
7
|
+
|
8
|
+
def view(options = {})
|
9
|
+
return @api.sendRequest("/users/view.json",options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def set_default_dashboard(options = {})
|
13
|
+
return @api.sendRequest("/users/set_default_dashboard.json",options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def colleagues(options = {})
|
17
|
+
return @api.sendRequest("/users/colleagues.json",options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_sort_by(options = {})
|
21
|
+
return @api.sendRequest("/users/set_sort_by.json",options)
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_timezone(options = {})
|
25
|
+
return @api.sendRequest("/users/set_timezone.json",options)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/producteev.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler/setup"
|
3
|
+
require 'digest/md5'
|
4
|
+
require "httparty"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
require File.expand_path('../producteev/api.rb', __FILE__)
|
8
|
+
require File.expand_path('../producteev/labels.rb', __FILE__)
|
9
|
+
require File.expand_path('../producteev/tasks.rb', __FILE__)
|
10
|
+
require File.expand_path('../producteev/activities.rb', __FILE__)
|
11
|
+
require File.expand_path('../producteev/dashboards.rb', __FILE__)
|
12
|
+
require File.expand_path('../producteev/users.rb', __FILE__)
|
13
|
+
require File.expand_path('../producteev/client.rb', __FILE__)
|
14
|
+
|
15
|
+
module Producteev
|
16
|
+
class << self
|
17
|
+
|
18
|
+
def new(apikey,secret, debug = false)
|
19
|
+
Producteev::Client.new(apikey,secret,debug)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/producteev.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'producteev'
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.date = '2012-01-26'
|
5
|
+
s.summary = "Api client for producteev"
|
6
|
+
s.description = "Api client for producteev"
|
7
|
+
s.authors = ["Stephen Johnson"]
|
8
|
+
s.email = 'steve@thatbytes.co.uk'
|
9
|
+
s.files = ["lib/hola.rb"]
|
10
|
+
s.homepage =
|
11
|
+
'http://github.com/stephenrjohnson/producteev'
|
12
|
+
|
13
|
+
s.add_dependency 'httparty'
|
14
|
+
s.add_dependency 'json'
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: producteev
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Stephen Johnson
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: httparty
|
16
|
+
requirement: &13744140 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *13744140
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: json
|
27
|
+
requirement: &13762820 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *13762820
|
36
|
+
description: Api client for producteev
|
37
|
+
email: steve@thatbytes.co.uk
|
38
|
+
executables: []
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
41
|
+
files:
|
42
|
+
- Gemfile
|
43
|
+
- Gemfile.lock
|
44
|
+
- README.md
|
45
|
+
- lib/producteev.rb
|
46
|
+
- lib/producteev/activities.rb
|
47
|
+
- lib/producteev/api.rb
|
48
|
+
- lib/producteev/client.rb
|
49
|
+
- lib/producteev/dashboards.rb
|
50
|
+
- lib/producteev/labels.rb
|
51
|
+
- lib/producteev/tasks.rb
|
52
|
+
- lib/producteev/users.rb
|
53
|
+
- producteev.gemspec
|
54
|
+
homepage: http://github.com/stephenrjohnson/producteev
|
55
|
+
licenses: []
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 1.8.10
|
75
|
+
signing_key:
|
76
|
+
specification_version: 3
|
77
|
+
summary: Api client for producteev
|
78
|
+
test_files: []
|