zendesk_api 0.3.14 → 0.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +6 -2
- data/Gemfile +3 -2
- data/Gemfile.lock +4 -4
- data/Readme.md +3 -268
- data/lib/zendesk_api/actions.rb +51 -46
- data/lib/zendesk_api/association.rb +1 -1
- data/lib/zendesk_api/associations.rb +2 -6
- data/lib/zendesk_api/client.rb +8 -9
- data/lib/zendesk_api/collection.rb +84 -50
- data/lib/zendesk_api/configuration.rb +4 -0
- data/lib/zendesk_api/error.rb +22 -0
- data/lib/zendesk_api/middleware/request/etag_cache.rb +1 -7
- data/lib/zendesk_api/middleware/request/upload.rb +1 -2
- data/lib/zendesk_api/middleware/response/raise_error.rb +20 -0
- data/lib/zendesk_api/resource.rb +33 -5
- data/lib/zendesk_api/resources.rb +36 -11
- data/lib/zendesk_api/server/base.rb +1 -1
- data/lib/zendesk_api/server/helper.rb +3 -3
- data/lib/zendesk_api/server/models/zlib_json.rb +1 -1
- data/lib/zendesk_api/server/public/doc/ZendeskAPI.html +7 -7
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ability.html +415 -13
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Activity.html +414 -51
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Attachment.html +321 -25
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Automation.html +413 -46
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Bookmark.html +389 -26
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/CRMData.html +415 -13
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/CRMDataStatus.html +415 -13
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Category.html +410 -47
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Client.html +98 -362
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Collection.html +457 -676
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Configuration.html +110 -20
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Create.html +264 -6
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Create/ClassMethods.html +43 -82
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/CreateResource.html +671 -15
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/CustomRole.html +415 -13
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Data.html +207 -233
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/DataResource.html +499 -24
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/DeleteResource.html +614 -15
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Destroy.html +73 -23
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Destroy/ClassMethod.html +68 -18
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/{FormatError.html → Error.html} +19 -27
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Error/ClientError.html +127 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/{Server/UserRequest.html → Error/NetworkError.html} +18 -16
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Error/RecordInvalid.html +371 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Error/RecordNotFound.html +127 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Forum.html +426 -63
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/ForumSubscription.html +414 -51
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Group.html +389 -26
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/GroupMembership.html +414 -51
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/JobStatus.html +405 -16
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Locale.html +405 -16
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Macro.html +413 -46
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/MobileDevice.html +404 -41
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/OAuthClient.html +606 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/OAuthToken.html +810 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Organization.html +422 -59
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/OrganizationField.html +606 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Read.html +75 -12
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/ReadResource.html +593 -16
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Request.html +418 -55
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Request/Comment.html +420 -31
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Resource.html +1025 -20
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Role.html +415 -13
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Rule.html +610 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/RuleExecution.html +317 -21
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/SatisfactionRating.html +428 -39
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Save.html +63 -79
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Search.html +34 -26
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Search/Result.html +305 -9
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Setting.html +433 -41
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/SharingAgreement.html +405 -16
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/SingularResource.html +389 -26
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/SuspendedTicket.html +600 -31
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket.html +464 -101
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket/Audit.html +427 -25
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket/Comment.html +435 -32
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket/Tag.html +389 -26
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/TicketField.html +389 -26
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/TicketMetric.html +592 -15
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Topic.html +427 -64
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Topic/TopicComment.html +907 -17
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Topic/TopicVote.html +414 -55
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/TopicComment.html +325 -29
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/TopicSubscription.html +414 -51
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Trigger.html +413 -46
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Update.html +258 -6
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Update/ClassMethod.html +62 -12
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/UpdateResource.html +671 -15
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Upload.html +800 -28
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/User.html +505 -142
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/User/Identity.html +412 -49
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/User/TopicComment.html +475 -13
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/UserField.html +606 -0
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Verbs.html +9 -15
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/View.html +433 -66
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/ViewCount.html +415 -13
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/ViewRow.html +451 -49
- data/lib/zendesk_api/server/public/doc/_index.html +72 -72
- data/lib/zendesk_api/server/public/doc/class_list.html +1 -1
- data/lib/zendesk_api/server/public/doc/css/style.css +10 -0
- data/lib/zendesk_api/server/public/doc/file.Readme.html +20 -260
- data/lib/zendesk_api/server/public/doc/file_list.html +1 -1
- data/lib/zendesk_api/server/public/doc/frames.html +1 -1
- data/lib/zendesk_api/server/public/doc/index.html +20 -260
- data/lib/zendesk_api/server/public/doc/method_list.html +309 -517
- data/lib/zendesk_api/server/public/doc/top-level-namespace.html +3 -35
- data/lib/zendesk_api/verbs.rb +0 -4
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/core/client_spec.rb +53 -13
- data/spec/core/collection_spec.rb +32 -4
- data/spec/core/create_resource_spec.rb +1 -1
- data/spec/core/data_resource_spec.rb +2 -2
- data/spec/core/middleware/request/etag_cache_spec.rb +6 -7
- data/spec/core/middleware/request/upload_spec.rb +2 -10
- data/spec/core/middleware/response/callback_spec.rb +1 -1
- data/spec/core/middleware/response/raise_error_spec.rb +40 -0
- data/spec/core/read_resource_spec.rb +0 -2
- data/spec/core/resource_spec.rb +13 -5
- data/spec/core/search_spec.rb +1 -1
- data/spec/core/spec_helper.rb +3 -3
- data/spec/live/automation_spec.rb +23 -0
- data/spec/live/organization_field_spec.rb +12 -0
- data/spec/live/ticket_spec.rb +8 -2
- data/spec/live/trigger_spec.rb +23 -0
- data/spec/live/user_field_spec.rb +12 -0
- data/spec/live/user_spec.rb +0 -2
- data/spec/live/view_spec.rb +17 -1
- data/spec/server/spec_helper.rb +2 -2
- data/zendesk_api.gemspec +1 -1
- metadata +88 -51
- checksums.yaml +0 -7
- data/lib/zendesk_api/rescue.rb +0 -63
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Console.html +0 -860
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Console/Eval.html +0 -190
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server.html +0 -131
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/App.html +0 -523
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/Helper.html +0 -684
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/HtmlRenderer.html +0 -303
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/HtmlRenderer/RedcarpetRenderer.html +0 -508
- data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/ZlibJSON.html +0 -244
- data/spec/core/rescue_spec.rb +0 -151
@@ -1,244 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Class: ZendeskAPI::Server::ZlibJSON
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.4.1
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
hasFrames = window.top.frames.main ? true : false;
|
19
|
-
relpath = '../../';
|
20
|
-
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
-
</script>
|
22
|
-
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
-
|
26
|
-
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
-
|
28
|
-
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="header">
|
32
|
-
<div id="menu">
|
33
|
-
|
34
|
-
<a href="../../_index.html">Index (Z)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../../ZendeskAPI.html" title="ZendeskAPI (module)">ZendeskAPI</a></span></span> » <span class='title'><span class='object_link'><a href="../Server.html" title="ZendeskAPI::Server (module)">Server</a></span></span>
|
36
|
-
»
|
37
|
-
<span class="title">ZlibJSON</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a class="full_list_link" id="class_list_link"
|
46
|
-
href="../../class_list.html">
|
47
|
-
Class List
|
48
|
-
</a>
|
49
|
-
|
50
|
-
<a class="full_list_link" id="method_list_link"
|
51
|
-
href="../../method_list.html">
|
52
|
-
Method List
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="../../file_list.html">
|
57
|
-
File List
|
58
|
-
</a>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
<div class="clear"></div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<iframe id="search_frame"></iframe>
|
65
|
-
|
66
|
-
<div id="content"><h1>Class: ZendeskAPI::Server::ZlibJSON
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
<dt class="r1">Inherits:</dt>
|
75
|
-
<dd class="r1">
|
76
|
-
<span class="inheritName">Hash</span>
|
77
|
-
|
78
|
-
<ul class="fullTree">
|
79
|
-
<li>Object</li>
|
80
|
-
|
81
|
-
<li class="next">Hash</li>
|
82
|
-
|
83
|
-
<li class="next">ZendeskAPI::Server::ZlibJSON</li>
|
84
|
-
|
85
|
-
</ul>
|
86
|
-
<a href="#" class="inheritanceTree">show all</a>
|
87
|
-
|
88
|
-
</dd>
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
<dt class="r2 last">Defined in:</dt>
|
99
|
-
<dd class="r2 last">lib/zendesk_api/server/models/zlib_json.rb</dd>
|
100
|
-
|
101
|
-
</dl>
|
102
|
-
<div class="clear"></div>
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
<h2>
|
113
|
-
Class Method Summary
|
114
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
115
|
-
</h2>
|
116
|
-
|
117
|
-
<ul class="summary">
|
118
|
-
|
119
|
-
<li class="public ">
|
120
|
-
<span class="summary_signature">
|
121
|
-
|
122
|
-
<a href="#demongoize-class_method" title="demongoize (class method)">+ (Object) <strong>demongoize</strong>(serialized_object) </a>
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
</span>
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
137
|
-
|
138
|
-
</li>
|
139
|
-
|
140
|
-
|
141
|
-
<li class="public ">
|
142
|
-
<span class="summary_signature">
|
143
|
-
|
144
|
-
<a href="#mongoize-class_method" title="mongoize (class method)">+ (Object) <strong>mongoize</strong>(input_hash) </a>
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
</span>
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
159
|
-
|
160
|
-
</li>
|
161
|
-
|
162
|
-
|
163
|
-
</ul>
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
<div id="class_method_details" class="method_details_list">
|
170
|
-
<h2>Class Method Details</h2>
|
171
|
-
|
172
|
-
|
173
|
-
<div class="method_details first">
|
174
|
-
<h3 class="signature first" id="demongoize-class_method">
|
175
|
-
|
176
|
-
+ (<tt>Object</tt>) <strong>demongoize</strong>(serialized_object)
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
</h3><table class="source_code">
|
183
|
-
<tr>
|
184
|
-
<td>
|
185
|
-
<pre class="lines">
|
186
|
-
|
187
|
-
|
188
|
-
4
|
189
|
-
5
|
190
|
-
6</pre>
|
191
|
-
</td>
|
192
|
-
<td>
|
193
|
-
<pre class="code"><span class="info file"># File 'lib/zendesk_api/server/models/zlib_json.rb', line 4</span>
|
194
|
-
|
195
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_demongoize'>demongoize</span><span class='lparen'>(</span><span class='id identifier rubyid_serialized_object'>serialized_object</span><span class='rparen'>)</span>
|
196
|
-
<span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='const'>Zlib</span><span class='period'>.</span><span class='id identifier rubyid_inflate'>inflate</span><span class='lparen'>(</span><span class='id identifier rubyid_serialized_object'>serialized_object</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span>
|
197
|
-
<span class='kw'>end</span></pre>
|
198
|
-
</td>
|
199
|
-
</tr>
|
200
|
-
</table>
|
201
|
-
</div>
|
202
|
-
|
203
|
-
<div class="method_details ">
|
204
|
-
<h3 class="signature " id="mongoize-class_method">
|
205
|
-
|
206
|
-
+ (<tt>Object</tt>) <strong>mongoize</strong>(input_hash)
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
</h3><table class="source_code">
|
213
|
-
<tr>
|
214
|
-
<td>
|
215
|
-
<pre class="lines">
|
216
|
-
|
217
|
-
|
218
|
-
8
|
219
|
-
9
|
220
|
-
10</pre>
|
221
|
-
</td>
|
222
|
-
<td>
|
223
|
-
<pre class="code"><span class="info file"># File 'lib/zendesk_api/server/models/zlib_json.rb', line 8</span>
|
224
|
-
|
225
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_mongoize'>mongoize</span><span class='lparen'>(</span><span class='id identifier rubyid_input_hash'>input_hash</span><span class='rparen'>)</span>
|
226
|
-
<span class='const'>Moped</span><span class='op'>::</span><span class='const'>BSON</span><span class='op'>::</span><span class='const'>Binary</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:generic</span><span class='comma'>,</span> <span class='const'>Zlib</span><span class='period'>.</span><span class='id identifier rubyid_deflate'>deflate</span><span class='lparen'>(</span><span class='id identifier rubyid_input_hash'>input_hash</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
227
|
-
<span class='kw'>end</span></pre>
|
228
|
-
</td>
|
229
|
-
</tr>
|
230
|
-
</table>
|
231
|
-
</div>
|
232
|
-
|
233
|
-
</div>
|
234
|
-
|
235
|
-
</div>
|
236
|
-
|
237
|
-
<div id="footer">
|
238
|
-
Generated on Mon Feb 11 17:45:41 2013 by
|
239
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
240
|
-
0.8.4.1 (ruby-1.9.3).
|
241
|
-
</div>
|
242
|
-
|
243
|
-
</body>
|
244
|
-
</html>
|
data/spec/core/rescue_spec.rb
DELETED
@@ -1,151 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Rescue do
|
4
|
-
include ZendeskAPI::Rescue
|
5
|
-
|
6
|
-
class Boom
|
7
|
-
include ZendeskAPI::Rescue
|
8
|
-
attr_reader :client
|
9
|
-
|
10
|
-
def initialize(client)
|
11
|
-
@client = client
|
12
|
-
end
|
13
|
-
|
14
|
-
def puff(error)
|
15
|
-
if error.is_a?(Class)
|
16
|
-
raise error, "Puff"
|
17
|
-
else
|
18
|
-
raise error
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def boom(error)
|
23
|
-
raise error, "Boom"
|
24
|
-
end
|
25
|
-
|
26
|
-
rescue_client_error :puff
|
27
|
-
end
|
28
|
-
|
29
|
-
it "rescues from client errors", :silence_logger do
|
30
|
-
Boom.new(client).puff(Faraday::Error::ClientError)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "does not protect other actions" do
|
34
|
-
expect{
|
35
|
-
Boom.new(client).boom(RuntimeError)
|
36
|
-
}.to raise_error RuntimeError
|
37
|
-
end
|
38
|
-
|
39
|
-
it "raises everything else" do
|
40
|
-
expect{
|
41
|
-
Boom.new(client).puff(RuntimeError)
|
42
|
-
}.to raise_error RuntimeError
|
43
|
-
end
|
44
|
-
|
45
|
-
it "logs to logger" do
|
46
|
-
out = StringIO.new
|
47
|
-
client = ZendeskAPI::Client.new do |config|
|
48
|
-
config.logger = Logger.new(out)
|
49
|
-
config.url = "https://idontcare.com"
|
50
|
-
end
|
51
|
-
out.should_receive(:write).at_least(:twice)
|
52
|
-
Boom.new(client).puff(Faraday::Error::ClientError)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "does crash without logger" do
|
56
|
-
client = ZendeskAPI::Client.new do |config|
|
57
|
-
config.logger = false
|
58
|
-
config.url = "https://idontcare.com"
|
59
|
-
end
|
60
|
-
Boom.new(client).puff(Faraday::Error::ClientError)
|
61
|
-
end
|
62
|
-
|
63
|
-
context "when class has error attributes", :silence_logger do
|
64
|
-
let(:instance) { Boom.new(client) }
|
65
|
-
|
66
|
-
let(:exception) do
|
67
|
-
exception = Exception.new("message")
|
68
|
-
exception.set_backtrace([])
|
69
|
-
exception
|
70
|
-
end
|
71
|
-
|
72
|
-
let(:error) do
|
73
|
-
Faraday::Error::ClientError.new(exception, response)
|
74
|
-
end
|
75
|
-
|
76
|
-
before do
|
77
|
-
Boom.send(:attr_accessor, :error, :error_message)
|
78
|
-
instance.puff(error)
|
79
|
-
end
|
80
|
-
|
81
|
-
context "with no response" do
|
82
|
-
let(:response) {{}}
|
83
|
-
|
84
|
-
it "should attach the error" do
|
85
|
-
instance.error.should_not be_nil
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should not attach the message" do
|
89
|
-
instance.error_message.should be_nil
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
context "with a response" do
|
94
|
-
let(:response) {{ :body => { :error => { :description => "hello" } } }}
|
95
|
-
|
96
|
-
it "should attach the error" do
|
97
|
-
instance.error.should_not be_nil
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should attach the error message" do
|
101
|
-
instance.error_message.should_not be_nil
|
102
|
-
end
|
103
|
-
|
104
|
-
context "and again with no response" do
|
105
|
-
before do
|
106
|
-
instance.puff(Faraday::Error::ClientError.new(exception, {}))
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should clear the error message" do
|
110
|
-
instance.error_message.should be_nil
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
context "passing a block" do
|
117
|
-
it "rescues from client errors", :silence_logger do
|
118
|
-
rescue_client_error do
|
119
|
-
raise Faraday::Error::ClientError, "error"
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
it "raises everything else" do
|
124
|
-
expect{
|
125
|
-
rescue_client_error { raise RuntimeError, "error" }
|
126
|
-
}.to raise_error RuntimeError
|
127
|
-
end
|
128
|
-
|
129
|
-
it "logs to logger" do
|
130
|
-
out = StringIO.new
|
131
|
-
@client = ZendeskAPI::Client.new do |config|
|
132
|
-
config.logger = Logger.new(out)
|
133
|
-
config.url = "https://idontcare.com"
|
134
|
-
end
|
135
|
-
out.should_receive(:write).at_least(:twice)
|
136
|
-
rescue_client_error do
|
137
|
-
raise Faraday::Error::ClientError, "error"
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
it "does crash without logger" do
|
142
|
-
@client = ZendeskAPI::Client.new do |config|
|
143
|
-
config.logger = false
|
144
|
-
config.url = "https://idontcare.com"
|
145
|
-
end
|
146
|
-
rescue_client_error do
|
147
|
-
raise Faraday::Error::ClientError, "error"
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|