zendesk_api 0.2.1 → 0.2.2
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.
- data/Gemfile.lock +1 -1
- data/lib/zendesk_api/resources.rb +39 -21
- data/lib/zendesk_api/server/docs/account_settings.md +39 -1
- data/lib/zendesk_api/server/docs/automations.md +250 -0
- data/lib/zendesk_api/server/docs/categories.md +4 -4
- data/lib/zendesk_api/server/docs/forums.md +4 -4
- data/lib/zendesk_api/server/docs/introduction.md +5 -1
- data/lib/zendesk_api/server/docs/macros.md +1 -1
- data/lib/zendesk_api/server/docs/organizations.md +19 -0
- data/lib/zendesk_api/server/docs/requests.md +8 -4
- data/lib/zendesk_api/server/docs/suspended_tickets.md +3 -1
- data/lib/zendesk_api/server/docs/tags.md +109 -0
- data/lib/zendesk_api/server/docs/ticket_audits.md +20 -3
- data/lib/zendesk_api/server/docs/tickets.md +20 -2
- data/lib/zendesk_api/server/docs/topic_comments.md +4 -4
- data/lib/zendesk_api/server/docs/topics.md +1 -1
- data/lib/zendesk_api/server/docs/triggers.md +59 -1
- data/lib/zendesk_api/server/docs/user_identities.md +1 -1
- data/lib/zendesk_api/server/docs/users.md +11 -0
- data/lib/zendesk_api/server/docs/views.md +105 -15
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/core/spec_helper.rb +2 -0
- data/spec/fixtures/zendesk.rb +78 -75
- data/spec/live/ticket_spec.rb +28 -1
- metadata +3 -2
data/Gemfile.lock
CHANGED
@@ -23,9 +23,7 @@ module ZendeskAPI
|
|
23
23
|
class Topic < Resource; end
|
24
24
|
class Bookmark < Resource; end
|
25
25
|
class Ability < DataResource; end
|
26
|
-
class Macro < Resource; end
|
27
26
|
class Group < Resource; end
|
28
|
-
class Trigger < ReadResource; end
|
29
27
|
class SharingAgreement < ReadResource; end
|
30
28
|
class JobStatus < ReadResource; end
|
31
29
|
|
@@ -185,28 +183,17 @@ module ZendeskAPI
|
|
185
183
|
class Request < Resource
|
186
184
|
class Comment < ReadResource
|
187
185
|
has_many Attachment, :inline => true
|
186
|
+
has :author, :class => User
|
188
187
|
end
|
189
188
|
|
190
189
|
has_many Comment
|
190
|
+
|
191
191
|
has Organization
|
192
|
+
has :requester, :class => User
|
192
193
|
end
|
193
194
|
|
194
195
|
class TicketField < Resource; end
|
195
196
|
|
196
|
-
class TicketComment < Data
|
197
|
-
include Save
|
198
|
-
|
199
|
-
has_many :uploads, :class => Attachment, :inline => true
|
200
|
-
has :author, :class => User
|
201
|
-
|
202
|
-
def save
|
203
|
-
save_associations
|
204
|
-
true
|
205
|
-
end
|
206
|
-
|
207
|
-
alias :save! :save
|
208
|
-
end
|
209
|
-
|
210
197
|
class TicketMetric < DataResource
|
211
198
|
extend Read
|
212
199
|
end
|
@@ -217,6 +204,22 @@ module ZendeskAPI
|
|
217
204
|
has :author, :class => User
|
218
205
|
end
|
219
206
|
|
207
|
+
class Tag < Resource; end
|
208
|
+
|
209
|
+
class Comment < Data
|
210
|
+
include Save
|
211
|
+
|
212
|
+
has_many :uploads, :class => Attachment, :inline => true
|
213
|
+
has :author, :class => User
|
214
|
+
|
215
|
+
def save
|
216
|
+
save_associations
|
217
|
+
true
|
218
|
+
end
|
219
|
+
|
220
|
+
alias :save! :save
|
221
|
+
end
|
222
|
+
|
220
223
|
has :requester, :class => User, :inline => :create
|
221
224
|
has :submitter, :class => User
|
222
225
|
has :assignee, :class => User
|
@@ -227,8 +230,9 @@ module ZendeskAPI
|
|
227
230
|
has :forum_topic, :class => Topic
|
228
231
|
has Organization
|
229
232
|
|
230
|
-
has :comment, :class =>
|
231
|
-
has :last_comment, :class =>
|
233
|
+
has :comment, :class => Comment, :inline => true
|
234
|
+
has :last_comment, :class => Comment, :inline => true
|
235
|
+
has_many :last_comments, :class => Comment, :inline => true
|
232
236
|
|
233
237
|
# Gets a incremental export of tickets from the start_time until now.
|
234
238
|
# @param [Client] client The {Client} object to be used
|
@@ -272,16 +276,18 @@ module ZendeskAPI
|
|
272
276
|
end
|
273
277
|
end
|
274
278
|
|
275
|
-
class
|
279
|
+
class RuleExecution < Data
|
276
280
|
has_many :custom_fields, :class => TicketField
|
277
281
|
end
|
278
282
|
|
279
283
|
class ViewCount < DataResource; end
|
280
284
|
|
281
|
-
class View <
|
285
|
+
class View < Resource
|
282
286
|
has_many :tickets, :class => Ticket
|
287
|
+
has_many :feed, :class => Ticket, :path => "feed"
|
288
|
+
|
283
289
|
has_many :rows, :class => ViewRow, :path => "execute"
|
284
|
-
has :execution, :class =>
|
290
|
+
has :execution, :class => RuleExecution
|
285
291
|
has ViewCount, :path => "count"
|
286
292
|
|
287
293
|
def self.preview(client, options = {})
|
@@ -289,6 +295,18 @@ module ZendeskAPI
|
|
289
295
|
end
|
290
296
|
end
|
291
297
|
|
298
|
+
class Trigger < Resource
|
299
|
+
has :execution, :class => RuleExecution
|
300
|
+
end
|
301
|
+
|
302
|
+
class Automation < Resource
|
303
|
+
has :execution, :class => RuleExecution
|
304
|
+
end
|
305
|
+
|
306
|
+
class Macro < Resource
|
307
|
+
has :execution, :class => RuleExecution
|
308
|
+
end
|
309
|
+
|
292
310
|
class GroupMembership < Resource
|
293
311
|
has User
|
294
312
|
has Group
|
@@ -32,6 +32,7 @@ Account Settings are read-only. They contain settings for the various aspects of
|
|
32
32
|
| list_empty_views | boolean | Clients should display Views with no matching Tickets in menus
|
33
33
|
| maximum_personal_views_to_list | number | Maximum number of personal Views clients should display in menus
|
34
34
|
| tagging | boolean | Tickets may be tagged
|
35
|
+
| markdown_ticket_comments | boolean | Whether agent comments should be processed with Markdown
|
35
36
|
|
36
37
|
### Chat
|
37
38
|
|
@@ -69,6 +70,12 @@ Account Settings are read-only. They contain settings for the various aspects of
|
|
69
70
|
| host | string | The Screenr domain used when recording and playing Screencasts.
|
70
71
|
| tickets_recorder_id | string | The Screenr Recorder id used when recording Screencasts.
|
71
72
|
|
73
|
+
### GooddataAdvancedAnalytics
|
74
|
+
|
75
|
+
| Name | Type | Comment
|
76
|
+
| ---------------------------------- | ------- | -------
|
77
|
+
| enabled | boolean | GoodData Advanced Analytics is enabled
|
78
|
+
|
72
79
|
|
73
80
|
#### Example
|
74
81
|
|
@@ -93,7 +100,8 @@ Account Settings are read-only. They contain settings for the various aspects of
|
|
93
100
|
"agent_collision": true
|
94
101
|
"list_empty_views": true,
|
95
102
|
"maximum_personal_views_to_list": 12,
|
96
|
-
"tagging": true
|
103
|
+
"tagging": true,
|
104
|
+
"markdown_ticket_comments": false
|
97
105
|
},
|
98
106
|
"chat": {
|
99
107
|
"maximum_request_count": 5,
|
@@ -135,6 +143,36 @@ curl https://{subdomain}.zendesk.com/api/v2/account/settings.json \
|
|
135
143
|
```http
|
136
144
|
Status: 200 OK
|
137
145
|
|
146
|
+
"settings": {
|
147
|
+
"apps": {.. },
|
148
|
+
"tickets": { ... },
|
149
|
+
"chat": { ... },
|
150
|
+
"twitter": { ... },
|
151
|
+
"users": { ... }
|
152
|
+
}
|
153
|
+
```
|
154
|
+
|
155
|
+
### Update Account Settings
|
156
|
+
`PUT /api/v2/account/settings.json`
|
157
|
+
|
158
|
+
#### Allowed For
|
159
|
+
|
160
|
+
* Admins
|
161
|
+
|
162
|
+
#### Using curl
|
163
|
+
|
164
|
+
```bash
|
165
|
+
curl https://{subdomain}.zendesk.com/api/v2/account/settings.json \
|
166
|
+
-H "Content-Type: application/json" -X PUT \
|
167
|
+
-d '{ "settings": { "lotus": { "prefer_lotus": false }}}' \
|
168
|
+
-v -u {email_address}:{password}
|
169
|
+
```
|
170
|
+
|
171
|
+
#### Example Response
|
172
|
+
|
173
|
+
```http
|
174
|
+
Status: 200 OK
|
175
|
+
|
138
176
|
"settings": {
|
139
177
|
"apps": {.. },
|
140
178
|
"tickets": { ... },
|
@@ -0,0 +1,250 @@
|
|
1
|
+
## Automations
|
2
|
+
|
3
|
+
### JSON Format
|
4
|
+
Automations are represented as simple flat JSON objects which have the following keys.
|
5
|
+
|
6
|
+
| Name | Type | Comment
|
7
|
+
| --------------- | ---------------------------| -------------------
|
8
|
+
| id | integer | Automatically assigned when created
|
9
|
+
| title | string | The title of the trigger
|
10
|
+
| active | boolean | Whether the trigger is active
|
11
|
+
| conditions | [Conditions](#conditions) | An object that describes the conditions under which the trigger will execute
|
12
|
+
| actions | [Actions](#actions) | An object describing what the trigger will do
|
13
|
+
| created_at | date | The time the trigger was created
|
14
|
+
| updated_at | date | The time of the last update of the trigger
|
15
|
+
|
16
|
+
#### Example
|
17
|
+
```js
|
18
|
+
{
|
19
|
+
"automation": {
|
20
|
+
"id": 25,
|
21
|
+
"title": "Notify requester of comment update",
|
22
|
+
"active": true,
|
23
|
+
"actions": { ... },
|
24
|
+
"conditions": { ... },
|
25
|
+
"updated_at": "2012-09-25T22:50:26Z",
|
26
|
+
"created_at": "2012-09-25T22:50:26Z"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
```
|
30
|
+
|
31
|
+
### Conditions
|
32
|
+
The conditions under which a ticket is selected.
|
33
|
+
|
34
|
+
| Name | Type | Comment
|
35
|
+
| ------------ | ------- | -------
|
36
|
+
| all | array | Tickets must fulfill *all* of these conditions to be considered matching
|
37
|
+
| any | array | Tickets may satisfy *any* of these conditions to be considered matching
|
38
|
+
|
39
|
+
#### Example
|
40
|
+
```js
|
41
|
+
{
|
42
|
+
"conditions": {
|
43
|
+
"all": [
|
44
|
+
{ "field": "status", "operator": "less_than", "value": "solved" },
|
45
|
+
{ "field": "assignee", "operator": "is", "value": "me" },
|
46
|
+
],
|
47
|
+
"any": [
|
48
|
+
]
|
49
|
+
}
|
50
|
+
}
|
51
|
+
```
|
52
|
+
|
53
|
+
### Actions
|
54
|
+
The actions that will be applied to the ticket.
|
55
|
+
|
56
|
+
| Name | Type | Comment
|
57
|
+
| ------------ | ------- | -------
|
58
|
+
| field | string | The ticket field being modified
|
59
|
+
| value | string | The new value of the field
|
60
|
+
|
61
|
+
#### Example
|
62
|
+
```js
|
63
|
+
{
|
64
|
+
"actions": [
|
65
|
+
{ "field": "status", "value": "solved" },
|
66
|
+
{ "field": "assignee", "value": "me" },
|
67
|
+
]
|
68
|
+
}
|
69
|
+
```
|
70
|
+
|
71
|
+
### List Automations
|
72
|
+
`GET /api/v2/automations.json`
|
73
|
+
|
74
|
+
Lists all automations for the current account
|
75
|
+
|
76
|
+
#### Allowed For:
|
77
|
+
|
78
|
+
* Agents
|
79
|
+
|
80
|
+
#### Using curl
|
81
|
+
|
82
|
+
```bash
|
83
|
+
curl https://{subdomain}.zendesk.com/api/v2/automations.json \
|
84
|
+
-v -u {email_address}:{password}
|
85
|
+
```
|
86
|
+
|
87
|
+
#### Example Response
|
88
|
+
|
89
|
+
```http
|
90
|
+
Status: 200 OK
|
91
|
+
|
92
|
+
{
|
93
|
+
"automations": [
|
94
|
+
{
|
95
|
+
"id": 25,
|
96
|
+
"title": "Close and Save",
|
97
|
+
"active": true
|
98
|
+
"conditions": [ ... ],
|
99
|
+
"actions": [ ... ],
|
100
|
+
...
|
101
|
+
},
|
102
|
+
{
|
103
|
+
"id": 26,
|
104
|
+
"title": "Assign priority tag",
|
105
|
+
"active": false
|
106
|
+
"conditions": [ ... ],
|
107
|
+
"actions": [ ... ],
|
108
|
+
...
|
109
|
+
}
|
110
|
+
],
|
111
|
+
"count": 2,
|
112
|
+
"previous_page": null,
|
113
|
+
"next_page": null
|
114
|
+
}
|
115
|
+
```
|
116
|
+
|
117
|
+
### Getting Automations
|
118
|
+
`GET /api/v2/automations/{id}.json`
|
119
|
+
|
120
|
+
#### Allowed For:
|
121
|
+
|
122
|
+
* Agents
|
123
|
+
|
124
|
+
#### Using curl
|
125
|
+
|
126
|
+
```bash
|
127
|
+
curl https://{subdomain}.zendesk.com/api/v2/automations/{id}.json \
|
128
|
+
-v -u {email_address}:{password}
|
129
|
+
```
|
130
|
+
|
131
|
+
#### Example Response
|
132
|
+
|
133
|
+
```http
|
134
|
+
Status: 200 OK
|
135
|
+
|
136
|
+
{
|
137
|
+
"automation": {
|
138
|
+
"id": 25,
|
139
|
+
"title": "Tickets updated <12 Hours",
|
140
|
+
"active": true
|
141
|
+
"conditions": [ ... ],
|
142
|
+
"actions": [ ... ],
|
143
|
+
...
|
144
|
+
}
|
145
|
+
}
|
146
|
+
```
|
147
|
+
|
148
|
+
### List active Automations
|
149
|
+
`GET /api/v2/automations/active.json`
|
150
|
+
|
151
|
+
Lists all active automations
|
152
|
+
|
153
|
+
#### Allowed For:
|
154
|
+
|
155
|
+
* Agents
|
156
|
+
|
157
|
+
#### Using curl
|
158
|
+
|
159
|
+
```bash
|
160
|
+
curl https://{subdomain}.zendesk.com/api/v2/automations/active.json \
|
161
|
+
-v -u {email_address}:{password}
|
162
|
+
```
|
163
|
+
|
164
|
+
#### Example Response
|
165
|
+
|
166
|
+
```http
|
167
|
+
Status: 200 OK
|
168
|
+
|
169
|
+
{
|
170
|
+
"automations": [
|
171
|
+
{
|
172
|
+
"id": 25,
|
173
|
+
"title": "Close and Save",
|
174
|
+
"active": true
|
175
|
+
"conditions": [ ... ],
|
176
|
+
"actions": [ ... ],
|
177
|
+
...
|
178
|
+
},
|
179
|
+
{
|
180
|
+
"id": 28,
|
181
|
+
"title": "Close and redirect to topics",
|
182
|
+
"active": true
|
183
|
+
"conditions": [ ... ],
|
184
|
+
"actions": [ ... ],
|
185
|
+
...
|
186
|
+
}
|
187
|
+
],
|
188
|
+
"count": 2,
|
189
|
+
"previous_page": null,
|
190
|
+
"next_page": null
|
191
|
+
}
|
192
|
+
```
|
193
|
+
|
194
|
+
### Create Automation
|
195
|
+
`POST /api/v2/automations.json`
|
196
|
+
|
197
|
+
#### Allowed For
|
198
|
+
|
199
|
+
* Agents
|
200
|
+
|
201
|
+
#### Using curl
|
202
|
+
|
203
|
+
```bash
|
204
|
+
curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/api/v2/automations.json \
|
205
|
+
-H "Content-Type: application/json" -X POST -d \
|
206
|
+
'{"automation":{"title":"Roger Wilco", "all": [{ "field": "status", "operator": "is", "value": "open" }], "actions": [{ "field": "status", "value": "closed" }]}}'
|
207
|
+
```
|
208
|
+
|
209
|
+
#### Example Response
|
210
|
+
|
211
|
+
```http
|
212
|
+
Status: 201 Created
|
213
|
+
Location: /api/v2/automation/{new-automation-id}.json
|
214
|
+
|
215
|
+
{
|
216
|
+
"automation": {
|
217
|
+
"id": 9873843,
|
218
|
+
"title": "Roger Wilco",
|
219
|
+
...
|
220
|
+
}
|
221
|
+
}
|
222
|
+
```
|
223
|
+
|
224
|
+
### Update Automation
|
225
|
+
`PUT /api/v2/automations/{id}.json`
|
226
|
+
|
227
|
+
#### Allowed For
|
228
|
+
|
229
|
+
* Agents
|
230
|
+
|
231
|
+
#### Using curl
|
232
|
+
|
233
|
+
```bash
|
234
|
+
curl -v -u {email_address}:{password} https://{subdomain}.zendesk.com/automations/{id}.json \
|
235
|
+
-H "Content-Type: application/json" -X PUT -d '{"automation":{"title":"Roger Wilco II"}}'
|
236
|
+
```
|
237
|
+
|
238
|
+
#### Example Response
|
239
|
+
|
240
|
+
```http
|
241
|
+
Status: 200 OK
|
242
|
+
|
243
|
+
{
|
244
|
+
"automation": {
|
245
|
+
"id": 9873843,
|
246
|
+
"title": "Roger Wilco II",
|
247
|
+
...
|
248
|
+
}
|
249
|
+
}
|
250
|
+
```
|
@@ -36,7 +36,7 @@ Accounts that have forum categories
|
|
36
36
|
#### Allowed For:
|
37
37
|
|
38
38
|
* Admins on non-enterprise accounts
|
39
|
-
* Admins and agents
|
39
|
+
* Admins and agents with full forum access on enterprise accounts
|
40
40
|
|
41
41
|
#### Using curl
|
42
42
|
|
@@ -110,7 +110,7 @@ Status: 200 OK
|
|
110
110
|
#### Allowed For
|
111
111
|
|
112
112
|
* Admins on non-enterprise accounts
|
113
|
-
* Admins and agents
|
113
|
+
* Admins and agents with full forum access on enterprise accounts
|
114
114
|
|
115
115
|
#### Using curl
|
116
116
|
|
@@ -144,7 +144,7 @@ Location: https://{subdomain}.zendesk.com/api/v2/categories/{id}.json
|
|
144
144
|
#### Allowed For
|
145
145
|
|
146
146
|
* Admins on non-enterprise accounts
|
147
|
-
* Admins and agents
|
147
|
+
* Admins and agents with full forum access on enterprise accounts
|
148
148
|
|
149
149
|
#### Using curl
|
150
150
|
|
@@ -177,7 +177,7 @@ Status: 200 OK
|
|
177
177
|
#### Allowed For
|
178
178
|
|
179
179
|
* Admins on non-enterprise accounts
|
180
|
-
* Admins and agents
|
180
|
+
* Admins and agents with full forum access on enterprise accounts
|
181
181
|
|
182
182
|
#### Using curl
|
183
183
|
|