contentful 2.15.3 → 2.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +22 -11
  4. data/lib/contentful/array_like.rb +11 -2
  5. data/lib/contentful/asset.rb +4 -0
  6. data/lib/contentful/base_resource.rb +14 -2
  7. data/lib/contentful/client.rb +1 -2
  8. data/lib/contentful/fields_resource.rb +1 -0
  9. data/lib/contentful/version.rb +1 -1
  10. metadata +4 -367
  11. data/.gitignore +0 -7
  12. data/.rspec +0 -1
  13. data/.rubocop.yml +0 -31
  14. data/.rubocop_todo.yml +0 -35
  15. data/.travis.yml +0 -15
  16. data/.yardopts +0 -4
  17. data/Gemfile +0 -9
  18. data/Gemfile.lock +0 -166
  19. data/Guardfile +0 -24
  20. data/RELEASE.md +0 -8
  21. data/Rakefile +0 -33
  22. data/contentful.gemspec +0 -44
  23. data/coverage/.last_run.json +0 -5
  24. data/coverage/.resultset.json +0 -5086
  25. data/coverage/.resultset.json.lock +0 -0
  26. data/coverage/assets/0.10.2/application.css +0 -799
  27. data/coverage/assets/0.10.2/application.js +0 -1707
  28. data/coverage/assets/0.10.2/colorbox/border.png +0 -0
  29. data/coverage/assets/0.10.2/colorbox/controls.png +0 -0
  30. data/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
  31. data/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
  32. data/coverage/assets/0.10.2/favicon_green.png +0 -0
  33. data/coverage/assets/0.10.2/favicon_red.png +0 -0
  34. data/coverage/assets/0.10.2/favicon_yellow.png +0 -0
  35. data/coverage/assets/0.10.2/loading.gif +0 -0
  36. data/coverage/assets/0.10.2/magnify.png +0 -0
  37. data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  38. data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  39. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  40. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  41. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  42. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  43. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  44. data/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  45. data/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
  46. data/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  47. data/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
  48. data/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
  49. data/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  50. data/coverage/index.html +0 -0
  51. data/doc/Contentful/AccessDenied.html +0 -159
  52. data/doc/Contentful/Array.html +0 -844
  53. data/doc/Contentful/ArrayCoercion.html +0 -242
  54. data/doc/Contentful/ArrayLike.html +0 -624
  55. data/doc/Contentful/Asset.html +0 -486
  56. data/doc/Contentful/BadGateway.html +0 -159
  57. data/doc/Contentful/BadRequest.html +0 -159
  58. data/doc/Contentful/BaseCoercion.html +0 -445
  59. data/doc/Contentful/BaseResource.html +0 -598
  60. data/doc/Contentful/BooleanCoercion.html +0 -242
  61. data/doc/Contentful/Client.html +0 -1738
  62. data/doc/Contentful/ContentType.html +0 -617
  63. data/doc/Contentful/ContentTypeCache.html +0 -428
  64. data/doc/Contentful/DateCoercion.html +0 -244
  65. data/doc/Contentful/DeletedAsset.html +0 -156
  66. data/doc/Contentful/DeletedEntry.html +0 -156
  67. data/doc/Contentful/EmptyFieldError.html +0 -217
  68. data/doc/Contentful/Entry.html +0 -334
  69. data/doc/Contentful/Error.html +0 -407
  70. data/doc/Contentful/Field.html +0 -935
  71. data/doc/Contentful/FieldsResource.html +0 -583
  72. data/doc/Contentful/File.html +0 -218
  73. data/doc/Contentful/FloatCoercion.html +0 -238
  74. data/doc/Contentful/IntegerCoercion.html +0 -238
  75. data/doc/Contentful/Link.html +0 -246
  76. data/doc/Contentful/LinkCoercion.html +0 -156
  77. data/doc/Contentful/Locale.html +0 -536
  78. data/doc/Contentful/Location.html +0 -382
  79. data/doc/Contentful/LocationCoercion.html +0 -238
  80. data/doc/Contentful/NotFound.html +0 -159
  81. data/doc/Contentful/ObjectCoercion.html +0 -238
  82. data/doc/Contentful/RateLimitExceeded.html +0 -346
  83. data/doc/Contentful/Request.html +0 -895
  84. data/doc/Contentful/ResourceBuilder.html +0 -1067
  85. data/doc/Contentful/ResourceReferences.html +0 -254
  86. data/doc/Contentful/Response.html +0 -708
  87. data/doc/Contentful/RichTextCoercion.html +0 -238
  88. data/doc/Contentful/ServerError.html +0 -159
  89. data/doc/Contentful/ServiceUnavailable.html +0 -159
  90. data/doc/Contentful/Space.html +0 -392
  91. data/doc/Contentful/StringCoercion.html +0 -242
  92. data/doc/Contentful/StructuredTextCoercion.html +0 -238
  93. data/doc/Contentful/Support.html +0 -788
  94. data/doc/Contentful/SymbolCoercion.html +0 -169
  95. data/doc/Contentful/Sync.html +0 -653
  96. data/doc/Contentful/SyncPage.html +0 -807
  97. data/doc/Contentful/TextCoercion.html +0 -169
  98. data/doc/Contentful/Unauthorized.html +0 -159
  99. data/doc/Contentful/UnparsableJson.html +0 -159
  100. data/doc/Contentful/UnparsableResource.html +0 -135
  101. data/doc/Contentful.html +0 -157
  102. data/doc/_index.html +0 -563
  103. data/doc/class_list.html +0 -51
  104. data/doc/css/common.css +0 -1
  105. data/doc/css/full_list.css +0 -58
  106. data/doc/css/style.css +0 -496
  107. data/doc/file.CHANGELOG.html +0 -708
  108. data/doc/file.LICENSE.html +0 -70
  109. data/doc/file.README.html +0 -758
  110. data/doc/file_list.html +0 -66
  111. data/doc/frames.html +0 -17
  112. data/doc/index.html +0 -758
  113. data/doc/js/app.js +0 -303
  114. data/doc/js/full_list.js +0 -216
  115. data/doc/js/jquery.js +0 -4
  116. data/doc/method_list.html +0 -1187
  117. data/doc/top-level-namespace.html +0 -110
  118. data/examples/custom_classes.rb +0 -39
  119. data/examples/example_queries.rb +0 -26
  120. data/examples/raise_errors.rb +0 -20
  121. data/examples/raw_mode.rb +0 -14
  122. data/spec/array_spec.rb +0 -167
  123. data/spec/asset_spec.rb +0 -192
  124. data/spec/auto_includes_spec.rb +0 -12
  125. data/spec/client_class_spec.rb +0 -86
  126. data/spec/client_configuration_spec.rb +0 -377
  127. data/spec/content_type_spec.rb +0 -49
  128. data/spec/deleted_asset_spec.rb +0 -38
  129. data/spec/deleted_entry_spec.rb +0 -38
  130. data/spec/entry_spec.rb +0 -777
  131. data/spec/error_class_spec.rb +0 -327
  132. data/spec/error_requests_spec.rb +0 -87
  133. data/spec/field_spec.rb +0 -95
  134. data/spec/file_spec.rb +0 -33
  135. data/spec/fixtures/json_responses/400_details_errors_object.json +0 -14
  136. data/spec/fixtures/json_responses/400_details_errors_string.json +0 -12
  137. data/spec/fixtures/json_responses/400_details_string.json +0 -8
  138. data/spec/fixtures/json_responses/403_reasons.json +0 -13
  139. data/spec/fixtures/json_responses/404_details_string.json +0 -8
  140. data/spec/fixtures/json_responses/404_id.json +0 -11
  141. data/spec/fixtures/json_responses/404_sys_type.json +0 -12
  142. data/spec/fixtures/json_responses/404_type.json +0 -10
  143. data/spec/fixtures/json_responses/content_type.json +0 -83
  144. data/spec/fixtures/json_responses/default_400.json +0 -7
  145. data/spec/fixtures/json_responses/default_401.json +0 -7
  146. data/spec/fixtures/json_responses/default_403.json +0 -7
  147. data/spec/fixtures/json_responses/default_404.json +0 -7
  148. data/spec/fixtures/json_responses/default_429.json +0 -7
  149. data/spec/fixtures/json_responses/default_500.json +0 -7
  150. data/spec/fixtures/json_responses/default_502.json +0 -7
  151. data/spec/fixtures/json_responses/default_503.json +0 -7
  152. data/spec/fixtures/json_responses/includes.json +0 -111
  153. data/spec/fixtures/json_responses/link_array.json +0 -43
  154. data/spec/fixtures/json_responses/not_found.json +0 -13
  155. data/spec/fixtures/json_responses/nyancat.json +0 -48
  156. data/spec/fixtures/json_responses/other_error.json +0 -9
  157. data/spec/fixtures/json_responses/other_error_no_details.json +0 -8
  158. data/spec/fixtures/json_responses/other_error_no_message.json +0 -8
  159. data/spec/fixtures/json_responses/other_error_no_request_id.json +0 -8
  160. data/spec/fixtures/json_responses/other_error_nothing.json +0 -6
  161. data/spec/fixtures/json_responses/self_link.json +0 -82
  162. data/spec/fixtures/json_responses/unparsable.json +0 -13
  163. data/spec/fixtures/vcr_cassettes/array/marshal_custom_classes.yml +0 -159
  164. data/spec/fixtures/vcr_cassettes/array/marshal_unpublished.yml +0 -315
  165. data/spec/fixtures/vcr_cassettes/array/nested_resources.yml +0 -159
  166. data/spec/fixtures/vcr_cassettes/array.yml +0 -288
  167. data/spec/fixtures/vcr_cassettes/arrayField.yml +0 -87
  168. data/spec/fixtures/vcr_cassettes/array_page_1.yml +0 -106
  169. data/spec/fixtures/vcr_cassettes/array_page_2.yml +0 -73
  170. data/spec/fixtures/vcr_cassettes/asset/select_empty_array.yml +0 -104
  171. data/spec/fixtures/vcr_cassettes/asset/select_no_sys.yml +0 -119
  172. data/spec/fixtures/vcr_cassettes/asset/select_one_field.yml +0 -97
  173. data/spec/fixtures/vcr_cassettes/asset/select_only_sys.yml +0 -88
  174. data/spec/fixtures/vcr_cassettes/asset.yml +0 -96
  175. data/spec/fixtures/vcr_cassettes/assets/issues_129.yml +0 -90
  176. data/spec/fixtures/vcr_cassettes/assets/issues_jekyll_46.yml +0 -115
  177. data/spec/fixtures/vcr_cassettes/bad_request.yml +0 -76
  178. data/spec/fixtures/vcr_cassettes/content_type.yml +0 -147
  179. data/spec/fixtures/vcr_cassettes/entries/empty_fields.yml +0 -246
  180. data/spec/fixtures/vcr_cassettes/entries/issue_117.yml +0 -201
  181. data/spec/fixtures/vcr_cassettes/entries/issue_125.yml +0 -198
  182. data/spec/fixtures/vcr_cassettes/entries/rich_text.yml +0 -1707
  183. data/spec/fixtures/vcr_cassettes/entries/rich_text_hydration_issue.yml +0 -460
  184. data/spec/fixtures/vcr_cassettes/entries/rich_text_nested_fields.yml +0 -653
  185. data/spec/fixtures/vcr_cassettes/entries/rich_text_unresolved_relationships.yml +0 -983
  186. data/spec/fixtures/vcr_cassettes/entries/unresolvable_assets.yml +0 -89
  187. data/spec/fixtures/vcr_cassettes/entries/unresolvable_filter.yml +0 -159
  188. data/spec/fixtures/vcr_cassettes/entries/unresolvable_filter_deeply_nested.yml +0 -167
  189. data/spec/fixtures/vcr_cassettes/entries.yml +0 -561
  190. data/spec/fixtures/vcr_cassettes/entry/custom_resource.yml +0 -168
  191. data/spec/fixtures/vcr_cassettes/entry/include_resolution.yml +0 -101
  192. data/spec/fixtures/vcr_cassettes/entry/include_resolution_uniques.yml +0 -81
  193. data/spec/fixtures/vcr_cassettes/entry/json_objects.yml +0 -88
  194. data/spec/fixtures/vcr_cassettes/entry/json_objects_client.yml +0 -86
  195. data/spec/fixtures/vcr_cassettes/entry/marshal_138.yml +0 -159
  196. data/spec/fixtures/vcr_cassettes/entry/marshal_unpublished.yml +0 -303
  197. data/spec/fixtures/vcr_cassettes/entry/marshall.yml +0 -293
  198. data/spec/fixtures/vcr_cassettes/entry/raw.yml +0 -201
  199. data/spec/fixtures/vcr_cassettes/entry/search_link_to_asset.yml +0 -81
  200. data/spec/fixtures/vcr_cassettes/entry/search_link_to_entry.yml +0 -81
  201. data/spec/fixtures/vcr_cassettes/entry/search_link_to_entry_with_custom_query.yml +0 -115
  202. data/spec/fixtures/vcr_cassettes/entry/select_empty_array.yml +0 -111
  203. data/spec/fixtures/vcr_cassettes/entry/select_no_sys.yml +0 -102
  204. data/spec/fixtures/vcr_cassettes/entry/select_one_field.yml +0 -76
  205. data/spec/fixtures/vcr_cassettes/entry/select_one_field_proper.yml +0 -114
  206. data/spec/fixtures/vcr_cassettes/entry/select_only_sys.yml +0 -111
  207. data/spec/fixtures/vcr_cassettes/entry.yml +0 -102
  208. data/spec/fixtures/vcr_cassettes/entry_cache.yml +0 -288
  209. data/spec/fixtures/vcr_cassettes/entry_locales.yml +0 -104
  210. data/spec/fixtures/vcr_cassettes/field.yml +0 -147
  211. data/spec/fixtures/vcr_cassettes/human.yml +0 -118
  212. data/spec/fixtures/vcr_cassettes/linkField.yml +0 -83
  213. data/spec/fixtures/vcr_cassettes/locale.yml +0 -83
  214. data/spec/fixtures/vcr_cassettes/locale_from_environment.yml +0 -121
  215. data/spec/fixtures/vcr_cassettes/location.yml +0 -193
  216. data/spec/fixtures/vcr_cassettes/multi_locale_array_reference.yml +0 -196
  217. data/spec/fixtures/vcr_cassettes/multi_locale_reference.yml +0 -214
  218. data/spec/fixtures/vcr_cassettes/not_found.yml +0 -76
  219. data/spec/fixtures/vcr_cassettes/nyancat.yml +0 -102
  220. data/spec/fixtures/vcr_cassettes/query_array_1.yml +0 -89
  221. data/spec/fixtures/vcr_cassettes/query_array_2.yml +0 -89
  222. data/spec/fixtures/vcr_cassettes/ratelimit.yml +0 -64
  223. data/spec/fixtures/vcr_cassettes/ratelimit_retry.yml +0 -294
  224. data/spec/fixtures/vcr_cassettes/reloaded_entry.yml +0 -102
  225. data/spec/fixtures/vcr_cassettes/space.yml +0 -83
  226. data/spec/fixtures/vcr_cassettes/sync_deleted_asset.yml +0 -174
  227. data/spec/fixtures/vcr_cassettes/sync_deleted_entry.yml +0 -89
  228. data/spec/fixtures/vcr_cassettes/sync_deletion.yml +0 -191
  229. data/spec/fixtures/vcr_cassettes/sync_environment.yml +0 -81
  230. data/spec/fixtures/vcr_cassettes/sync_page.yml +0 -637
  231. data/spec/fixtures/vcr_cassettes/sync_page_2.yml +0 -71
  232. data/spec/fixtures/vcr_cassettes/sync_page_short.yml +0 -106
  233. data/spec/fixtures/vcr_cassettes/unauthorized.yml +0 -64
  234. data/spec/fixtures/vcr_cassettes/unavailable.yml +0 -76
  235. data/spec/link_spec.rb +0 -50
  236. data/spec/locale_spec.rb +0 -37
  237. data/spec/location_spec.rb +0 -25
  238. data/spec/request_spec.rb +0 -57
  239. data/spec/resource_building_spec.rb +0 -31
  240. data/spec/response_spec.rb +0 -62
  241. data/spec/space_spec.rb +0 -31
  242. data/spec/spec_helper.rb +0 -14
  243. data/spec/support/client.rb +0 -6
  244. data/spec/support/json_responses.rb +0 -18
  245. data/spec/support/vcr.rb +0 -16
  246. data/spec/sync_page_spec.rb +0 -103
  247. data/spec/sync_spec.rb +0 -180
@@ -1,106 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://cdn.contentful.com/spaces/cfexampleapi/environments/master/sync?initial=true
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - RubyContentfulGem/0.1.3
12
- Authorization:
13
- - Bearer b4c0n73n7fu1
14
- Content-Type:
15
- - application/vnd.contentful.delivery.v1+json
16
- Host:
17
- - cdn.contentful.com
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Date:
24
- - Fri, 25 Apr 2014 13:31:17 GMT
25
- Server:
26
- - nginx/1.1.19
27
- Access-Control-Allow-Headers:
28
- - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization
29
- Access-Control-Allow-Methods:
30
- - GET,HEAD,OPTIONS
31
- Access-Control-Allow-Origin:
32
- - "*"
33
- Access-Control-Max-Age:
34
- - '86400'
35
- Cache-Control:
36
- - max-age=0
37
- Content-Type:
38
- - application/vnd.contentful.delivery.v1+json
39
- Etag:
40
- - '"382e4781b902b58d2edf3f10067167c7"'
41
- X-Contentful-Request-Id:
42
- - f1c-737770542
43
- Content-Length:
44
- - '300'
45
- Accept-Ranges:
46
- - bytes
47
- Via:
48
- - 1.1 varnish
49
- Age:
50
- - '0'
51
- X-Served-By:
52
- - cache-fra1229-FRA
53
- X-Cache:
54
- - MISS
55
- X-Cache-Hits:
56
- - '0'
57
- Vary:
58
- - Accept-Encoding
59
- body:
60
- encoding: UTF-8
61
- string: |
62
- {
63
- "sys": {
64
- "type": "Array"
65
- },
66
- "items": [
67
- {
68
- "sys": {
69
- "space": {
70
- "sys": {
71
- "type": "Link",
72
- "linkType": "Space",
73
- "id": "cfexampleapi"
74
- }
75
- },
76
- "type": "Entry",
77
- "contentType": {
78
- "sys": {
79
- "type": "Link",
80
- "linkType": "ContentType",
81
- "id": "1t9IbcfdCk6m04uISSsaIK"
82
- }
83
- },
84
- "id": "5ETMRzkl9KM4omyMwKAOki",
85
- "revision": 2,
86
- "createdAt": "2014-02-21T13:42:57.752Z",
87
- "updatedAt": "2014-04-16T12:44:02.691Z"
88
- },
89
- "fields": {
90
- "name": {
91
- "en-US": "London"
92
- },
93
- "center": {
94
- "en-US": {
95
- "lat": 51.508515,
96
- "lon": -0.12548719999995228
97
- }
98
- }
99
- }
100
- }
101
- ],
102
- "nextSyncUrl": "https://cdn.contentful.com/spaces/cfexampleapi/environments/master/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCr8Okw6AYwqbDksO3ehvDpUPCgcKsKXbCiAwPC8K2w4LDvsOkw6nCjhPDpcOQADElWsOoU8KGR3HCtsOAwqd6wp_Dulp8w6LDsF_CtsK7Kk05wrMvwrLClMOgG2_Dn2sGPg"
103
- }
104
- http_version:
105
- recorded_at: Fri, 25 Apr 2014 13:31:18 GMT
106
- recorded_with: VCR 2.9.0
@@ -1,64 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://cdn.contentful.com/spaces/wrong/environments/master/entries?sys.id=nyancat
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - RubyContentfulGem/0.1.1
12
- Authorization:
13
- - Bearer credentials
14
- Content-Type:
15
- - application/vnd.contentful.delivery.v1+json
16
- Host:
17
- - cdn.contentful.com
18
- response:
19
- status:
20
- code: 401
21
- message: Unauthorized
22
- headers:
23
- Date:
24
- - Wed, 16 Apr 2014 09:00:24 GMT
25
- Server:
26
- - nginx/1.1.19
27
- Access-Control-Allow-Headers:
28
- - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization
29
- Access-Control-Allow-Methods:
30
- - GET,HEAD,OPTIONS
31
- Access-Control-Allow-Origin:
32
- - "*"
33
- Access-Control-Max-Age:
34
- - '86400'
35
- Cache-Control:
36
- - max-age=0
37
- Content-Type:
38
- - application/vnd.contentful.delivery.v1+json
39
- Content-Length:
40
- - '179'
41
- Accept-Ranges:
42
- - bytes
43
- Via:
44
- - 1.1 varnish
45
- X-Served-By:
46
- - cache-am72-AMS
47
- X-Cache:
48
- - MISS
49
- X-Cache-Hits:
50
- - '0'
51
- body:
52
- encoding: UTF-8
53
- string: |
54
- {
55
- "sys": {
56
- "type": "Error",
57
- "id": "AccessTokenInvalid"
58
- },
59
- "message": "The access token you sent could not be found or is invalid.",
60
- "requestId": "85f-649640521"
61
- }
62
- http_version:
63
- recorded_at: Wed, 16 Apr 2014 09:00:24 GMT
64
- recorded_with: VCR 2.9.0
@@ -1,76 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://cdn.contentful.com/spaces/wrong/environments/master/entries?sys.id=nyancat
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - RubyContentfulGem/1.2.0
12
- Authorization:
13
- - Bearer credentials
14
- Content-Type:
15
- - application/vnd.contentful.delivery.v1+json
16
- Accept-Encoding:
17
- - gzip
18
- Connection:
19
- - close
20
- Host:
21
- - cdn.contentful.com
22
- response:
23
- status:
24
- code: 503
25
- message: ServiceUnavailable
26
- headers:
27
- Access-Control-Allow-Headers:
28
- - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent
29
- Access-Control-Allow-Methods:
30
- - GET,HEAD,OPTIONS
31
- Access-Control-Allow-Origin:
32
- - "*"
33
- Access-Control-Expose-Headers:
34
- - Etag
35
- Access-Control-Max-Age:
36
- - '86400'
37
- Cache-Control:
38
- - max-age=0
39
- Content-Type:
40
- - application/vnd.contentful.delivery.v1+json
41
- Server:
42
- - Contentful
43
- X-Contentful-Request-Id:
44
- - 2c869757aa2dca0bddce49574f85e62b
45
- Content-Length:
46
- - '198'
47
- Accept-Ranges:
48
- - bytes
49
- Date:
50
- - Tue, 20 Dec 2016 16:27:17 GMT
51
- Via:
52
- - 1.1 varnish
53
- Connection:
54
- - close
55
- X-Served-By:
56
- - cache-fra1238-FRA
57
- X-Cache:
58
- - MISS
59
- X-Cache-Hits:
60
- - '0'
61
- X-Timer:
62
- - S1482251237.033636,VS0,VE114
63
- body:
64
- encoding: ASCII-8BIT
65
- string: |
66
- {
67
- "sys": {
68
- "type": "Error",
69
- "id": "AccessTokenInvalid"
70
- },
71
- "message": "The access token you sent could not be found or is invalid.",
72
- "requestId": "2c869757aa2dca0bddce49574f85e62b"
73
- }
74
- http_version:
75
- recorded_at: Tue, 20 Dec 2016 16:27:17 GMT
76
- recorded_with: VCR 3.0.3
data/spec/link_spec.rb DELETED
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Contentful::Link do
4
- let(:client) { create_client }
5
- let(:entry) { vcr('entry') { create_client.entry('nyancat') } }
6
- let(:link) { entry.space }
7
- let(:content_type_link) { entry.content_type }
8
-
9
- describe 'SystemProperties' do
10
- it 'has a #sys getter returning a hash with symbol keys' do
11
- expect(link.sys).to be_a Hash
12
- expect(link.sys.keys.sample).to be_a Symbol
13
- end
14
-
15
- it 'has #id' do
16
- expect(link.id).to eq 'cfexampleapi'
17
- end
18
-
19
- it 'has #type' do
20
- expect(link.type).to eq 'Link'
21
- end
22
-
23
- it 'has #link_type' do
24
- expect(link.link_type).to eq 'Space'
25
- end
26
- end
27
-
28
- describe '#resolve' do
29
- it 'queries the api for the resource' do
30
- vcr('space')do
31
- expect(link.resolve(client)).to be_a Contentful::Space
32
- end
33
- end
34
-
35
- it 'queries the api for the resource (different link object)' do
36
- vcr('content_type')do
37
- expect(content_type_link.resolve(client)).to be_a Contentful::ContentType
38
- end
39
- end
40
- end
41
-
42
- describe 'camel case' do
43
- it 'supports camel case' do
44
- vcr('entry') {
45
- space_link = create_client(use_camel_case: true).entry('nyancat').space
46
- expect(space_link.linkType).to eq 'Space'
47
- }
48
- end
49
- end
50
- end
data/spec/locale_spec.rb DELETED
@@ -1,37 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Contentful::Locale do
4
- let(:locale) { vcr('locale') { create_client.space.locales.first } }
5
-
6
- describe 'Properties' do
7
- it 'has #code' do
8
- expect(locale.code).to eq 'en-US'
9
- end
10
-
11
- it 'has #name' do
12
- expect(locale.name).to eq 'English'
13
- end
14
-
15
- it 'has #default' do
16
- expect(locale.default).to eq true
17
- end
18
- end
19
-
20
- describe 'locales endpoint' do
21
- it 'locales can be fetched from environments' do
22
- vcr('locale_from_environment') {
23
- client = create_client(
24
- space: 'facgnwwgj5fe',
25
- access_token: '<ACCESS_TOKEN>',
26
- environment: 'testing'
27
- )
28
-
29
- locales = client.locales
30
-
31
- expect(locales).to be_a ::Contentful::Array
32
- expect(locales.first).to be_a ::Contentful::Locale
33
- expect(locales.first.code).to eq 'en-US'
34
- }
35
- end
36
- end
37
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Contentful::Location do
4
- let(:location)do
5
- vcr('location')do
6
- Contentful::Client.new(
7
- space: 'lzjz8hygvfgu',
8
- access_token: '0c6ef483524b5e46b3bafda1bf355f38f5f40b4830f7599f790a410860c7c271',
9
- dynamic_entries: :auto,
10
- ).entry('3f6fq5ylFCi4kIYAQKsAYG').location
11
- end
12
- end
13
-
14
- describe 'Properties' do
15
- it 'has #lat' do
16
- expect(location.lat).to be_a Float
17
- expect(location.lat.to_i).to eq 36
18
- end
19
-
20
- it 'has #lon' do
21
- expect(location.lon).to be_a Float
22
- expect(location.lon.to_i).to eq(-94)
23
- end
24
- end
25
- end
data/spec/request_spec.rb DELETED
@@ -1,57 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Contentful::Request do
4
- describe '#get' do
5
- it 'calls client' do
6
- client = create_client
7
- request = Contentful::Request.new(client, '/content_types', nil, 'nyancat')
8
-
9
- expect(client).to receive(:get).with(request)
10
-
11
- request.get
12
- end
13
- end
14
-
15
- describe '#query' do
16
- it 'converts arrays given in query to comma strings' do
17
- client = create_client
18
- request = Contentful::Request.new(client, '/entries', 'fields.likes[in]' => %w(jake finn))
19
- expect(request.query[:'fields.likes[in]']).to eq 'jake,finn'
20
- end
21
- end
22
-
23
- context '[single resource]' do
24
- let(:request)do
25
- Contentful::Request.new(create_client, '/content_types', nil, 'nyancat')
26
- end
27
-
28
- describe '#url' do
29
- it 'contais endpoint' do
30
- expect(request.url).to include 'content_types'
31
- end
32
-
33
- it 'contains id' do
34
- expect(request.url).to include 'nyancat'
35
- end
36
- end
37
- end
38
-
39
- context '[multi resource]' do
40
- let(:request)do
41
- Contentful::Request.new(create_client, '/content_types', 'something' => 'requested')
42
- end
43
-
44
- describe '#query' do
45
- it 'contains query' do
46
- expect(request.query).not_to be_empty
47
- expect(request.query[:something]).to eq 'requested'
48
- end
49
- end
50
-
51
- describe '#url' do
52
- it 'contais endpoint' do
53
- expect(request.url).to include 'content_types'
54
- end
55
- end
56
- end
57
- end
@@ -1,31 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Resource Building Examples' do
4
- it 'can deal with arrays' do
5
- request = Contentful::Request.new(nil, 'entries')
6
- response = Contentful::Response.new(raw_fixture('link_array'), request)
7
- resource = Contentful::ResourceBuilder.new(response.object).run
8
-
9
- expect(resource.fields[:links]).to be_a Array
10
- expect(resource.fields[:links].first).to be_a Contentful::Link
11
- end
12
-
13
- it 'replaces links with included versions if present' do
14
- request = Contentful::Request.new(nil, 'entries')
15
- response = Contentful::Response.new(raw_fixture('includes'), request)
16
- resource = Contentful::ResourceBuilder.new(response.object).run.first
17
-
18
- expect(resource.fields[:links]).to be_a Array
19
- expect(resource.fields[:links].first).to be_a Contentful::Entry
20
- end
21
-
22
- it 'can also reference itself' do
23
- request = Contentful::Request.new(nil, 'entries')
24
- response = Contentful::Response.new(raw_fixture('self_link'), request)
25
- resource = Contentful::ResourceBuilder.new(response.object).run.first
26
-
27
- other_resource = resource.fields[:e]
28
- expect(other_resource).to be_a Contentful::Entry
29
- expect(other_resource.fields[:e]).to eq resource
30
- end
31
- end
@@ -1,62 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Contentful::Response do
4
- let(:successful_response) { Contentful::Response.new raw_fixture('nyancat'), Contentful::Request.new(nil, '/entries', nil, 'nyancat') }
5
- let(:error_response) { Contentful::Response.new raw_fixture('not_found', 404) }
6
- let(:unparsable_response) { Contentful::Response.new raw_fixture('unparsable') }
7
-
8
- describe '#raw' do
9
- it 'returns the raw response it has been initalized with' do
10
- expect(successful_response.raw.to_s).to eql raw_fixture('nyancat').to_s
11
- end
12
- end
13
-
14
- describe '#object' do
15
- it "returns the repsonse's parsed json" do
16
- expect(successful_response.object).to eq json_fixture('nyancat')
17
- end
18
- end
19
-
20
- describe '#request' do
21
- it 'returns the request the response has been initalized with' do
22
- expect(successful_response.request).to be_a Contentful::Request
23
- end
24
- end
25
-
26
- describe '#status' do
27
- it 'returns :ok for normal responses' do
28
- expect(successful_response.status).to eq :ok
29
- end
30
-
31
- it 'returns :error for error responses' do
32
- expect(error_response.status).to eq :error
33
- end
34
-
35
- it 'returns :error for unparsable json responses' do
36
- expect(unparsable_response.status).to eq :error
37
- end
38
-
39
- it 'returns :error for responses without content' do
40
- raw_response = ''
41
- allow(raw_response).to receive(:status) { 204 }
42
- no_content_response = Contentful::Response.new raw_response
43
- expect(no_content_response.status).to eq :no_content
44
- end
45
- end
46
-
47
- describe '#error_message' do
48
- it 'returns contentful error message for contentful errors' do
49
- expect(error_response.error_message).to eq 'The resource could not be found.'
50
- end
51
-
52
- it 'returns json parser error message for json parse errors' do
53
- expect(unparsable_response.error_message).to include 'unexpected token'
54
- end
55
-
56
- it 'returns a ServiceUnavailable error on a 503' do
57
- error_response = Contentful::Response.new raw_fixture('not_found', 503)
58
- expect(error_response.status).to eql :error
59
- expect(error_response.object).to be_kind_of Contentful::ServiceUnavailable
60
- end
61
- end
62
- end
data/spec/space_spec.rb DELETED
@@ -1,31 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Contentful::Space do
4
- let(:space) { vcr('space') { create_client.space } }
5
-
6
- describe 'SystemProperties' do
7
- it 'has a #sys getter returning a hash with symbol keys' do
8
- expect(space.sys).to be_a Hash
9
- expect(space.sys.keys.sample).to be_a Symbol
10
- end
11
-
12
- it 'has #id' do
13
- expect(space.id).to eq 'cfexampleapi'
14
- end
15
-
16
- it 'has #type' do
17
- expect(space.type).to eq 'Space'
18
- end
19
- end
20
-
21
- describe 'Properties' do
22
- it 'has #name' do
23
- expect(space.name).to eq 'Contentful Example API'
24
- end
25
-
26
- it 'has #locales' do
27
- expect(space.locales).to be_a Array
28
- expect(space.locales.first).to be_a Contentful::Locale
29
- end
30
- end
31
- end
data/spec/spec_helper.rb DELETED
@@ -1,14 +0,0 @@
1
- require 'simplecov'
2
- SimpleCov.start
3
-
4
- require 'rspec'
5
- require 'contentful'
6
- require 'securerandom'
7
- require 'rr'
8
-
9
- Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }
10
-
11
- RSpec.configure do |config|
12
- config.filter_run :focus => true
13
- config.run_all_when_everything_filtered = true
14
- end
@@ -1,6 +0,0 @@
1
- def create_client(options = {})
2
- Contentful::Client.new({
3
- space: 'cfexampleapi',
4
- access_token: 'b4c0n73n7fu1',
5
- }.merge(options))
6
- end
@@ -1,18 +0,0 @@
1
- require 'multi_json'
2
-
3
- def raw_fixture(which, status = 200, _as_json = false, headers = {})
4
- object = Object.new
5
- allow(object).to receive(:status) { status }
6
- allow(object).to receive(:headers) { headers }
7
- allow(object).to receive(:to_s) { File.read File.dirname(__FILE__) + "/../fixtures/json_responses/#{which}.json" }
8
- allow(object).to receive(:body) { object.to_s }
9
- allow(object).to receive(:[]) { |key| object.headers[key] }
10
-
11
- object
12
- end
13
-
14
- def json_fixture(which, _as_json = false)
15
- MultiJson.load(
16
- File.read File.dirname(__FILE__) + "/../fixtures/json_responses/#{which}.json"
17
- )
18
- end
data/spec/support/vcr.rb DELETED
@@ -1,16 +0,0 @@
1
- require 'vcr'
2
-
3
- VCR.configure do |c|
4
- c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
5
- c.ignore_localhost = true
6
- c.hook_into :webmock
7
- c.default_cassette_options = { record: :once }
8
- end
9
-
10
- def vcr(name, &block)
11
- VCR.use_cassette(name, &block)
12
- end
13
-
14
- def expect_vcr(name, &block)
15
- expect { VCR.use_cassette(name, &block) }
16
- end