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.
Files changed (141) hide show
  1. data/.yardopts +6 -2
  2. data/Gemfile +3 -2
  3. data/Gemfile.lock +4 -4
  4. data/Readme.md +3 -268
  5. data/lib/zendesk_api/actions.rb +51 -46
  6. data/lib/zendesk_api/association.rb +1 -1
  7. data/lib/zendesk_api/associations.rb +2 -6
  8. data/lib/zendesk_api/client.rb +8 -9
  9. data/lib/zendesk_api/collection.rb +84 -50
  10. data/lib/zendesk_api/configuration.rb +4 -0
  11. data/lib/zendesk_api/error.rb +22 -0
  12. data/lib/zendesk_api/middleware/request/etag_cache.rb +1 -7
  13. data/lib/zendesk_api/middleware/request/upload.rb +1 -2
  14. data/lib/zendesk_api/middleware/response/raise_error.rb +20 -0
  15. data/lib/zendesk_api/resource.rb +33 -5
  16. data/lib/zendesk_api/resources.rb +36 -11
  17. data/lib/zendesk_api/server/base.rb +1 -1
  18. data/lib/zendesk_api/server/helper.rb +3 -3
  19. data/lib/zendesk_api/server/models/zlib_json.rb +1 -1
  20. data/lib/zendesk_api/server/public/doc/ZendeskAPI.html +7 -7
  21. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ability.html +415 -13
  22. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Activity.html +414 -51
  23. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Attachment.html +321 -25
  24. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Automation.html +413 -46
  25. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Bookmark.html +389 -26
  26. data/lib/zendesk_api/server/public/doc/ZendeskAPI/CRMData.html +415 -13
  27. data/lib/zendesk_api/server/public/doc/ZendeskAPI/CRMDataStatus.html +415 -13
  28. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Category.html +410 -47
  29. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Client.html +98 -362
  30. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Collection.html +457 -676
  31. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Configuration.html +110 -20
  32. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Create.html +264 -6
  33. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Create/ClassMethods.html +43 -82
  34. data/lib/zendesk_api/server/public/doc/ZendeskAPI/CreateResource.html +671 -15
  35. data/lib/zendesk_api/server/public/doc/ZendeskAPI/CustomRole.html +415 -13
  36. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Data.html +207 -233
  37. data/lib/zendesk_api/server/public/doc/ZendeskAPI/DataResource.html +499 -24
  38. data/lib/zendesk_api/server/public/doc/ZendeskAPI/DeleteResource.html +614 -15
  39. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Destroy.html +73 -23
  40. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Destroy/ClassMethod.html +68 -18
  41. data/lib/zendesk_api/server/public/doc/ZendeskAPI/{FormatError.html → Error.html} +19 -27
  42. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Error/ClientError.html +127 -0
  43. data/lib/zendesk_api/server/public/doc/ZendeskAPI/{Server/UserRequest.html → Error/NetworkError.html} +18 -16
  44. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Error/RecordInvalid.html +371 -0
  45. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Error/RecordNotFound.html +127 -0
  46. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Forum.html +426 -63
  47. data/lib/zendesk_api/server/public/doc/ZendeskAPI/ForumSubscription.html +414 -51
  48. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Group.html +389 -26
  49. data/lib/zendesk_api/server/public/doc/ZendeskAPI/GroupMembership.html +414 -51
  50. data/lib/zendesk_api/server/public/doc/ZendeskAPI/JobStatus.html +405 -16
  51. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Locale.html +405 -16
  52. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Macro.html +413 -46
  53. data/lib/zendesk_api/server/public/doc/ZendeskAPI/MobileDevice.html +404 -41
  54. data/lib/zendesk_api/server/public/doc/ZendeskAPI/OAuthClient.html +606 -0
  55. data/lib/zendesk_api/server/public/doc/ZendeskAPI/OAuthToken.html +810 -0
  56. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Organization.html +422 -59
  57. data/lib/zendesk_api/server/public/doc/ZendeskAPI/OrganizationField.html +606 -0
  58. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Read.html +75 -12
  59. data/lib/zendesk_api/server/public/doc/ZendeskAPI/ReadResource.html +593 -16
  60. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Request.html +418 -55
  61. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Request/Comment.html +420 -31
  62. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Resource.html +1025 -20
  63. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Role.html +415 -13
  64. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Rule.html +610 -0
  65. data/lib/zendesk_api/server/public/doc/ZendeskAPI/RuleExecution.html +317 -21
  66. data/lib/zendesk_api/server/public/doc/ZendeskAPI/SatisfactionRating.html +428 -39
  67. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Save.html +63 -79
  68. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Search.html +34 -26
  69. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Search/Result.html +305 -9
  70. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Setting.html +433 -41
  71. data/lib/zendesk_api/server/public/doc/ZendeskAPI/SharingAgreement.html +405 -16
  72. data/lib/zendesk_api/server/public/doc/ZendeskAPI/SingularResource.html +389 -26
  73. data/lib/zendesk_api/server/public/doc/ZendeskAPI/SuspendedTicket.html +600 -31
  74. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket.html +464 -101
  75. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket/Audit.html +427 -25
  76. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket/Comment.html +435 -32
  77. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Ticket/Tag.html +389 -26
  78. data/lib/zendesk_api/server/public/doc/ZendeskAPI/TicketField.html +389 -26
  79. data/lib/zendesk_api/server/public/doc/ZendeskAPI/TicketMetric.html +592 -15
  80. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Topic.html +427 -64
  81. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Topic/TopicComment.html +907 -17
  82. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Topic/TopicVote.html +414 -55
  83. data/lib/zendesk_api/server/public/doc/ZendeskAPI/TopicComment.html +325 -29
  84. data/lib/zendesk_api/server/public/doc/ZendeskAPI/TopicSubscription.html +414 -51
  85. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Trigger.html +413 -46
  86. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Update.html +258 -6
  87. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Update/ClassMethod.html +62 -12
  88. data/lib/zendesk_api/server/public/doc/ZendeskAPI/UpdateResource.html +671 -15
  89. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Upload.html +800 -28
  90. data/lib/zendesk_api/server/public/doc/ZendeskAPI/User.html +505 -142
  91. data/lib/zendesk_api/server/public/doc/ZendeskAPI/User/Identity.html +412 -49
  92. data/lib/zendesk_api/server/public/doc/ZendeskAPI/User/TopicComment.html +475 -13
  93. data/lib/zendesk_api/server/public/doc/ZendeskAPI/UserField.html +606 -0
  94. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Verbs.html +9 -15
  95. data/lib/zendesk_api/server/public/doc/ZendeskAPI/View.html +433 -66
  96. data/lib/zendesk_api/server/public/doc/ZendeskAPI/ViewCount.html +415 -13
  97. data/lib/zendesk_api/server/public/doc/ZendeskAPI/ViewRow.html +451 -49
  98. data/lib/zendesk_api/server/public/doc/_index.html +72 -72
  99. data/lib/zendesk_api/server/public/doc/class_list.html +1 -1
  100. data/lib/zendesk_api/server/public/doc/css/style.css +10 -0
  101. data/lib/zendesk_api/server/public/doc/file.Readme.html +20 -260
  102. data/lib/zendesk_api/server/public/doc/file_list.html +1 -1
  103. data/lib/zendesk_api/server/public/doc/frames.html +1 -1
  104. data/lib/zendesk_api/server/public/doc/index.html +20 -260
  105. data/lib/zendesk_api/server/public/doc/method_list.html +309 -517
  106. data/lib/zendesk_api/server/public/doc/top-level-namespace.html +3 -35
  107. data/lib/zendesk_api/verbs.rb +0 -4
  108. data/lib/zendesk_api/version.rb +1 -1
  109. data/spec/core/client_spec.rb +53 -13
  110. data/spec/core/collection_spec.rb +32 -4
  111. data/spec/core/create_resource_spec.rb +1 -1
  112. data/spec/core/data_resource_spec.rb +2 -2
  113. data/spec/core/middleware/request/etag_cache_spec.rb +6 -7
  114. data/spec/core/middleware/request/upload_spec.rb +2 -10
  115. data/spec/core/middleware/response/callback_spec.rb +1 -1
  116. data/spec/core/middleware/response/raise_error_spec.rb +40 -0
  117. data/spec/core/read_resource_spec.rb +0 -2
  118. data/spec/core/resource_spec.rb +13 -5
  119. data/spec/core/search_spec.rb +1 -1
  120. data/spec/core/spec_helper.rb +3 -3
  121. data/spec/live/automation_spec.rb +23 -0
  122. data/spec/live/organization_field_spec.rb +12 -0
  123. data/spec/live/ticket_spec.rb +8 -2
  124. data/spec/live/trigger_spec.rb +23 -0
  125. data/spec/live/user_field_spec.rb +12 -0
  126. data/spec/live/user_spec.rb +0 -2
  127. data/spec/live/view_spec.rb +17 -1
  128. data/spec/server/spec_helper.rb +2 -2
  129. data/zendesk_api.gemspec +1 -1
  130. metadata +88 -51
  131. checksums.yaml +0 -7
  132. data/lib/zendesk_api/rescue.rb +0 -63
  133. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Console.html +0 -860
  134. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Console/Eval.html +0 -190
  135. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server.html +0 -131
  136. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/App.html +0 -523
  137. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/Helper.html +0 -684
  138. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/HtmlRenderer.html +0 -303
  139. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/HtmlRenderer/RedcarpetRenderer.html +0 -508
  140. data/lib/zendesk_api/server/public/doc/ZendeskAPI/Server/ZlibJSON.html +0 -244
  141. data/spec/core/rescue_spec.rb +0 -151
@@ -1,684 +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
- Module: ZendeskAPI::Server::Helper
8
-
9
- &mdash; 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 (H)</a> &raquo;
35
- <span class='title'><span class='object_link'><a href="../../ZendeskAPI.html" title="ZendeskAPI (module)">ZendeskAPI</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Server.html" title="ZendeskAPI::Server (module)">Server</a></span></span>
36
- &raquo;
37
- <span class="title">Helper</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>Module: ZendeskAPI::Server::Helper
67
-
68
-
69
-
70
- </h1>
71
-
72
- <dl class="box">
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
- <dt class="r1 last">Defined in:</dt>
82
- <dd class="r1 last">lib/zendesk_api/server/helper.rb</dd>
83
-
84
- </dl>
85
- <div class="clear"></div>
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
- <h2>
96
- Instance Method Summary
97
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
98
- </h2>
99
-
100
- <ul class="summary">
101
-
102
- <li class="public ">
103
- <span class="summary_signature">
104
-
105
- <a href="#client-instance_method" title="#client (instance method)">- (Object) <strong>client</strong>(params = params) </a>
106
-
107
-
108
-
109
- </span>
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
- <span class="summary_desc"><div class='inline'></div></span>
120
-
121
- </li>
122
-
123
-
124
- <li class="public ">
125
- <span class="summary_signature">
126
-
127
- <a href="#coerce_path-instance_method" title="#coerce_path (instance method)">- (Object) <strong>coerce_path</strong>(path) </a>
128
-
129
-
130
-
131
- </span>
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
- <span class="summary_desc"><div class='inline'></div></span>
142
-
143
- </li>
144
-
145
-
146
- <li class="public ">
147
- <span class="summary_signature">
148
-
149
- <a href="#execute_request-instance_method" title="#execute_request (instance method)">- (Object) <strong>execute_request</strong> </a>
150
-
151
-
152
-
153
- </span>
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
- <span class="summary_desc"><div class='inline'></div></span>
164
-
165
- </li>
166
-
167
-
168
- <li class="public ">
169
- <span class="summary_signature">
170
-
171
- <a href="#full_url-instance_method" title="#full_url (instance method)">- (Object) <strong>full_url</strong> </a>
172
-
173
-
174
-
175
- </span>
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
- <span class="summary_desc"><div class='inline'></div></span>
186
-
187
- </li>
188
-
189
-
190
- <li class="public ">
191
- <span class="summary_signature">
192
-
193
- <a href="#get_response-instance_method" title="#get_response (instance method)">- (Object) <strong>get_response</strong> </a>
194
-
195
-
196
-
197
- </span>
198
-
199
-
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
- <span class="summary_desc"><div class='inline'></div></span>
208
-
209
- </li>
210
-
211
-
212
- <li class="public ">
213
- <span class="summary_signature">
214
-
215
- <a href="#map_headers-instance_method" title="#map_headers (instance method)">- (Object) <strong>map_headers</strong>(headers) </a>
216
-
217
-
218
-
219
- </span>
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
- <span class="summary_desc"><div class='inline'></div></span>
230
-
231
- </li>
232
-
233
-
234
- <li class="public ">
235
- <span class="summary_signature">
236
-
237
- <a href="#set_request-instance_method" title="#set_request (instance method)">- (Object) <strong>set_request</strong>(request) </a>
238
-
239
-
240
-
241
- </span>
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
- <span class="summary_desc"><div class='inline'></div></span>
252
-
253
- </li>
254
-
255
-
256
- <li class="public ">
257
- <span class="summary_signature">
258
-
259
- <a href="#set_response-instance_method" title="#set_response (instance method)">- (Object) <strong>set_response</strong>(response) </a>
260
-
261
-
262
-
263
- </span>
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
- <span class="summary_desc"><div class='inline'></div></span>
274
-
275
- </li>
276
-
277
-
278
- </ul>
279
-
280
-
281
-
282
-
283
- <div id="instance_method_details" class="method_details_list">
284
- <h2>Instance Method Details</h2>
285
-
286
-
287
- <div class="method_details first">
288
- <h3 class="signature first" id="client-instance_method">
289
-
290
- - (<tt>Object</tt>) <strong>client</strong>(params = params)
291
-
292
-
293
-
294
-
295
-
296
- </h3><table class="source_code">
297
- <tr>
298
- <td>
299
- <pre class="lines">
300
-
301
-
302
- 98
303
- 99
304
- 100
305
- 101
306
- 102
307
- 103
308
- 104
309
- 105
310
- 106</pre>
311
- </td>
312
- <td>
313
- <pre class="code"><span class="info file"># File 'lib/zendesk_api/server/helper.rb', line 98</span>
314
-
315
- <span class='kw'>def</span> <span class='id identifier rubyid_client'>client</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
316
- <span class='ivar'>@client</span> <span class='op'>||=</span> <span class='const'>ZendeskAPI</span><span class='op'>::</span><span class='const'>Client</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
317
- <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
318
- <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
319
- <span class='kw'>end</span>
320
-
321
- <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_allow_http'>allow_http</span> <span class='op'>=</span> <span class='const'>App</span><span class='period'>.</span><span class='id identifier rubyid_development?'>development?</span>
322
- <span class='kw'>end</span>
323
- <span class='kw'>end</span></pre>
324
- </td>
325
- </tr>
326
- </table>
327
- </div>
328
-
329
- <div class="method_details ">
330
- <h3 class="signature " id="coerce_path-instance_method">
331
-
332
- - (<tt>Object</tt>) <strong>coerce_path</strong>(path)
333
-
334
-
335
-
336
-
337
-
338
- </h3><table class="source_code">
339
- <tr>
340
- <td>
341
- <pre class="lines">
342
-
343
-
344
- 7
345
- 8
346
- 9
347
- 10
348
- 11
349
- 12
350
- 13
351
- 14
352
- 15
353
- 16
354
- 17
355
- 18
356
- 19
357
- 20
358
- 21
359
- 22
360
- 23</pre>
361
- </td>
362
- <td>
363
- <pre class="code"><span class="info file"># File 'lib/zendesk_api/server/helper.rb', line 7</span>
364
-
365
- <span class='kw'>def</span> <span class='id identifier rubyid_coerce_path'>coerce_path</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
366
- <span class='kw'>if</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>%r{</span><span class='tstring_content'>(https?://)?(\w+)(\.zendesk\.com)?(/api/v2)?/(.*)</span><span class='regexp_end'>}</span></span>
367
- <span class='kw'>if</span> <span class='backref'>$1</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>http://</span><span class='tstring_end'>&quot;</span></span>
368
- <span class='ivar'>@error</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Please enter a valid https URL</span><span class='tstring_end'>&quot;</span></span>
369
- <span class='id identifier rubyid_path'>path</span>
370
- <span class='kw'>elsif</span> <span class='op'>!</span><span class='backref'>$2</span> <span class='op'>||</span> <span class='backref'>$2</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
371
- <span class='ivar'>@error</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Please enter a valid subdomain</span><span class='tstring_end'>&quot;</span></span>
372
- <span class='id identifier rubyid_path'>path</span>
373
- <span class='kw'>else</span>
374
- <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>url</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://</span><span class='embexpr_beg'>#{</span><span class='backref'>$2</span><span class='rbrace'>}</span><span class='tstring_content'>.zendesk.com/api/v2</span><span class='tstring_end'>&quot;</span></span>
375
- <span class='backref'>$5</span>
376
- <span class='kw'>end</span>
377
- <span class='kw'>else</span>
378
- <span class='ivar'>@error</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Please enter a valid URL</span><span class='tstring_end'>&quot;</span></span>
379
- <span class='id identifier rubyid_path'>path</span>
380
- <span class='kw'>end</span>
381
- <span class='kw'>end</span></pre>
382
- </td>
383
- </tr>
384
- </table>
385
- </div>
386
-
387
- <div class="method_details ">
388
- <h3 class="signature " id="execute_request-instance_method">
389
-
390
- - (<tt>Object</tt>) <strong>execute_request</strong>
391
-
392
-
393
-
394
-
395
-
396
- </h3><table class="source_code">
397
- <tr>
398
- <td>
399
- <pre class="lines">
400
-
401
-
402
- 25
403
- 26
404
- 27
405
- 28
406
- 29
407
- 30
408
- 31
409
- 32
410
- 33
411
- 34
412
- 35
413
- 36
414
- 37
415
- 38
416
- 39
417
- 40
418
- 41
419
- 42
420
- 43
421
- 44
422
- 45
423
- 46</pre>
424
- </td>
425
- <td>
426
- <pre class="code"><span class="info file"># File 'lib/zendesk_api/server/helper.rb', line 25</span>
427
-
428
- <span class='kw'>def</span> <span class='id identifier rubyid_execute_request'>execute_request</span>
429
- <span class='kw'>unless</span> <span class='ivar'>@method</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='ivar'>@method</span><span class='rparen'>)</span>
430
- <span class='ivar'>@error</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The input you entered was invalid</span><span class='tstring_end'>&quot;</span></span>
431
- <span class='kw'>return</span>
432
- <span class='kw'>end</span>
433
-
434
- <span class='kw'>begin</span>
435
- <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_get_response'>get_response</span>
436
- <span class='kw'>rescue</span> <span class='const'>Faraday</span><span class='op'>::</span><span class='const'>Error</span><span class='op'>::</span><span class='const'>ConnectionFailed</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
437
- <span class='ivar'>@error</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The connection failed</span><span class='tstring_end'>&quot;</span></span>
438
- <span class='kw'>rescue</span> <span class='const'>Faraday</span><span class='op'>::</span><span class='const'>Error</span><span class='op'>::</span><span class='const'>ClientError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
439
- <span class='id identifier rubyid_set_response'>set_response</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_response'>response</span>
440
- <span class='kw'>rescue</span> <span class='const'>JSON</span><span class='op'>::</span><span class='const'>ParserError</span>
441
- <span class='ivar'>@error</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The JSON you attempted to send was invalid</span><span class='tstring_end'>&quot;</span></span>
442
- <span class='kw'>rescue</span> <span class='const'>URI</span><span class='op'>::</span><span class='const'>InvalidURIError</span><span class='comma'>,</span> <span class='const'>ArgumentError</span>
443
- <span class='ivar'>@error</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Please enter a valid URL</span><span class='tstring_end'>&quot;</span></span>
444
- <span class='kw'>else</span>
445
- <span class='id identifier rubyid_set_response'>set_response</span><span class='lparen'>(</span><span class='symbol'>:body</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='comma'>,</span>
446
- <span class='symbol'>:headers</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='symbol'>:response_headers</span><span class='rbracket'>]</span><span class='comma'>,</span>
447
- <span class='symbol'>:status</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span><span class='rparen'>)</span>
448
- <span class='kw'>end</span>
449
- <span class='kw'>end</span></pre>
450
- </td>
451
- </tr>
452
- </table>
453
- </div>
454
-
455
- <div class="method_details ">
456
- <h3 class="signature " id="full_url-instance_method">
457
-
458
- - (<tt>Object</tt>) <strong>full_url</strong>
459
-
460
-
461
-
462
-
463
-
464
- </h3><table class="source_code">
465
- <tr>
466
- <td>
467
- <pre class="lines">
468
-
469
-
470
- 3
471
- 4
472
- 5</pre>
473
- </td>
474
- <td>
475
- <pre class="code"><span class="info file"># File 'lib/zendesk_api/server/helper.rb', line 3</span>
476
-
477
- <span class='kw'>def</span> <span class='id identifier rubyid_full_url'>full_url</span>
478
- <span class='lbracket'>[</span><span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>url</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@path</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
479
- <span class='kw'>end</span></pre>
480
- </td>
481
- </tr>
482
- </table>
483
- </div>
484
-
485
- <div class="method_details ">
486
- <h3 class="signature " id="get_response-instance_method">
487
-
488
- - (<tt>Object</tt>) <strong>get_response</strong>
489
-
490
-
491
-
492
-
493
-
494
- </h3><table class="source_code">
495
- <tr>
496
- <td>
497
- <pre class="lines">
498
-
499
-
500
- 48
501
- 49
502
- 50
503
- 51
504
- 52
505
- 53
506
- 54
507
- 55
508
- 56
509
- 57
510
- 58
511
- 59
512
- 60</pre>
513
- </td>
514
- <td>
515
- <pre class="code"><span class="info file"># File 'lib/zendesk_api/server/helper.rb', line 48</span>
516
-
517
- <span class='kw'>def</span> <span class='id identifier rubyid_get_response'>get_response</span>
518
- <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_connection'>connection</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='ivar'>@method</span><span class='comma'>,</span> <span class='ivar'>@path</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_request'>request</span><span class='op'>|</span>
519
- <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_params'>params</span> <span class='op'>=</span> <span class='ivar'>@url_params</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_accum'>accum</span><span class='comma'>,</span> <span class='id identifier rubyid_h'>h</span><span class='op'>|</span>
520
- <span class='id identifier rubyid_accum'>accum</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>name</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>value</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
521
- <span class='kw'>end</span>
522
-
523
- <span class='kw'>if</span> <span class='ivar'>@method</span> <span class='op'>!=</span> <span class='symbol'>:get</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@json</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='ivar'>@json</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
524
- <span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='ivar'>@json</span><span class='rparen'>)</span>
525
- <span class='kw'>end</span>
526
-
527
- <span class='id identifier rubyid_set_request'>set_request</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_to_env'>to_env</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_connection'>connection</span><span class='rparen'>)</span><span class='rparen'>)</span>
528
- <span class='kw'>end</span>
529
- <span class='kw'>end</span></pre>
530
- </td>
531
- </tr>
532
- </table>
533
- </div>
534
-
535
- <div class="method_details ">
536
- <h3 class="signature " id="map_headers-instance_method">
537
-
538
- - (<tt>Object</tt>) <strong>map_headers</strong>(headers)
539
-
540
-
541
-
542
-
543
-
544
- </h3><table class="source_code">
545
- <tr>
546
- <td>
547
- <pre class="lines">
548
-
549
-
550
- 62
551
- 63
552
- 64
553
- 65
554
- 66
555
- 67</pre>
556
- </td>
557
- <td>
558
- <pre class="code"><span class="info file"># File 'lib/zendesk_api/server/helper.rb', line 62</span>
559
-
560
- <span class='kw'>def</span> <span class='id identifier rubyid_map_headers'>map_headers</span><span class='lparen'>(</span><span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
561
- <span class='id identifier rubyid_headers'>headers</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
562
- <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:capitalize</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
563
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_v'>v</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
564
- <span class='kw'>end</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
565
- <span class='kw'>end</span></pre>
566
- </td>
567
- </tr>
568
- </table>
569
- </div>
570
-
571
- <div class="method_details ">
572
- <h3 class="signature " id="set_request-instance_method">
573
-
574
- - (<tt>Object</tt>) <strong>set_request</strong>(request)
575
-
576
-
577
-
578
-
579
-
580
- </h3><table class="source_code">
581
- <tr>
582
- <td>
583
- <pre class="lines">
584
-
585
-
586
- 69
587
- 70
588
- 71
589
- 72
590
- 73
591
- 74
592
- 75
593
- 76
594
- 77
595
- 78
596
- 79
597
- 80
598
- 81
599
- 82
600
- 83
601
- 84</pre>
602
- </td>
603
- <td>
604
- <pre class="code"><span class="info file"># File 'lib/zendesk_api/server/helper.rb', line 69</span>
605
-
606
- <span class='kw'>def</span> <span class='id identifier rubyid_set_request'>set_request</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span>
607
- <span class='ivar'>@html_request</span> <span class='op'>=</span> <span class='heredoc_beg'>&lt;&lt;-END</span>
608
- <span class='tstring_content'>HTTP/1.1 </span><span class='embexpr_beg'>#{</span><span class='ivar'>@method</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_request'>request</span><span class='lbracket'>[</span><span class='symbeg'>:</span><span class='id identifier rubyid_url'>url</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>
609
- </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_map_headers'>map_headers</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='lbracket'>[</span><span class='symbeg'>:</span><span class='id identifier rubyid_request_headers'>request_headers</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'>
610
- </span><span class='heredoc_end'> END
611
- </span>
612
- <span class='id identifier rubyid_request_headers'>request_headers</span> <span class='op'>=</span> <span class='id identifier rubyid_request'>request</span><span class='lbracket'>[</span><span class='symbol'>:request_headers</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
613
- <span class='id identifier rubyid_request_headers'>request_headers</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Authorization</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
614
-
615
- <span class='ivar'>@user_request_hash</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='symbol'>:url</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_request'>request</span><span class='lbracket'>[</span><span class='symbol'>:url</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='symbol'>:request_headers</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_request_headers'>request_headers</span> <span class='rbrace'>}</span>
616
-
617
- <span class='kw'>if</span> <span class='ivar'>@method</span> <span class='op'>!=</span> <span class='symbol'>:get</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@json</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='ivar'>@json</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
618
- <span class='id identifier rubyid_parsed_json'>parsed_json</span> <span class='op'>=</span> <span class='const'>CodeRay</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='ivar'>@json</span><span class='comma'>,</span> <span class='symbol'>:json</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_span'>span</span>
619
- <span class='ivar'>@html_request</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n\n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_parsed_json'>parsed_json</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
620
- <span class='kw'>end</span>
621
- <span class='kw'>end</span></pre>
622
- </td>
623
- </tr>
624
- </table>
625
- </div>
626
-
627
- <div class="method_details ">
628
- <h3 class="signature " id="set_response-instance_method">
629
-
630
- - (<tt>Object</tt>) <strong>set_response</strong>(response)
631
-
632
-
633
-
634
-
635
-
636
- </h3><table class="source_code">
637
- <tr>
638
- <td>
639
- <pre class="lines">
640
-
641
-
642
- 86
643
- 87
644
- 88
645
- 89
646
- 90
647
- 91
648
- 92
649
- 93
650
- 94
651
- 95
652
- 96</pre>
653
- </td>
654
- <td>
655
- <pre class="code"><span class="info file"># File 'lib/zendesk_api/server/helper.rb', line 86</span>
656
-
657
- <span class='kw'>def</span> <span class='id identifier rubyid_set_response'>set_response</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span>
658
- <span class='ivar'>@html_response</span> <span class='op'>=</span><span class='heredoc_beg'>&lt;&lt;-END</span>
659
- <span class='tstring_content'>HTTP/1.1 </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='symbeg'>:</span><span class='id identifier rubyid_status'>status</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>
660
- </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_map_headers'>map_headers</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='symbeg'>:</span><span class='id identifier rubyid_headers'>headers</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'>
661
-
662
-
663
- </span><span class='embexpr_beg'>#{</span><span class='const'>CodeRay</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='symbeg'>:</span><span class='id identifier rubyid_body'>body</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='symbeg'>:</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_span'>span</span><span class='rbrace'>}</span><span class='tstring_content'>
664
- </span><span class='heredoc_end'> END
665
- </span>
666
- <span class='ivar'>@user_response_hash</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='symbol'>:status</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:headers</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='symbol'>:headers</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:body</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='symbol'>:body</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
667
- <span class='kw'>end</span></pre>
668
- </td>
669
- </tr>
670
- </table>
671
- </div>
672
-
673
- </div>
674
-
675
- </div>
676
-
677
- <div id="footer">
678
- Generated on Mon Feb 11 17:45:36 2013 by
679
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
680
- 0.8.4.1 (ruby-1.9.3).
681
- </div>
682
-
683
- </body>
684
- </html>