zendesk_api 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +28 -27
- data/lib/zendesk_api/rescue.rb +15 -0
- data/lib/zendesk_api/resource.rb +1 -0
- data/lib/zendesk_api/server/docs/attachments.md +69 -0
- data/lib/zendesk_api/server/docs/changes_roadmap.md +211 -0
- data/lib/zendesk_api/server/docs/satisfaction_ratings.md +36 -0
- data/lib/zendesk_api/server/docs/ticket_audits.md +27 -13
- data/lib/zendesk_api/server/docs/users.md +44 -0
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/core/rescue_spec.rb +24 -1
- data/spec/core/spec_helper.rb +1 -1
- data/spec/live/collection_spec.rb +2 -6
- data/spec/live/locale_spec.rb +1 -3
- data/spec/live/ticket_spec.rb +1 -1
- data/spec/macros/resource_macros.rb +4 -11
- metadata +3 -2
data/Gemfile.lock
CHANGED
@@ -13,7 +13,7 @@ GIT
|
|
13
13
|
PATH
|
14
14
|
remote: .
|
15
15
|
specs:
|
16
|
-
zendesk_api (0.2.
|
16
|
+
zendesk_api (0.2.4)
|
17
17
|
faraday (>= 0.8.0)
|
18
18
|
faraday_middleware (>= 0.8.7)
|
19
19
|
hashie
|
@@ -25,19 +25,20 @@ PATH
|
|
25
25
|
GEM
|
26
26
|
remote: https://rubygems.org/
|
27
27
|
specs:
|
28
|
-
activemodel (3.2.
|
29
|
-
activesupport (= 3.2.
|
28
|
+
activemodel (3.2.11)
|
29
|
+
activesupport (= 3.2.11)
|
30
30
|
builder (~> 3.0.0)
|
31
|
-
activesupport (3.2.
|
31
|
+
activesupport (3.2.11)
|
32
32
|
i18n (~> 0.6)
|
33
33
|
multi_json (~> 1.0)
|
34
34
|
addressable (2.3.2)
|
35
35
|
backports (2.6.5)
|
36
|
-
bond (0.4.
|
37
|
-
bootstrap-sass (2.
|
36
|
+
bond (0.4.3)
|
37
|
+
bootstrap-sass (2.2.2.0)
|
38
|
+
sass (~> 3.2)
|
38
39
|
builder (3.0.4)
|
39
|
-
bump (0.3.
|
40
|
-
chunky_png (1.2.
|
40
|
+
bump (0.3.9)
|
41
|
+
chunky_png (1.2.7)
|
41
42
|
coderay (1.0.8)
|
42
43
|
coderay_bash (1.0.4)
|
43
44
|
coderay (>= 1.0)
|
@@ -45,7 +46,7 @@ GEM
|
|
45
46
|
chunky_png (~> 1.2)
|
46
47
|
fssm (>= 0.2.7)
|
47
48
|
sass (~> 3.1)
|
48
|
-
crack (0.3.
|
49
|
+
crack (0.3.2)
|
49
50
|
database_cleaner (0.9.1)
|
50
51
|
diff-lcs (1.1.3)
|
51
52
|
eventmachine (1.0.0)
|
@@ -57,35 +58,35 @@ GEM
|
|
57
58
|
haml (3.1.7)
|
58
59
|
i18n (0.6.1)
|
59
60
|
inflection (1.0.0)
|
60
|
-
json (1.7.
|
61
|
+
json (1.7.6)
|
61
62
|
mime-types (1.19)
|
62
|
-
mongoid (3.0.
|
63
|
+
mongoid (3.0.16)
|
63
64
|
activemodel (~> 3.1)
|
64
65
|
moped (~> 1.1)
|
65
66
|
origin (~> 1.0)
|
66
67
|
tzinfo (~> 0.3.22)
|
67
|
-
moped (1.2
|
68
|
-
multi_json (1.
|
69
|
-
origin (1.0.
|
70
|
-
rack (1.4.
|
71
|
-
rack-protection (1.2
|
68
|
+
moped (1.3.2)
|
69
|
+
multi_json (1.5.0)
|
70
|
+
origin (1.0.11)
|
71
|
+
rack (1.4.3)
|
72
|
+
rack-protection (1.3.2)
|
72
73
|
rack
|
73
|
-
rack-ssl-enforcer (0.2.
|
74
|
+
rack-ssl-enforcer (0.2.5)
|
74
75
|
rack-test (0.6.2)
|
75
76
|
rack (>= 1.0)
|
76
|
-
rake (0.
|
77
|
+
rake (10.0.3)
|
77
78
|
redcarpet (2.2.2)
|
78
79
|
ripl (0.7.0)
|
79
80
|
bond (~> 0.4.2)
|
80
|
-
rspec (2.
|
81
|
-
rspec-core (~> 2.
|
82
|
-
rspec-expectations (~> 2.
|
83
|
-
rspec-mocks (~> 2.
|
84
|
-
rspec-core (2.
|
85
|
-
rspec-expectations (2.
|
81
|
+
rspec (2.12.0)
|
82
|
+
rspec-core (~> 2.12.0)
|
83
|
+
rspec-expectations (~> 2.12.0)
|
84
|
+
rspec-mocks (~> 2.12.0)
|
85
|
+
rspec-core (2.12.2)
|
86
|
+
rspec-expectations (2.12.1)
|
86
87
|
diff-lcs (~> 1.1.3)
|
87
|
-
rspec-mocks (2.
|
88
|
-
sass (3.2.
|
88
|
+
rspec-mocks (2.12.1)
|
89
|
+
sass (3.2.5)
|
89
90
|
simplecov (0.7.1)
|
90
91
|
multi_json (~> 1.0)
|
91
92
|
simplecov-html (~> 0.7.1)
|
@@ -103,7 +104,7 @@ GEM
|
|
103
104
|
tilt (~> 1.3)
|
104
105
|
tilt (1.3.3)
|
105
106
|
tzinfo (0.3.35)
|
106
|
-
vcr (2.
|
107
|
+
vcr (2.4.0)
|
107
108
|
webmock (1.9.0)
|
108
109
|
addressable (>= 2.2.7)
|
109
110
|
crack (>= 0.1.7)
|
data/lib/zendesk_api/rescue.rb
CHANGED
@@ -17,6 +17,19 @@ module ZendeskAPI
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def attach_error(e)
|
21
|
+
return unless e.response
|
22
|
+
|
23
|
+
if error = e.response[:body]
|
24
|
+
if error.is_a?(Hash)
|
25
|
+
error = Hashie::Mash.new(error)
|
26
|
+
self.error_message = (error.error || error.description) if respond_to?("error_message=")
|
27
|
+
end
|
28
|
+
|
29
|
+
self.error = error if respond_to?("error=")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
20
33
|
def rescue_client_error(*args)
|
21
34
|
opts = args.last.is_a?(Hash) ? args.pop : {}
|
22
35
|
|
@@ -28,6 +41,7 @@ module ZendeskAPI
|
|
28
41
|
send("orig_#{method}", *args)
|
29
42
|
rescue Faraday::Error::ClientError => e
|
30
43
|
log_error(e, method)
|
44
|
+
attach_error(e)
|
31
45
|
opts[:with].respond_to?(:call) ? opts[:with].call : opts[:with]
|
32
46
|
end
|
33
47
|
end
|
@@ -37,6 +51,7 @@ module ZendeskAPI
|
|
37
51
|
yield
|
38
52
|
rescue Faraday::Error::ClientError => e
|
39
53
|
log_error(e)
|
54
|
+
attach_error(e)
|
40
55
|
opts[:with].respond_to?(:call) ? opts[:with].call : opts[:with]
|
41
56
|
end
|
42
57
|
end
|
data/lib/zendesk_api/resource.rb
CHANGED
@@ -70,4 +70,73 @@ Status: 201 Created
|
|
70
70
|
]
|
71
71
|
}
|
72
72
|
}
|
73
|
+
```
|
74
|
+
|
75
|
+
### Deleting Uploads
|
76
|
+
`DELETE /api/v2/uploads/{token}.json`
|
77
|
+
|
78
|
+
#### Allowed For
|
79
|
+
|
80
|
+
* Agents
|
81
|
+
|
82
|
+
#### Using curl
|
83
|
+
|
84
|
+
```bash
|
85
|
+
curl -u username:password -X DELETE https://helpdesk.zendesk.com/api/v2/uploads/{token}.json
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Example Response
|
89
|
+
|
90
|
+
```http
|
91
|
+
200 OK
|
92
|
+
```
|
93
|
+
|
94
|
+
### Getting Attachments
|
95
|
+
`GET /api/v2/attachments/{id}.json`
|
96
|
+
|
97
|
+
#### Allowed For
|
98
|
+
|
99
|
+
* Admins
|
100
|
+
|
101
|
+
#### Using curl
|
102
|
+
|
103
|
+
```bash
|
104
|
+
curl -u username:password https://helpdesk.zendesk.com/api/v2/attachments/{id}.json
|
105
|
+
```
|
106
|
+
|
107
|
+
#### Example Response
|
108
|
+
|
109
|
+
```http
|
110
|
+
{
|
111
|
+
"attachment": {
|
112
|
+
"id": 498483,
|
113
|
+
"name": "crash.log",
|
114
|
+
"content_url": "https://company.zendesk.com/attachments/crash.log",
|
115
|
+
"content_type": "text/plain",
|
116
|
+
"size": 2532,
|
117
|
+
"thumbnails": [],
|
118
|
+
"url": "https://company.zendesk.com/api/v2/attachments/498483.json",
|
119
|
+
}
|
120
|
+
}
|
121
|
+
```
|
122
|
+
|
123
|
+
### Deleting Attachments
|
124
|
+
`DELETE /api/v2/attachments/{id}.json`
|
125
|
+
|
126
|
+
Currently, only attachments on forum posts are allowed to be deleted.
|
127
|
+
|
128
|
+
#### Allowed For
|
129
|
+
|
130
|
+
* Admins
|
131
|
+
|
132
|
+
#### Using curl
|
133
|
+
|
134
|
+
```bash
|
135
|
+
curl -u username:password -X DELETE https://helpdesk.zendesk.com/api/v2/attachments/{id}.json
|
136
|
+
```
|
137
|
+
|
138
|
+
#### Example Response
|
139
|
+
|
140
|
+
```http
|
141
|
+
200 OK
|
73
142
|
```
|
@@ -0,0 +1,211 @@
|
|
1
|
+
## Changes Roadmap
|
2
|
+
|
3
|
+
As part of our [change policy](introduction.html#change-policy), we provide this roadmap of API changes to help developers plan for required changes to their integrations with Zendesk. Please also subscribe to our [API updates forum](https://support.zendesk.com/forums/20635666-api-changes) for announcements and changes to this roadmap.
|
4
|
+
|
5
|
+
### December 6, 2012
|
6
|
+
|
7
|
+
The following changes will go into effect on December 6, 2012:
|
8
|
+
|
9
|
+
#### Proper handling of requester and submitter for Ticket creation
|
10
|
+
|
11
|
+
##### Affected endpoints
|
12
|
+
|
13
|
+
``POST /api/v2/tickets.json``
|
14
|
+
|
15
|
+
##### What's changing
|
16
|
+
|
17
|
+
Our API is commonly used to create ticket submission forms on company websites. However, companies want to be able to set internally-facing fields on the ticket (such as tags), which requires agent authentication, while making the ticket appear as created by the customer. Today, any ticket created via the API inaccurately shows "via (Agent Name)" on the ticket UI.
|
18
|
+
|
19
|
+
This will change to only allow two valid states for a ticket's first comment author:
|
20
|
+
|
21
|
+
* Created by the requester, where the first comment author is the requester.
|
22
|
+
* Created by the requester via an agent, where the first comment author is an agent.
|
23
|
+
|
24
|
+
##### Example
|
25
|
+
|
26
|
+
The below will create a ticket where the requester is the first comment author:
|
27
|
+
|
28
|
+
```
|
29
|
+
{
|
30
|
+
"ticket": {
|
31
|
+
"comment": {
|
32
|
+
"value": "This is the ticket description"
|
33
|
+
},
|
34
|
+
"requester": {
|
35
|
+
"name": "Customer",
|
36
|
+
"email": "customer@domain.com"
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
```
|
41
|
+
|
42
|
+
The below will create a ticket where the agent designated as the submitter is the first comment author, and the ticket is shown as created by the requester, via the agent.
|
43
|
+
|
44
|
+
```
|
45
|
+
{
|
46
|
+
"ticket": {
|
47
|
+
"comment": {
|
48
|
+
"value": "This is the ticket description"
|
49
|
+
},
|
50
|
+
"requester": {
|
51
|
+
"name": "Customer",
|
52
|
+
"email": "customer@domain.com"
|
53
|
+
},
|
54
|
+
"submitter_id": 7
|
55
|
+
}
|
56
|
+
}
|
57
|
+
```
|
58
|
+
|
59
|
+
|
60
|
+
### February 7, 2013
|
61
|
+
|
62
|
+
The following changes will go into effect on February 7, 2013:
|
63
|
+
|
64
|
+
#### Removal of ``fields`` key in favor of ``custom_fields`` for Tickets, Requests and Macros
|
65
|
+
|
66
|
+
##### Affected endpoints
|
67
|
+
|
68
|
+
* ``GET /api/v2/tickets/{id}.json``
|
69
|
+
* ``GET /api/v2/requests/{id}.json``
|
70
|
+
* ``GET /api/v2/macros/{id}/apply.json``
|
71
|
+
|
72
|
+
##### Deprecation
|
73
|
+
|
74
|
+
On November 8, 2012, in the above endpoints, ``custom_fields`` were added and ``fields`` were deprecated.
|
75
|
+
|
76
|
+
##### What's changing
|
77
|
+
|
78
|
+
To improve naming consistencies in our API, we are renaming ``fields`` to ``custom_fields`` in the above endpoints.
|
79
|
+
|
80
|
+
##### Example
|
81
|
+
|
82
|
+
```
|
83
|
+
{
|
84
|
+
"ticket": {
|
85
|
+
"id": 123,
|
86
|
+
"fields": [
|
87
|
+
{
|
88
|
+
"id": 456,
|
89
|
+
"value": "value_1"
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"id":457,
|
93
|
+
"value": "value_2"
|
94
|
+
}
|
95
|
+
]
|
96
|
+
}
|
97
|
+
}
|
98
|
+
```
|
99
|
+
|
100
|
+
will be changed to
|
101
|
+
|
102
|
+
```
|
103
|
+
{
|
104
|
+
"ticket": {
|
105
|
+
"id": 123,
|
106
|
+
"custom_fields": [
|
107
|
+
{
|
108
|
+
"id": 456,
|
109
|
+
"value": "value_1"
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"id":457,
|
113
|
+
"value": "value_2"
|
114
|
+
}
|
115
|
+
]
|
116
|
+
}
|
117
|
+
}
|
118
|
+
```
|
119
|
+
|
120
|
+
#### Removal of ``fields``, ``custom_fields``, ``group_by``, ``group_order``, ``sort_order``, ``sort_by`` in favor of ``columns``, ``group`` and ``sort`` for Views
|
121
|
+
|
122
|
+
##### Affected endpoints
|
123
|
+
|
124
|
+
* ``GET /api/v2/views/{id}.json``
|
125
|
+
|
126
|
+
##### Deprecation
|
127
|
+
|
128
|
+
On November 13, 2012, in the above endpoint, ``columns``, ``group`` and ``sort`` were added and ``fields``, ``custom_fields``, ``group_by``, ``group_order``, ``sort_order``, ``sort_by`` were deprecated.
|
129
|
+
|
130
|
+
##### What's changing
|
131
|
+
|
132
|
+
To improve usability of this API, with respect to rendering view columns, we now expose a ``columns`` attribute in Views which expresses the order, header title and ID of each column in the View which corresponds to data presented in each row of the View.
|
133
|
+
|
134
|
+
Furthermore, we have consolidated the grouping and sorting definitions of each View into the ``group`` and ``sort`` attributes.
|
135
|
+
|
136
|
+
##### Example
|
137
|
+
|
138
|
+
```
|
139
|
+
{
|
140
|
+
"view": {
|
141
|
+
"id": 2568,
|
142
|
+
"title": My working tickets",
|
143
|
+
...
|
144
|
+
"execution": {
|
145
|
+
"group_by": "status",
|
146
|
+
"group_order": "asc",
|
147
|
+
"sort_by": "updated",
|
148
|
+
"sort_order": "desc",
|
149
|
+
"fields": [
|
150
|
+
{
|
151
|
+
"id": "nice_id",
|
152
|
+
"title": "ID"
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"id": "type",
|
156
|
+
"title": "Type"
|
157
|
+
}
|
158
|
+
...
|
159
|
+
],
|
160
|
+
"custom_fields": [
|
161
|
+
{
|
162
|
+
"id": 336767,
|
163
|
+
"title": "About"
|
164
|
+
}
|
165
|
+
]
|
166
|
+
}
|
167
|
+
...
|
168
|
+
}
|
169
|
+
}
|
170
|
+
```
|
171
|
+
|
172
|
+
will be changed to
|
173
|
+
|
174
|
+
```
|
175
|
+
{
|
176
|
+
"view": {
|
177
|
+
"id": 2568,
|
178
|
+
"title": My working tickets",
|
179
|
+
...
|
180
|
+
"execution": {
|
181
|
+
"group": {
|
182
|
+
"id": "status",
|
183
|
+
"title": "Status",
|
184
|
+
"order": "asc"
|
185
|
+
},
|
186
|
+
"sort": {
|
187
|
+
"id": "updated",
|
188
|
+
"title": "Updated",
|
189
|
+
"order": "desc"
|
190
|
+
},
|
191
|
+
"columns": [
|
192
|
+
{
|
193
|
+
"id": "id",
|
194
|
+
"title": "ID"
|
195
|
+
},
|
196
|
+
{
|
197
|
+
"id": "type",
|
198
|
+
"title": "Type"
|
199
|
+
},
|
200
|
+
{
|
201
|
+
"id": 336767,
|
202
|
+
"title": "About",
|
203
|
+
"type": "tagger"
|
204
|
+
}
|
205
|
+
...
|
206
|
+
],
|
207
|
+
}
|
208
|
+
...
|
209
|
+
}
|
210
|
+
}
|
211
|
+
```
|
@@ -119,6 +119,42 @@ curl https://{subdomain}.zendesk.com/api/v2/satisfaction_ratings/{id}.json \
|
|
119
119
|
```http
|
120
120
|
Status: 200 OK
|
121
121
|
|
122
|
+
{
|
123
|
+
"satisfaction_rating": {
|
124
|
+
"id": 35436,
|
125
|
+
"url": "https://company.zendesk.com/api/v2/satisfaction_ratings/35436.json",
|
126
|
+
"assignee_id": 135,
|
127
|
+
"group_id": 44,
|
128
|
+
"requester_id": 7881,
|
129
|
+
"ticket_id": 208,
|
130
|
+
"score": "good",
|
131
|
+
"updated_at": "2011-07-20T22:55:29Z",
|
132
|
+
"created_at": "2011-07-20T22:55:29Z",
|
133
|
+
"comment": { ... }
|
134
|
+
}
|
135
|
+
}
|
136
|
+
```
|
137
|
+
|
138
|
+
### Create a Satisfaction Rating
|
139
|
+
`POST /api/v2/tickets/{ticket_id}/satisfaction_rating.json`
|
140
|
+
|
141
|
+
#### Allowed For:
|
142
|
+
|
143
|
+
* Requester of the ticket
|
144
|
+
|
145
|
+
#### Using curl
|
146
|
+
|
147
|
+
```bash
|
148
|
+
curl https://{subdomain}.zendesk.com/api/v2/tickets/{ticket_id}/satisfaction_rating.json \
|
149
|
+
-X POST -d '{"satisfaction_rating": {"score": "good", "comment": "Awesome support."}}' \
|
150
|
+
-v -u {email_address}:{password} -H "Content-Type: application/json"
|
151
|
+
```
|
152
|
+
|
153
|
+
#### Example Response
|
154
|
+
|
155
|
+
```http
|
156
|
+
Status: 200 OK
|
157
|
+
|
122
158
|
{
|
123
159
|
"satisfaction_rating": {
|
124
160
|
"id": 35436,
|
@@ -316,6 +316,12 @@ Voice Comments have the following keys:
|
|
316
316
|
| public | boolean | yes | If true, the ticket requester can see this comment
|
317
317
|
| formatted_from | string | yes | A formatted version of the phone number which dialed the call
|
318
318
|
| formatted_to | string | yes | A formatted version of the phone number which answered the call
|
319
|
+
| body | string | yes | The actual comment made by the author
|
320
|
+
| html_body | string | yes | The actual comment made by the author formatted to HTML
|
321
|
+
| public | boolean | yes | If this is a public comment or an internal agents only note
|
322
|
+
| trusted | boolean | yes | If this comment is trusted or marked as being potentially fraudulent
|
323
|
+
| author_id | integer | yes | The id of the author of this comment
|
324
|
+
| attachments | array | yes | The attachments on this comment as [Attachment](attachments.md) objects
|
319
325
|
|
320
326
|
#### Example
|
321
327
|
```js
|
@@ -342,6 +348,10 @@ Voice Comments have the following keys:
|
|
342
348
|
"formatted_to": "+1 (123) 325-7890",
|
343
349
|
"transcription_visible": true,
|
344
350
|
"public": true,
|
351
|
+
"author_id": 1,
|
352
|
+
"body": "Request #219 "request" was closed and merged into this request.",
|
353
|
+
"html_body": "<p>Request <a target="_blank" href="/tickets/219">#219</a> "aa" was closed and merged into this request.</p>",
|
354
|
+
"trusted": true,
|
345
355
|
"attachments": []
|
346
356
|
}
|
347
357
|
```
|
@@ -373,12 +383,14 @@ Each property that is set on a newly created Ticket is tracked with a Create eve
|
|
373
383
|
|
374
384
|
Create events have the following keys:
|
375
385
|
|
376
|
-
| Name | Type
|
377
|
-
| ---------- |
|
378
|
-
| id | integer
|
379
|
-
| type | string
|
380
|
-
| field_name | string
|
381
|
-
| value | string | yes | The value of the field that was set
|
386
|
+
| Name | Type | Read-only | Comment
|
387
|
+
| ---------- | --------------- | --------- | -------
|
388
|
+
| id | integer | yes | Automatically assigned when creating events
|
389
|
+
| type | string | yes | Has the value `Create`
|
390
|
+
| field_name | string | yes | The name of the field that was set
|
391
|
+
| value | string / array | yes | The value of the field that was set
|
392
|
+
|
393
|
+
`value` will always be a string, except when when the `field_name` is `tags`
|
382
394
|
|
383
395
|
#### Example
|
384
396
|
```js
|
@@ -395,13 +407,15 @@ When a ticket is updated, Change events track the previous and newly updated val
|
|
395
407
|
|
396
408
|
Change events have the following keys:
|
397
409
|
|
398
|
-
| Name | Type
|
399
|
-
| -------------- |
|
400
|
-
| id | integer
|
401
|
-
| type | string
|
402
|
-
| field_name | string
|
403
|
-
| value | string | yes | The value of the field that was changed
|
404
|
-
| previous_value | string | yes | The previous value of the field that was changed
|
410
|
+
| Name | Type | Read-only | Comment
|
411
|
+
| -------------- | --------------- | --------- | -------
|
412
|
+
| id | integer | yes | Automatically assigned when creating events
|
413
|
+
| type | string | yes | Has the value `Change`
|
414
|
+
| field_name | string | yes | The name of the field that was changed
|
415
|
+
| value | string / array | yes | The value of the field that was changed
|
416
|
+
| previous_value | string / array | yes | The previous value of the field that was changed
|
417
|
+
|
418
|
+
`value` and `previous_value` will always be strings, except when when the `field_name` is `tags`
|
405
419
|
|
406
420
|
#### Example
|
407
421
|
```js
|
@@ -408,4 +408,48 @@ Status: 200
|
|
408
408
|
...
|
409
409
|
}
|
410
410
|
}
|
411
|
+
```
|
412
|
+
|
413
|
+
### Set a User's Password
|
414
|
+
|
415
|
+
`POST /api/v2/users/{user_id}/password.json`
|
416
|
+
|
417
|
+
#### Allowed For
|
418
|
+
|
419
|
+
* Agents
|
420
|
+
|
421
|
+
#### Using curl
|
422
|
+
|
423
|
+
```bash
|
424
|
+
curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/password.json \
|
425
|
+
-X POST -d '{"password": "newpassword"}' \
|
426
|
+
-v -u {email_address}:{password}
|
427
|
+
```
|
428
|
+
|
429
|
+
#### Example Response
|
430
|
+
|
431
|
+
```http
|
432
|
+
Status: 200
|
433
|
+
```
|
434
|
+
|
435
|
+
### Change a User's Password
|
436
|
+
|
437
|
+
`PUT /api/v2/users/{user_id}/password.json`
|
438
|
+
|
439
|
+
#### Allowed For
|
440
|
+
|
441
|
+
* Agents
|
442
|
+
|
443
|
+
#### Using curl
|
444
|
+
|
445
|
+
```bash
|
446
|
+
curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}/password.json \
|
447
|
+
-X POST -d '{"previous_password": "oldpassword", "password": "newpassword"}' \
|
448
|
+
-v -u {email_address}:{password}
|
449
|
+
```
|
450
|
+
|
451
|
+
#### Example Response
|
452
|
+
|
453
|
+
```http
|
454
|
+
Status: 200
|
411
455
|
```
|
data/lib/zendesk_api/version.rb
CHANGED
data/spec/core/rescue_spec.rb
CHANGED
@@ -12,7 +12,11 @@ describe ZendeskAPI::Rescue do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def puff(error)
|
15
|
-
|
15
|
+
if error.is_a?(Class)
|
16
|
+
raise error, "Puff"
|
17
|
+
else
|
18
|
+
raise error
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
def boom(error)
|
@@ -56,6 +60,25 @@ describe ZendeskAPI::Rescue do
|
|
56
60
|
Boom.new(client).puff(Faraday::Error::ClientError)
|
57
61
|
end
|
58
62
|
|
63
|
+
context "when class has error attributes", :silence_logger do
|
64
|
+
let(:response) {{ :body => { :error => { :description => "hello" } } }}
|
65
|
+
let(:instance) { Boom.new(client) }
|
66
|
+
|
67
|
+
before do
|
68
|
+
Boom.send(:attr_accessor, :error, :error_message)
|
69
|
+
|
70
|
+
exception = Exception.new("message")
|
71
|
+
exception.set_backtrace([])
|
72
|
+
|
73
|
+
error = Faraday::Error::ClientError.new(exception, response)
|
74
|
+
instance.puff(error)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should attach the error" do
|
78
|
+
instance.error.should_not be_nil
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
59
82
|
context "passing a block" do
|
60
83
|
it "rescues from client errors", :silence_logger do
|
61
84
|
rescue_client_error do
|
data/spec/core/spec_helper.rb
CHANGED
@@ -105,7 +105,6 @@ RSpec.configure do |c|
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
c.extend VCR::RSpec::Macros
|
109
108
|
c.extend ResourceMacros
|
110
109
|
c.extend ZendeskAPI::Fixtures
|
111
110
|
c.include ZendeskAPI::Fixtures
|
@@ -116,6 +115,7 @@ VCR.configure do |c|
|
|
116
115
|
c.cassette_library_dir = File.join(File.dirname(__FILE__), '..', 'fixtures', 'cassettes')
|
117
116
|
c.default_cassette_options = { :record => :new_episodes, :decode_compressed_response => true, :serialize_with => :json, :preserve_exact_body_bytes => true }
|
118
117
|
c.hook_into :webmock
|
118
|
+
c.configure_rspec_metadata!
|
119
119
|
end
|
120
120
|
|
121
121
|
include WebMock::API
|
@@ -17,9 +17,7 @@ describe ZendeskAPI::Collection do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
context "pagination with no options" do
|
21
|
-
use_vcr_cassette
|
22
|
-
|
20
|
+
context "pagination with no options", :vcr do
|
23
21
|
before(:each) { subject.per_page(nil).page(nil) }
|
24
22
|
|
25
23
|
it "should find the next page by calling fetch" do
|
@@ -39,9 +37,7 @@ describe ZendeskAPI::Collection do
|
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
42
|
-
context "pagination with options" do
|
43
|
-
use_vcr_cassette
|
44
|
-
|
40
|
+
context "pagination with options", :vcr do
|
45
41
|
before(:each) { subject.per_page(1).page(2) }
|
46
42
|
|
47
43
|
it "should increase page option and not call fetch" do
|
data/spec/live/locale_spec.rb
CHANGED
data/spec/live/ticket_spec.rb
CHANGED
@@ -7,8 +7,7 @@ module ResourceMacros
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def it_should_be_creatable(options={})
|
10
|
-
context "creation" do
|
11
|
-
use_vcr_cassette
|
10
|
+
context "creation", :vcr do
|
12
11
|
subject { described_class }
|
13
12
|
|
14
13
|
before(:all) do
|
@@ -37,9 +36,7 @@ module ResourceMacros
|
|
37
36
|
end
|
38
37
|
|
39
38
|
def it_should_be_updatable(attribute, value = "TESTDATA")
|
40
|
-
context "update" do
|
41
|
-
use_vcr_cassette
|
42
|
-
|
39
|
+
context "update", :vcr do
|
43
40
|
before(:all) do
|
44
41
|
VCR.use_cassette("#{described_class.to_s}_update_create") do
|
45
42
|
@object = described_class.create(client, valid_attributes.merge(default_options))
|
@@ -79,9 +76,7 @@ module ResourceMacros
|
|
79
76
|
end
|
80
77
|
|
81
78
|
def it_should_be_deletable(options = {})
|
82
|
-
context "deletion" do
|
83
|
-
use_vcr_cassette
|
84
|
-
|
79
|
+
context "deletion", :vcr do
|
85
80
|
before(:all) do
|
86
81
|
if options[:object]
|
87
82
|
@object = options.delete(:object)
|
@@ -117,9 +112,7 @@ module ResourceMacros
|
|
117
112
|
klass = args.first.is_a?(ZendeskAPI::DataResource) ? args.shift : client
|
118
113
|
context_name = "read_#{klass.class}_#{args.join("_")}"
|
119
114
|
|
120
|
-
context context_name do
|
121
|
-
use_vcr_cassette
|
122
|
-
|
115
|
+
context context_name, :vcr do
|
123
116
|
before(:all) do
|
124
117
|
VCR.use_cassette("#{described_class.to_s}_#{context_name}_create") do
|
125
118
|
@object = described_class.create!(client, valid_attributes.merge(default_options))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-02-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bump
|
@@ -272,6 +272,7 @@ files:
|
|
272
272
|
- lib/zendesk_api/server/docs/autocomplete.md
|
273
273
|
- lib/zendesk_api/server/docs/automations.md
|
274
274
|
- lib/zendesk_api/server/docs/categories.md
|
275
|
+
- lib/zendesk_api/server/docs/changes_roadmap.md
|
275
276
|
- lib/zendesk_api/server/docs/custom_roles.md
|
276
277
|
- lib/zendesk_api/server/docs/forum_subscriptions.md
|
277
278
|
- lib/zendesk_api/server/docs/forums.md
|