contentful 2.15.3 → 2.16.2

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0961f6c5c63757f6312f2a0a7ba6fa0ae1fdfa9741021a6f691593fc5fdb389
4
- data.tar.gz: 014f41f41ac940c9f26aedf60c39dda66ebbedb48eac0b3872e0a695ba3443e1
3
+ metadata.gz: c77c841eb951e64584e685f03ce1d0da8534420e162f336330813c877481c12e
4
+ data.tar.gz: 52b7416520d57ffba83e2f06490714fd620c4553c8f3dd8ede4361f411879c9c
5
5
  SHA512:
6
- metadata.gz: 43d0444456c462f1a8f4f8176558fdaa29d804587455513fe5db80e1c6dae2f7446277ef78af021150e180374350aa86ce63487613e86ac56e5fb4aaaee2c079
7
- data.tar.gz: f77176128208a7df1b6e6f9e422917788a68d626921f46932cdbaca2f9d0141ed829a6a5ff271dc879851ee499d6a2863e389468740dd79e338916121a766bfe
6
+ metadata.gz: 5a64c6adfc0fabf56f44b87e12b3df902bcfaa43b2282b0e52f04bed468e8137263b8ad67622b16987480a1c7bf95e4a6e6eb94cd2fc6fb653442ac0dcca3769
7
+ data.tar.gz: 80a5851644694f7967b1e3e38db6e11cf03f06bb4463a4bf9fa23b37dfc6ca80a8bb8152c0332515cfa7b56952b7a6c59434522312814988940864c9e0c304aa
data/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.16.2
6
+ ### Fixed
7
+ * Fixed an issue where entry's `raw['fields']` was unexpectedly overwritten by `FieldsResource#raw_with_links` method.
8
+
9
+ ## 2.16.1
10
+ * Removed unncessary files from gem release package.
11
+
12
+ ## 2.16.0
13
+
14
+ ### Added
15
+ * Added `Contentful::ArrayLike#to_ary`. [#200](https://github.com/contentful/contentful.rb/issues/200)
16
+ * Added `_metadata[:tags]` to read metadata tags on `entry` and `asset`.
17
+
18
+ ## 2.15.4
19
+
20
+ ### Fixed
21
+ * Fixed an issue where the `log_level` of `Logger` was changed unintentionally [#222](https://github.com/contentful/contentful.rb/pull/222)
22
+ * Fixed an issue cause by a `Logger` not being correctly thrown away, causing an exception. [#220](https://github.com/contentful/contentful.rb/pull/220)
23
+ * Added `title` field to assets to prevent Error raising when the field is empty. [#218](https://github.com/contentful/contentful.rb/pull/218)
24
+ * Fixed an issue with `ArrayLike` not taking multiple arguments leading to Errors when using it with pagination libraries. [#215](https://github.com/contentful/contentful.rb/pull/215)
25
+
5
26
  ## 2.15.3
6
27
  ### Fixed
7
28
  * Fixed a deprecation warning in Ruby 2.7.0 for `URI::escape` and replaced it with a backwards compatible mechanism. [#217](https://github.com/contentful/contentful.rb/issues/217)
data/README.md CHANGED
@@ -10,10 +10,10 @@
10
10
  </a>
11
11
  </p>
12
12
 
13
- # contentful.rb - Contentful Ruby Delivery SDK
13
+ # contentful.rb - Contentful Ruby Delivery Library
14
14
  [![Gem Version](https://badge.fury.io/rb/contentful.png)](http://badge.fury.io/rb/contentful)
15
15
 
16
- > Ruby SDK for the Contentful [Content Delivery API](https://www.contentful.com/developers/docs/references/content-delivery-api/) and [Content Preview API](https://www.contentful.com/developers/docs/references/content-preview-api/). It helps you to easily access your Content stored in Contentful with your Ruby applications.
16
+ > Ruby library for the Contentful [Content Delivery API](https://www.contentful.com/developers/docs/references/content-delivery-api/) and [Content Preview API](https://www.contentful.com/developers/docs/references/content-preview-api/). It helps you to easily access your Content stored in Contentful with your Ruby applications.
17
17
 
18
18
  <p align="center">
19
19
  <img src="https://img.shields.io/badge/Status-Maintained-green.svg" alt="This repository is actively maintained" /> &nbsp;
@@ -45,12 +45,12 @@
45
45
 
46
46
  <!-- TOC -->
47
47
 
48
- - [contentful.rb - Contentful Ruby Delivery SDK](#contentfulrb---contentful-ruby-delivery-sdk)
48
+ - [contentful.rb - Contentful Ruby Delivery library](#contentfulrb---contentful-ruby-delivery-library)
49
49
  - [Core Features](#core-features)
50
50
  - [Getting started](#getting-started)
51
51
  - [Installation](#installation)
52
52
  - [Your first request](#your-first-request)
53
- - [Using this SDK with the Preview API](#using-this-sdk-with-the-preview-api)
53
+ - [Using this library with the Preview API](#using-this-library-with-the-preview-api)
54
54
  - [Authentication](#authentication)
55
55
  - [Documentation & References](#documentation--references)
56
56
  - [Configuration](#configuration)
@@ -94,11 +94,11 @@
94
94
 
95
95
  ## Getting started
96
96
 
97
- In order to get started with the Contentful Ruby SDK you'll need not only to install it, but also to get credentials which will allow you to have access to your content in Contentful.
97
+ In order to get started with the Contentful Ruby library you'll need not only to install it, but also to get credentials which will allow you to have access to your content in Contentful.
98
98
 
99
99
  - [Installation](#installation)
100
100
  - [Your first request](#your-first-request)
101
- - [Using this SDK with the Preview API](#using-this-sdk-with-the-preview-api)
101
+ - [Using this library with the Preview API](#using-this-library-with-the-preview-api)
102
102
  - [Authentication](#authentication)
103
103
  - [Documentation & References](#documentation--references)
104
104
 
@@ -118,7 +118,7 @@ gem i contentful
118
118
 
119
119
  ### Your first request
120
120
 
121
- The following code snippet is the most basic one you can use to get some content from Contentful with this SDK:
121
+ The following code snippet is the most basic one you can use to get some content from Contentful with this library:
122
122
 
123
123
  ```ruby
124
124
  require 'contentful'
@@ -132,9 +132,9 @@ client = Contentful::Client.new(
132
132
  entry = client.entry('nyancat')
133
133
  ```
134
134
 
135
- ### Using this SDK with the Preview API
135
+ ### Using this library with the Preview API
136
136
 
137
- This SDK can also be used with the Preview API. In order to do so, you need to use the Preview API Access token, available on the same page where you get the Delivery API token, and specify the host of the preview API, such as:
137
+ This library can also be used with the Preview API. In order to do so, you need to use the Preview API Access token, available on the same page where you get the Delivery API token, and specify the host of the preview API, such as:
138
138
 
139
139
  ```ruby
140
140
  require 'contentful'
@@ -168,7 +168,7 @@ For more information, check the [Contentful REST API reference on Authentication
168
168
  - [Migrating to 2.x](#migrating-to-2x)
169
169
 
170
170
 
171
- To help you get the most out of this SDK, we've prepared all available client configuration options, reference documentation, tutorials and other examples that will help you learn and understand how to use this library.
171
+ To help you get the most out of this library, we've prepared all available client configuration options, reference documentation, tutorials and other examples that will help you learn and understand how to use this library.
172
172
 
173
173
  ### Configuration
174
174
 
@@ -287,7 +287,7 @@ client = Contentful::Client.new(
287
287
  <td><code>max_include_resolution_depth</code></td>
288
288
  <td><code>20</code></td>
289
289
  <td>
290
- Maximum amount of levels to resolve includes for SDK entities
290
+ Maximum amount of levels to resolve includes for library entities
291
291
  (this is independent of API-level includes - it represents the maximum depth the include resolution
292
292
  tree is allowed to resolved before falling back to <code>Link</code> objects).
293
293
  This include resolution strategy is in place in order to avoid having infinite circular recursion on resources with circular dependencies.
@@ -363,6 +363,8 @@ client = Contentful::Client.new(
363
363
  <td>
364
364
  The default severity is set to INFO and logs only the request attributes (headers, parameters and url).
365
365
  Setting it to DEBUG will also log the raw JSON response.
366
+ WARNING: Setting this will override the level on the logger instance. Leave out this key to preserve
367
+ the original log_level on the logger, for example when using Rails.logger.
366
368
  </td>
367
369
  </tr>
368
370
  </tbody>
@@ -422,6 +424,15 @@ entry.color # 'rainbow'
422
424
  entry.birthday # #<DateTime: 2011-04-04T22:00:00+00:00 ((2455656j,79200s,0n),+0s,2299161j)>
423
425
  ```
424
426
 
427
+ #### Accessing tags
428
+
429
+ Tags can be accessed via the `#_metadata` method.
430
+
431
+ ```ruby
432
+ entry = client.entry 'nyancat'
433
+ entry._metadata[:tags] # => [<Contentful::Link id='tagID'>]
434
+ ```
435
+
425
436
  #### Dynamic entries
426
437
 
427
438
  However, you can (and should) set `:dynamic_entries` to `:auto` in your client configuration.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Contentful
2
4
  # Useful methods for array-like resources that can be included if an
3
5
  # :items property exists
@@ -37,8 +39,8 @@ module Contentful
37
39
  # Delegates to items#[]
38
40
  #
39
41
  # @return [Contentful::Entry, Contentful::Asset]
40
- def [](index)
41
- items[index]
42
+ def [](*args)
43
+ items[*args]
42
44
  end
43
45
 
44
46
  # Delegates to items#last
@@ -47,5 +49,12 @@ module Contentful
47
49
  def last
48
50
  items.last
49
51
  end
52
+
53
+ # Delegates to items#to_ary
54
+ #
55
+ # @return [Contentful::Entry, Contentful::Asset]
56
+ def to_ary
57
+ items
58
+ end
50
59
  end
51
60
  end
@@ -93,6 +93,10 @@ module Contentful
93
93
  end
94
94
 
95
95
  def define_asset_methods!
96
+ define_singleton_method :title do
97
+ fields.fetch(:title, nil)
98
+ end
99
+
96
100
  define_singleton_method :description do
97
101
  fields.fetch(:description, nil)
98
102
  end
@@ -5,7 +5,7 @@ require_relative 'support'
5
5
  module Contentful
6
6
  # Base definition of a Contentful Resource containing Sys properties
7
7
  class BaseResource
8
- attr_reader :raw, :default_locale, :sys
8
+ attr_reader :raw, :default_locale, :sys, :_metadata
9
9
 
10
10
  # rubocop:disable Metrics/ParameterLists
11
11
  def initialize(item, configuration = {}, _localized = false, _includes = [], entries = {}, depth = 0, _errors = [])
@@ -15,6 +15,7 @@ module Contentful
15
15
  @depth = depth
16
16
  @configuration = configuration
17
17
  @sys = hydrate_sys
18
+ @_metadata = hydrate_metadata
18
19
 
19
20
  define_sys_methods!
20
21
  end
@@ -36,7 +37,8 @@ module Contentful
36
37
  end
37
38
 
38
39
  {
39
- configuration: @configuration.merge(entry_mapping: entry_mapping),
40
+ # loggers usually have a file handle that can't be marshalled, so let's not return that
41
+ configuration: @configuration.merge(entry_mapping: entry_mapping, logger: nil),
40
42
  raw: raw
41
43
  }
42
44
  end
@@ -56,6 +58,7 @@ module Contentful
56
58
  @configuration = raw_object[:configuration]
57
59
  @default_locale = @configuration[:default_locale]
58
60
  @sys = hydrate_sys
61
+ @_metadata = hydrate_metadata
59
62
  @depth = 0
60
63
  define_sys_methods!
61
64
  end
@@ -92,6 +95,15 @@ module Contentful
92
95
  result
93
96
  end
94
97
 
98
+ def hydrate_metadata
99
+ result = {}
100
+ raw.fetch('metadata', {}).each do |k, v|
101
+ v.map! { |tag| build_link(tag) } if k == 'tags'
102
+ result[Support.snakify(k, @configuration[:use_camel_case]).to_sym] = v
103
+ end
104
+ result
105
+ end
106
+
95
107
  protected
96
108
 
97
109
  def repr_name
@@ -30,7 +30,6 @@ module Contentful
30
30
  raw_mode: false,
31
31
  gzip_encoded: true,
32
32
  logger: false,
33
- log_level: Logger::INFO,
34
33
  proxy_host: nil,
35
34
  proxy_username: nil,
36
35
  proxy_password: nil,
@@ -105,7 +104,7 @@ module Contentful
105
104
  # @private
106
105
  def setup_logger
107
106
  @logger = configuration[:logger]
108
- logger.level = configuration[:log_level] if logger
107
+ logger.level = configuration[:log_level] if logger && configuration.key?(:log_level)
109
108
  end
110
109
 
111
110
  # @private
@@ -67,6 +67,7 @@ module Contentful
67
67
  def raw_with_links
68
68
  links = fields.keys.select { |property| known_link?(property) }
69
69
  processed_raw = raw.clone
70
+ processed_raw['fields'] = raw['fields'].clone
70
71
  raw['fields'].each do |k, v|
71
72
  links_key = Support.snakify(k, @configuration[:use_camel_case])
72
73
  processed_raw['fields'][k] = links.include?(links_key.to_sym) ? send(links_key) : v
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '2.15.3'
4
+ VERSION = '2.16.2'
5
5
  end