contentful 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/.README.md.swp +0 -0
  2. data/.gitignore +2 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +10 -0
  5. data/ChangeLog.md +3 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +193 -0
  9. data/Rakefile +30 -0
  10. data/contentful.gemspec +31 -0
  11. data/do_request.sh +5 -0
  12. data/doc/Contentful.html +131 -0
  13. data/doc/Contentful/AccessDenied.html +158 -0
  14. data/doc/Contentful/Array.html +346 -0
  15. data/doc/Contentful/Asset.html +315 -0
  16. data/doc/Contentful/BadRequest.html +158 -0
  17. data/doc/Contentful/Client.html +1407 -0
  18. data/doc/Contentful/ContentType.html +183 -0
  19. data/doc/Contentful/DynamicEntry.html +333 -0
  20. data/doc/Contentful/Entry.html +198 -0
  21. data/doc/Contentful/Error.html +413 -0
  22. data/doc/Contentful/Field.html +161 -0
  23. data/doc/Contentful/File.html +160 -0
  24. data/doc/Contentful/Link.html +275 -0
  25. data/doc/Contentful/Locale.html +161 -0
  26. data/doc/Contentful/NotFound.html +158 -0
  27. data/doc/Contentful/Request.html +669 -0
  28. data/doc/Contentful/Resource.html +606 -0
  29. data/doc/Contentful/Resource/AssetFields.html +413 -0
  30. data/doc/Contentful/Resource/AssetFields/ClassMethods.html +174 -0
  31. data/doc/Contentful/Resource/ClassMethods.html +271 -0
  32. data/doc/Contentful/Resource/Fields.html +398 -0
  33. data/doc/Contentful/Resource/Fields/ClassMethods.html +187 -0
  34. data/doc/Contentful/Resource/SystemProperties.html +444 -0
  35. data/doc/Contentful/Resource/SystemProperties/ClassMethods.html +174 -0
  36. data/doc/Contentful/ResourceBuilder.html +1400 -0
  37. data/doc/Contentful/Response.html +546 -0
  38. data/doc/Contentful/ServerError.html +158 -0
  39. data/doc/Contentful/Space.html +183 -0
  40. data/doc/Contentful/Support.html +198 -0
  41. data/doc/Contentful/Unauthorized.html +158 -0
  42. data/doc/Contentful/UnparsableJson.html +158 -0
  43. data/doc/Contentful/UnparsableResource.html +158 -0
  44. data/doc/_index.html +410 -0
  45. data/doc/class_list.html +54 -0
  46. data/doc/css/common.css +1 -0
  47. data/doc/css/full_list.css +57 -0
  48. data/doc/css/style.css +338 -0
  49. data/doc/file.README.html +214 -0
  50. data/doc/file_list.html +56 -0
  51. data/doc/frames.html +26 -0
  52. data/doc/index.html +214 -0
  53. data/doc/js/app.js +219 -0
  54. data/doc/js/full_list.js +178 -0
  55. data/doc/js/jquery.js +4 -0
  56. data/doc/method_list.html +533 -0
  57. data/doc/top-level-namespace.html +112 -0
  58. data/examples/custom_classes.rb +43 -0
  59. data/examples/dynamic_entries.rb +126 -0
  60. data/examples/example_queries.rb +27 -0
  61. data/examples/raise_errors.rb +22 -0
  62. data/examples/raw_mode.rb +15 -0
  63. data/examples/resource_mapping.rb +33 -0
  64. data/lib/contentful.rb +3 -0
  65. data/lib/contentful/array.rb +47 -0
  66. data/lib/contentful/asset.rb +34 -0
  67. data/lib/contentful/client.rb +193 -0
  68. data/lib/contentful/content_type.rb +16 -0
  69. data/lib/contentful/dynamic_entry.rb +54 -0
  70. data/lib/contentful/entry.rb +12 -0
  71. data/lib/contentful/error.rb +52 -0
  72. data/lib/contentful/field.rb +16 -0
  73. data/lib/contentful/file.rb +13 -0
  74. data/lib/contentful/link.rb +20 -0
  75. data/lib/contentful/locale.rb +12 -0
  76. data/lib/contentful/location.rb +12 -0
  77. data/lib/contentful/request.rb +37 -0
  78. data/lib/contentful/resource.rb +146 -0
  79. data/lib/contentful/resource/asset_fields.rb +50 -0
  80. data/lib/contentful/resource/fields.rb +39 -0
  81. data/lib/contentful/resource/system_properties.rb +48 -0
  82. data/lib/contentful/resource_builder.rb +197 -0
  83. data/lib/contentful/response.rb +64 -0
  84. data/lib/contentful/space.rb +14 -0
  85. data/lib/contentful/support.rb +18 -0
  86. data/lib/contentful/version.rb +3 -0
  87. data/spec/array_spec.rb +69 -0
  88. data/spec/asset_spec.rb +62 -0
  89. data/spec/auto_includes_spec.rb +12 -0
  90. data/spec/client_class_spec.rb +59 -0
  91. data/spec/client_configuration_spec.rb +197 -0
  92. data/spec/coercions_spec.rb +10 -0
  93. data/spec/content_type_spec.rb +44 -0
  94. data/spec/dynamic_entry_spec.rb +34 -0
  95. data/spec/entry_spec.rb +53 -0
  96. data/spec/error_class_spec.rb +60 -0
  97. data/spec/error_requests_spec.rb +32 -0
  98. data/spec/field_spec.rb +36 -0
  99. data/spec/file_spec.rb +28 -0
  100. data/spec/fixtures/json_responses/content_type.json +83 -0
  101. data/spec/fixtures/json_responses/not_found.json +13 -0
  102. data/spec/fixtures/json_responses/nyancat.json +48 -0
  103. data/spec/fixtures/json_responses/unparsable.json +13 -0
  104. data/spec/fixtures/vcr_cassettes/array.yml +288 -0
  105. data/spec/fixtures/vcr_cassettes/array_page_1.yml +106 -0
  106. data/spec/fixtures/vcr_cassettes/array_page_2.yml +73 -0
  107. data/spec/fixtures/vcr_cassettes/asset.yml +96 -0
  108. data/spec/fixtures/vcr_cassettes/bad_request.yml +76 -0
  109. data/spec/fixtures/vcr_cassettes/content_type.yml +147 -0
  110. data/spec/fixtures/vcr_cassettes/entries.yml +561 -0
  111. data/spec/fixtures/vcr_cassettes/entry.yml +112 -0
  112. data/spec/fixtures/vcr_cassettes/entry_cache.yml +288 -0
  113. data/spec/fixtures/vcr_cassettes/field.yml +147 -0
  114. data/spec/fixtures/vcr_cassettes/locale.yml +81 -0
  115. data/spec/fixtures/vcr_cassettes/location.yml +305 -0
  116. data/spec/fixtures/vcr_cassettes/not_found.yml +71 -0
  117. data/spec/fixtures/vcr_cassettes/nyancat.yml +112 -0
  118. data/spec/fixtures/vcr_cassettes/nyancat_include.yml +112 -0
  119. data/spec/fixtures/vcr_cassettes/reloaded_entry.yml +112 -0
  120. data/spec/fixtures/vcr_cassettes/space.yml +81 -0
  121. data/spec/fixtures/vcr_cassettes/unauthorized.yml +64 -0
  122. data/spec/link_spec.rb +40 -0
  123. data/spec/locale_spec.rb +20 -0
  124. data/spec/location_spec.rb +30 -0
  125. data/spec/request_spec.rb +48 -0
  126. data/spec/resource_spec.rb +52 -0
  127. data/spec/response_spec.rb +50 -0
  128. data/spec/space_spec.rb +36 -0
  129. data/spec/spec_helper.rb +6 -0
  130. data/spec/support/client.rb +6 -0
  131. data/spec/support/json_responses.rb +11 -0
  132. data/spec/support/vcr.rb +16 -0
  133. metadata +374 -0
@@ -0,0 +1,546 @@
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: Contentful::Response
8
+
9
+ &mdash; Documentation by YARD 0.8.7.3
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" 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 (R)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Contentful.html" title="Contentful (module)">Contentful</a></span></span>
36
+ &raquo;
37
+ <span class="title">Response</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: Contentful::Response
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">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">Contentful::Response</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/contentful/response.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>An object representing an answer by the contentful service. It is later
106
+ used to build a Resource, which is done by the ResourceBuilder.</p>
107
+
108
+ <p>The Response parses the http response (as returned by the underlying http
109
+ library) to a JSON object. Responses can be asked the following methods:</p>
110
+ <ul><li>
111
+ <p>#raw (raw HTTP response by the HTTP library)</p>
112
+ </li><li>
113
+ <p>#object (the parsed JSON object)</p>
114
+ </li></ul>
115
+
116
+ <p>It also sets a #status which can be one of:</p>
117
+ <ul><li>
118
+ <p>:ok (seems to be a valid resource object)</p>
119
+ </li><li>
120
+ <p>:contentful_error (valid error object)</p>
121
+ </li><li>
122
+ <p>:not_contentful (valid json, but missing the contentful's sys property)</p>
123
+ </li><li>
124
+ <p>:unparsable_json (invalid json)</p>
125
+ </li></ul>
126
+
127
+ <p>Error Repsonses also contain a:</p>
128
+ <ul><li>
129
+ <p>:error_message</p>
130
+ </li></ul>
131
+
132
+
133
+ </div>
134
+ </div>
135
+ <div class="tags">
136
+
137
+
138
+ </div>
139
+
140
+
141
+
142
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
143
+ <ul class="summary">
144
+
145
+ <li class="public ">
146
+ <span class="summary_signature">
147
+
148
+ <a href="#error_message-instance_method" title="#error_message (instance method)">- (Object) <strong>error_message</strong> </a>
149
+
150
+
151
+
152
+ </span>
153
+
154
+
155
+
156
+
157
+ <span class="note title readonly">readonly</span>
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+ <span class="summary_desc"><div class='inline'>
168
+ <p>Returns the value of attribute error_message.</p>
169
+ </div></span>
170
+
171
+ </li>
172
+
173
+
174
+ <li class="public ">
175
+ <span class="summary_signature">
176
+
177
+ <a href="#object-instance_method" title="#object (instance method)">- (Object) <strong>object</strong> </a>
178
+
179
+
180
+
181
+ </span>
182
+
183
+
184
+
185
+
186
+ <span class="note title readonly">readonly</span>
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+ <span class="summary_desc"><div class='inline'>
197
+ <p>Returns the value of attribute object.</p>
198
+ </div></span>
199
+
200
+ </li>
201
+
202
+
203
+ <li class="public ">
204
+ <span class="summary_signature">
205
+
206
+ <a href="#raw-instance_method" title="#raw (instance method)">- (Object) <strong>raw</strong> </a>
207
+
208
+
209
+
210
+ </span>
211
+
212
+
213
+
214
+
215
+ <span class="note title readonly">readonly</span>
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+ <span class="summary_desc"><div class='inline'>
226
+ <p>Returns the value of attribute raw.</p>
227
+ </div></span>
228
+
229
+ </li>
230
+
231
+
232
+ <li class="public ">
233
+ <span class="summary_signature">
234
+
235
+ <a href="#status-instance_method" title="#status (instance method)">- (Object) <strong>status</strong> </a>
236
+
237
+
238
+
239
+ </span>
240
+
241
+
242
+
243
+
244
+ <span class="note title readonly">readonly</span>
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+ <span class="summary_desc"><div class='inline'>
255
+ <p>Returns the value of attribute status.</p>
256
+ </div></span>
257
+
258
+ </li>
259
+
260
+
261
+ </ul>
262
+
263
+
264
+
265
+
266
+
267
+ <h2>
268
+ Instance Method Summary
269
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
270
+ </h2>
271
+
272
+ <ul class="summary">
273
+
274
+ <li class="public ">
275
+ <span class="summary_signature">
276
+
277
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Response) <strong>initialize</strong>(raw) </a>
278
+
279
+
280
+
281
+ </span>
282
+
283
+
284
+ <span class="note title constructor">constructor</span>
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+ <span class="summary_desc"><div class='inline'>
294
+ <p>A new instance of Response.</p>
295
+ </div></span>
296
+
297
+ </li>
298
+
299
+
300
+ </ul>
301
+
302
+
303
+ <div id="constructor_details" class="method_details_list">
304
+ <h2>Constructor Details</h2>
305
+
306
+ <div class="method_details first">
307
+ <h3 class="signature first" id="initialize-instance_method">
308
+
309
+ - (<tt><span class='object_link'><a href="" title="Contentful::Response (class)">Response</a></span></tt>) <strong>initialize</strong>(raw)
310
+
311
+
312
+
313
+
314
+
315
+ </h3><div class="docstring">
316
+ <div class="discussion">
317
+
318
+ <p>Returns a new instance of Response</p>
319
+
320
+
321
+ </div>
322
+ </div>
323
+ <div class="tags">
324
+
325
+
326
+ </div><table class="source_code">
327
+ <tr>
328
+ <td>
329
+ <pre class="lines">
330
+
331
+
332
+ 24
333
+ 25
334
+ 26
335
+ 27
336
+ 28
337
+ 29
338
+ 30
339
+ 31</pre>
340
+ </td>
341
+ <td>
342
+ <pre class="code"><span class="info file"># File 'lib/contentful/response.rb', line 24</span>
343
+
344
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_raw'>raw</span><span class='rparen'>)</span>
345
+ <span class='ivar'>@raw</span> <span class='op'>=</span> <span class='id identifier rubyid_raw'>raw</span>
346
+ <span class='ivar'>@status</span> <span class='op'>=</span> <span class='symbol'>:ok</span>
347
+
348
+ <span class='kw'>if</span> <span class='id identifier rubyid_parse_json!'>parse_json!</span>
349
+ <span class='id identifier rubyid_parse_contentful_error!'>parse_contentful_error!</span>
350
+ <span class='kw'>end</span>
351
+ <span class='kw'>end</span></pre>
352
+ </td>
353
+ </tr>
354
+ </table>
355
+ </div>
356
+
357
+ </div>
358
+
359
+ <div id="instance_attr_details" class="attr_details">
360
+ <h2>Instance Attribute Details</h2>
361
+
362
+
363
+ <span id=""></span>
364
+ <div class="method_details first">
365
+ <h3 class="signature first" id="error_message-instance_method">
366
+
367
+ - (<tt>Object</tt>) <strong>error_message</strong> <span class="extras">(readonly)</span>
368
+
369
+
370
+
371
+
372
+
373
+ </h3><div class="docstring">
374
+ <div class="discussion">
375
+
376
+ <p>Returns the value of attribute error_message</p>
377
+
378
+
379
+ </div>
380
+ </div>
381
+ <div class="tags">
382
+
383
+
384
+ </div><table class="source_code">
385
+ <tr>
386
+ <td>
387
+ <pre class="lines">
388
+
389
+
390
+ 22
391
+ 23
392
+ 24</pre>
393
+ </td>
394
+ <td>
395
+ <pre class="code"><span class="info file"># File 'lib/contentful/response.rb', line 22</span>
396
+
397
+ <span class='kw'>def</span> <span class='id identifier rubyid_error_message'>error_message</span>
398
+ <span class='ivar'>@error_message</span>
399
+ <span class='kw'>end</span></pre>
400
+ </td>
401
+ </tr>
402
+ </table>
403
+ </div>
404
+
405
+
406
+ <span id=""></span>
407
+ <div class="method_details ">
408
+ <h3 class="signature " id="object-instance_method">
409
+
410
+ - (<tt>Object</tt>) <strong>object</strong> <span class="extras">(readonly)</span>
411
+
412
+
413
+
414
+
415
+
416
+ </h3><div class="docstring">
417
+ <div class="discussion">
418
+
419
+ <p>Returns the value of attribute object</p>
420
+
421
+
422
+ </div>
423
+ </div>
424
+ <div class="tags">
425
+
426
+
427
+ </div><table class="source_code">
428
+ <tr>
429
+ <td>
430
+ <pre class="lines">
431
+
432
+
433
+ 22
434
+ 23
435
+ 24</pre>
436
+ </td>
437
+ <td>
438
+ <pre class="code"><span class="info file"># File 'lib/contentful/response.rb', line 22</span>
439
+
440
+ <span class='kw'>def</span> <span class='id identifier rubyid_object'>object</span>
441
+ <span class='ivar'>@object</span>
442
+ <span class='kw'>end</span></pre>
443
+ </td>
444
+ </tr>
445
+ </table>
446
+ </div>
447
+
448
+
449
+ <span id=""></span>
450
+ <div class="method_details ">
451
+ <h3 class="signature " id="raw-instance_method">
452
+
453
+ - (<tt>Object</tt>) <strong>raw</strong> <span class="extras">(readonly)</span>
454
+
455
+
456
+
457
+
458
+
459
+ </h3><div class="docstring">
460
+ <div class="discussion">
461
+
462
+ <p>Returns the value of attribute raw</p>
463
+
464
+
465
+ </div>
466
+ </div>
467
+ <div class="tags">
468
+
469
+
470
+ </div><table class="source_code">
471
+ <tr>
472
+ <td>
473
+ <pre class="lines">
474
+
475
+
476
+ 22
477
+ 23
478
+ 24</pre>
479
+ </td>
480
+ <td>
481
+ <pre class="code"><span class="info file"># File 'lib/contentful/response.rb', line 22</span>
482
+
483
+ <span class='kw'>def</span> <span class='id identifier rubyid_raw'>raw</span>
484
+ <span class='ivar'>@raw</span>
485
+ <span class='kw'>end</span></pre>
486
+ </td>
487
+ </tr>
488
+ </table>
489
+ </div>
490
+
491
+
492
+ <span id=""></span>
493
+ <div class="method_details ">
494
+ <h3 class="signature " id="status-instance_method">
495
+
496
+ - (<tt>Object</tt>) <strong>status</strong> <span class="extras">(readonly)</span>
497
+
498
+
499
+
500
+
501
+
502
+ </h3><div class="docstring">
503
+ <div class="discussion">
504
+
505
+ <p>Returns the value of attribute status</p>
506
+
507
+
508
+ </div>
509
+ </div>
510
+ <div class="tags">
511
+
512
+
513
+ </div><table class="source_code">
514
+ <tr>
515
+ <td>
516
+ <pre class="lines">
517
+
518
+
519
+ 22
520
+ 23
521
+ 24</pre>
522
+ </td>
523
+ <td>
524
+ <pre class="code"><span class="info file"># File 'lib/contentful/response.rb', line 22</span>
525
+
526
+ <span class='kw'>def</span> <span class='id identifier rubyid_status'>status</span>
527
+ <span class='ivar'>@status</span>
528
+ <span class='kw'>end</span></pre>
529
+ </td>
530
+ </tr>
531
+ </table>
532
+ </div>
533
+
534
+ </div>
535
+
536
+
537
+ </div>
538
+
539
+ <div id="footer">
540
+ Generated on Tue Mar 11 09:25:53 2014 by
541
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
542
+ 0.8.7.3 (ruby-1.9.3).
543
+ </div>
544
+
545
+ </body>
546
+ </html>