worksection-ruby 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/README.md +101 -3
- data/lib/worksection/modules/getting_data.rb +21 -11
- data/lib/worksection/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6c0d980e612a4a3a25b119ee6fc9dbbbe49415b923a0634367c3279b417b7a2
|
4
|
+
data.tar.gz: ad9e85aca8ca8d38ce681430dcdf4a1a2c2ab368e4fa866d89d22e864f9fbbd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d56355caa674d4ce6cce499d4e9ffd3a5b27485e6c33977480b401d8a9c2c8e06457ce1aed0ba93dc5370a3fd2abf2d8247454634e4dfaef6042e231cdebcfe5
|
7
|
+
data.tar.gz: 15a2fd1bcc1992da3c9e36b66446551cf3c037608e09a207398f36227501efe35ccfaf7e07d2ae7ed2012f99c22e232d21dbf8ff81b7a7d39d84c70bf368f293
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Or install it yourself as:
|
|
19
19
|
$ gem install worksection-ruby
|
20
20
|
|
21
21
|
## Usage
|
22
|
-
###
|
22
|
+
###API methods: getting data
|
23
23
|
Action | Method | Hash Parameters
|
24
24
|
-------|--------|-----------
|
25
25
|
Returns project names, their statuses (archive, active, pending), company and relative reference to the project. |get_projects|
|
@@ -30,7 +30,7 @@ Returns the costs incurred for the period, their executor (user_from field), cor
|
|
30
30
|
Returns the text field with user comments|get_comments|
|
31
31
|
Returns data about all users in account|get_users|
|
32
32
|
|
33
|
-
###
|
33
|
+
###API methods: creating projects/tasks/comments
|
34
34
|
|
35
35
|
Action | Method | Hash Parameters
|
36
36
|
-------|--------|-----------
|
@@ -40,7 +40,7 @@ Creating a Subtask|post_subtask|
|
|
40
40
|
Placement of time and financial costs in the task or subtask|post_timemoney|
|
41
41
|
Inviting user to the account|add_user|
|
42
42
|
|
43
|
-
###
|
43
|
+
###API methods: editing projects/tasks/subtasks/tags
|
44
44
|
|
45
45
|
Action | Method | Hash Parameters
|
46
46
|
-------|--------|-----------
|
@@ -59,6 +59,104 @@ Subscribe user to a task|subscribe|
|
|
59
59
|
Unsubscribe user from task|unsubscribe|
|
60
60
|
Update tags in task/subtask|update_tags|
|
61
61
|
|
62
|
+
|
63
|
+
## Usage examples
|
64
|
+
|
65
|
+
````ruby
|
66
|
+
require "worksection"
|
67
|
+
|
68
|
+
DOMAIN_NAME = "<worksection_domain_name>"
|
69
|
+
WORKSECTION_KEY = "<worksection_api_key>"
|
70
|
+
|
71
|
+
client = Worksection::Client.new(DOMAIN_NAME, WORKSECTION_KEY)
|
72
|
+
````
|
73
|
+
Here are some common use cases for the Worksection Administrative API (v.05).
|
74
|
+
|
75
|
+
### You can list all projects for organization
|
76
|
+
````ruby
|
77
|
+
puts "#{ JSON.pretty_generate(client.get_projects)}"
|
78
|
+
=>
|
79
|
+
{
|
80
|
+
"status": "ok",
|
81
|
+
"data": [
|
82
|
+
{
|
83
|
+
"name": "ProjectName0",
|
84
|
+
"page": "/project/61028/",
|
85
|
+
"status": "active",
|
86
|
+
"company": "CompanyName",
|
87
|
+
"user_from": {
|
88
|
+
"email": "john.doe@email.com",
|
89
|
+
"name": "John Doe"
|
90
|
+
},
|
91
|
+
"user_to": {
|
92
|
+
"email": "john.doe@email.com",
|
93
|
+
"name": "John Doe"
|
94
|
+
}
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"name": "ProjectName1",
|
98
|
+
"page": "/project/46167/",
|
99
|
+
"status": "active",
|
100
|
+
"company": "CompanyName",
|
101
|
+
"user_from": {
|
102
|
+
"email": "bob.doe@email.com",
|
103
|
+
"name": "Bob Doe"
|
104
|
+
},
|
105
|
+
"user_to": {
|
106
|
+
"email": "bob.doe@email.com",
|
107
|
+
"name": "Bob Doe"
|
108
|
+
},
|
109
|
+
"max_money": 1950
|
110
|
+
}
|
111
|
+
]
|
112
|
+
}
|
113
|
+
|
114
|
+
````
|
115
|
+
|
116
|
+
### You can list all tasks for organization
|
117
|
+
|
118
|
+
````ruby
|
119
|
+
puts "#{ JSON.pretty_generate(client.get_all_tasks)}"
|
120
|
+
=>
|
121
|
+
{
|
122
|
+
"status": "ok",
|
123
|
+
"data": [
|
124
|
+
{
|
125
|
+
"name": "Task1",
|
126
|
+
"page": "/project/55735/1419268/",
|
127
|
+
"status": "active",
|
128
|
+
"priority": "1",
|
129
|
+
"user_from": {
|
130
|
+
"email": "bob.doe@email.com",
|
131
|
+
"name": "Bob Doe"
|
132
|
+
},
|
133
|
+
"user_to": {
|
134
|
+
"email": "john.doe@email.com",
|
135
|
+
"name": "John Doe"
|
136
|
+
},
|
137
|
+
"date_added": "2019-08-22 17:41",
|
138
|
+
"max_time": 6
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"name": "Task2",
|
142
|
+
"page": "/project/61824/1475984/",
|
143
|
+
"status": "active",
|
144
|
+
"priority": "0",
|
145
|
+
"user_from": {
|
146
|
+
"email": "john.doe@email.com",
|
147
|
+
"name": "John Doe"
|
148
|
+
},
|
149
|
+
"user_to": {
|
150
|
+
"email": "john.doe@email.com",
|
151
|
+
"name": "John Doe"
|
152
|
+
},
|
153
|
+
"date_added": "2019-08-29 18:41"
|
154
|
+
}
|
155
|
+
]
|
156
|
+
}
|
157
|
+
|
158
|
+
````
|
159
|
+
|
62
160
|
## Contributing
|
63
161
|
|
64
162
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/worksection-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -1,39 +1,49 @@
|
|
1
1
|
class Worksection::Client
|
2
2
|
module GettingData
|
3
3
|
#https://your-domain.com/api/admin/?action=get_projects&hash=HASH
|
4
|
-
def get_projects
|
5
|
-
url = URI("https://#{@domain}/api/admin/?action=get_projects
|
4
|
+
def get_projects(**args)
|
5
|
+
url = URI("https://#{@domain}/api/admin/?action=get_projects
|
6
|
+
#{collect_params(**args)}
|
7
|
+
&hash=#{to_md5(__method__.to_s)}")
|
6
8
|
perform_request(url)
|
7
9
|
end
|
8
10
|
|
9
11
|
#https://your-domain.com/api/admin/?action=get_all_tasks&hash=HASH
|
10
|
-
def get_all_tasks
|
11
|
-
url = URI("https://#{@domain}/api/admin/?action=get_all_tasks
|
12
|
+
def get_all_tasks(**args)
|
13
|
+
url = URI("https://#{@domain}/api/admin/?action=get_all_tasks
|
14
|
+
#{collect_params(**args)}
|
15
|
+
&hash=#{to_md5(__method__.to_s)}")
|
12
16
|
perform_request(url)
|
13
17
|
end
|
14
18
|
|
15
19
|
#https://your-domain.com/api/admin/?action=get_priority&hash=HASH
|
16
|
-
def get_priority
|
17
|
-
url = URI("https://#{@domain}/api/admin/?action=get_priority
|
20
|
+
def get_priority(**args)
|
21
|
+
url = URI("https://#{@domain}/api/admin/?action=get_priority
|
22
|
+
#{collect_params(**args)}
|
23
|
+
&hash=#{to_md5(__method__.to_s)}")
|
18
24
|
perform_request(url)
|
19
25
|
end
|
20
26
|
|
21
27
|
#https://your-domain.com/api/admin/?action=get_task&page=/project/PROJECT_ID/TASK_ID/&hash=HASH
|
22
|
-
def get_task(project_id, task_id)
|
28
|
+
def get_task(project_id, task_id, **args)
|
23
29
|
page = "/project/#{project_id}/#{task_id}/"
|
24
|
-
url = URI("https://#{@domain}/api/admin/?action=get_task&page=#{page}
|
30
|
+
url = URI("https://#{@domain}/api/admin/?action=get_task&page=#{page}
|
31
|
+
#{collect_params(**args)}
|
32
|
+
&hash=#{to_md5(__method__.to_s, page)}")
|
25
33
|
perform_request(url)
|
26
34
|
end
|
27
35
|
|
28
36
|
#https://your-domain.com/api/admin/?action=get_tasks&page=/project/PROJECT_ID/&hash=HASH
|
29
|
-
def get_tasks(project_id)
|
37
|
+
def get_tasks(project_id, **args)
|
30
38
|
page = "/project/#{project_id}"
|
31
|
-
url = URI("https://#{@domain}/api/admin/?action=get_tasks&page=#{page}
|
39
|
+
url = URI("https://#{@domain}/api/admin/?action=get_tasks&page=#{page}
|
40
|
+
#{collect_params(**args)}
|
41
|
+
&hash=#{to_md5(__method__.to_s, page)}")
|
32
42
|
perform_request(url)
|
33
43
|
end
|
34
44
|
|
35
45
|
#https://your-domain.com/api/admin/?action=get_timemoney&hash=HASH
|
36
|
-
def get_timemoney
|
46
|
+
def get_timemoney(**args)
|
37
47
|
url = URI("https://#{@domain}/api/admin/?action=get_timemoney&hash=#{to_md5(__method__.to_s)}")
|
38
48
|
perform_request(url)
|
39
49
|
end
|
data/lib/worksection/version.rb
CHANGED