contentful 2.15.4 → 2.16.3

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 (252) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +20 -11
  4. data/lib/contentful/array_like.rb +9 -0
  5. data/lib/contentful/base_resource.rb +12 -1
  6. data/lib/contentful/fields_resource.rb +1 -0
  7. data/lib/contentful/version.rb +1 -1
  8. metadata +3 -373
  9. data/.gitignore +0 -7
  10. data/.rspec +0 -1
  11. data/.rubocop.yml +0 -31
  12. data/.rubocop_todo.yml +0 -35
  13. data/.ruby-version +0 -1
  14. data/.travis.yml +0 -15
  15. data/.yardopts +0 -4
  16. data/Gemfile +0 -9
  17. data/Gemfile.lock +0 -170
  18. data/Guardfile +0 -24
  19. data/RELEASE.md +0 -8
  20. data/Rakefile +0 -33
  21. data/contentful.gemspec +0 -44
  22. data/contentful.rb.sublime-project +0 -9
  23. data/contentful.rb.sublime-workspace +0 -2154
  24. data/coverage/.last_run.json +0 -5
  25. data/coverage/.resultset.json +0 -2421
  26. data/coverage/.resultset.json.lock +0 -0
  27. data/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_asc.png +0 -0
  28. data/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
  29. data/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_both.png +0 -0
  30. data/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_desc.png +0 -0
  31. data/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
  32. data/coverage/assets/0.12.2/application.css +0 -1
  33. data/coverage/assets/0.12.2/application.js +0 -7
  34. data/coverage/assets/0.12.2/colorbox/border.png +0 -0
  35. data/coverage/assets/0.12.2/colorbox/controls.png +0 -0
  36. data/coverage/assets/0.12.2/colorbox/loading.gif +0 -0
  37. data/coverage/assets/0.12.2/colorbox/loading_background.png +0 -0
  38. data/coverage/assets/0.12.2/favicon_green.png +0 -0
  39. data/coverage/assets/0.12.2/favicon_red.png +0 -0
  40. data/coverage/assets/0.12.2/favicon_yellow.png +0 -0
  41. data/coverage/assets/0.12.2/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  42. data/coverage/assets/0.12.2/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  43. data/coverage/assets/0.12.2/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  44. data/coverage/assets/0.12.2/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  45. data/coverage/assets/0.12.2/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  46. data/coverage/assets/0.12.2/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  47. data/coverage/assets/0.12.2/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  48. data/coverage/assets/0.12.2/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  49. data/coverage/assets/0.12.2/images/ui-icons_222222_256x240.png +0 -0
  50. data/coverage/assets/0.12.2/images/ui-icons_2e83ff_256x240.png +0 -0
  51. data/coverage/assets/0.12.2/images/ui-icons_454545_256x240.png +0 -0
  52. data/coverage/assets/0.12.2/images/ui-icons_888888_256x240.png +0 -0
  53. data/coverage/assets/0.12.2/images/ui-icons_cd0a0a_256x240.png +0 -0
  54. data/coverage/assets/0.12.2/loading.gif +0 -0
  55. data/coverage/assets/0.12.2/magnify.png +0 -0
  56. data/coverage/index.html +0 -26587
  57. data/doc/Contentful/AccessDenied.html +0 -159
  58. data/doc/Contentful/Array.html +0 -844
  59. data/doc/Contentful/ArrayCoercion.html +0 -242
  60. data/doc/Contentful/ArrayLike.html +0 -624
  61. data/doc/Contentful/Asset.html +0 -486
  62. data/doc/Contentful/BadGateway.html +0 -159
  63. data/doc/Contentful/BadRequest.html +0 -159
  64. data/doc/Contentful/BaseCoercion.html +0 -445
  65. data/doc/Contentful/BaseResource.html +0 -598
  66. data/doc/Contentful/BooleanCoercion.html +0 -242
  67. data/doc/Contentful/Client.html +0 -1738
  68. data/doc/Contentful/ContentType.html +0 -617
  69. data/doc/Contentful/ContentTypeCache.html +0 -428
  70. data/doc/Contentful/DateCoercion.html +0 -244
  71. data/doc/Contentful/DeletedAsset.html +0 -156
  72. data/doc/Contentful/DeletedEntry.html +0 -156
  73. data/doc/Contentful/EmptyFieldError.html +0 -217
  74. data/doc/Contentful/Entry.html +0 -334
  75. data/doc/Contentful/Error.html +0 -407
  76. data/doc/Contentful/Field.html +0 -935
  77. data/doc/Contentful/FieldsResource.html +0 -583
  78. data/doc/Contentful/File.html +0 -218
  79. data/doc/Contentful/FloatCoercion.html +0 -238
  80. data/doc/Contentful/IntegerCoercion.html +0 -238
  81. data/doc/Contentful/Link.html +0 -246
  82. data/doc/Contentful/LinkCoercion.html +0 -156
  83. data/doc/Contentful/Locale.html +0 -536
  84. data/doc/Contentful/Location.html +0 -382
  85. data/doc/Contentful/LocationCoercion.html +0 -238
  86. data/doc/Contentful/NotFound.html +0 -159
  87. data/doc/Contentful/ObjectCoercion.html +0 -238
  88. data/doc/Contentful/RateLimitExceeded.html +0 -346
  89. data/doc/Contentful/Request.html +0 -895
  90. data/doc/Contentful/ResourceBuilder.html +0 -1067
  91. data/doc/Contentful/ResourceReferences.html +0 -254
  92. data/doc/Contentful/Response.html +0 -708
  93. data/doc/Contentful/RichTextCoercion.html +0 -238
  94. data/doc/Contentful/ServerError.html +0 -159
  95. data/doc/Contentful/ServiceUnavailable.html +0 -159
  96. data/doc/Contentful/Space.html +0 -392
  97. data/doc/Contentful/StringCoercion.html +0 -242
  98. data/doc/Contentful/Support.html +0 -788
  99. data/doc/Contentful/SymbolCoercion.html +0 -169
  100. data/doc/Contentful/Sync.html +0 -653
  101. data/doc/Contentful/SyncPage.html +0 -807
  102. data/doc/Contentful/TextCoercion.html +0 -169
  103. data/doc/Contentful/Unauthorized.html +0 -159
  104. data/doc/Contentful/UnparsableJson.html +0 -159
  105. data/doc/Contentful/UnparsableResource.html +0 -135
  106. data/doc/Contentful.html +0 -157
  107. data/doc/_index.html +0 -563
  108. data/doc/class_list.html +0 -51
  109. data/doc/css/common.css +0 -1
  110. data/doc/css/full_list.css +0 -58
  111. data/doc/css/style.css +0 -496
  112. data/doc/file.CHANGELOG.html +0 -715
  113. data/doc/file.LICENSE.html +0 -70
  114. data/doc/file.README.html +0 -758
  115. data/doc/file_list.html +0 -66
  116. data/doc/frames.html +0 -17
  117. data/doc/index.html +0 -758
  118. data/doc/js/app.js +0 -314
  119. data/doc/js/full_list.js +0 -216
  120. data/doc/js/jquery.js +0 -4
  121. data/doc/method_list.html +0 -1187
  122. data/doc/top-level-namespace.html +0 -110
  123. data/examples/custom_classes.rb +0 -39
  124. data/examples/example_queries.rb +0 -26
  125. data/examples/raise_errors.rb +0 -20
  126. data/examples/raw_mode.rb +0 -14
  127. data/spec/array_spec.rb +0 -177
  128. data/spec/asset_spec.rb +0 -192
  129. data/spec/auto_includes_spec.rb +0 -12
  130. data/spec/client_class_spec.rb +0 -86
  131. data/spec/client_configuration_spec.rb +0 -394
  132. data/spec/content_type_spec.rb +0 -49
  133. data/spec/deleted_asset_spec.rb +0 -38
  134. data/spec/deleted_entry_spec.rb +0 -38
  135. data/spec/entry_spec.rb +0 -787
  136. data/spec/error_class_spec.rb +0 -327
  137. data/spec/error_requests_spec.rb +0 -87
  138. data/spec/field_spec.rb +0 -95
  139. data/spec/file_spec.rb +0 -33
  140. data/spec/fixtures/json_responses/400_details_errors_object.json +0 -14
  141. data/spec/fixtures/json_responses/400_details_errors_string.json +0 -12
  142. data/spec/fixtures/json_responses/400_details_string.json +0 -8
  143. data/spec/fixtures/json_responses/403_reasons.json +0 -13
  144. data/spec/fixtures/json_responses/404_details_string.json +0 -8
  145. data/spec/fixtures/json_responses/404_id.json +0 -11
  146. data/spec/fixtures/json_responses/404_sys_type.json +0 -12
  147. data/spec/fixtures/json_responses/404_type.json +0 -10
  148. data/spec/fixtures/json_responses/content_type.json +0 -83
  149. data/spec/fixtures/json_responses/default_400.json +0 -7
  150. data/spec/fixtures/json_responses/default_401.json +0 -7
  151. data/spec/fixtures/json_responses/default_403.json +0 -7
  152. data/spec/fixtures/json_responses/default_404.json +0 -7
  153. data/spec/fixtures/json_responses/default_429.json +0 -7
  154. data/spec/fixtures/json_responses/default_500.json +0 -7
  155. data/spec/fixtures/json_responses/default_502.json +0 -7
  156. data/spec/fixtures/json_responses/default_503.json +0 -7
  157. data/spec/fixtures/json_responses/includes.json +0 -111
  158. data/spec/fixtures/json_responses/link_array.json +0 -43
  159. data/spec/fixtures/json_responses/not_found.json +0 -13
  160. data/spec/fixtures/json_responses/nyancat.json +0 -48
  161. data/spec/fixtures/json_responses/other_error.json +0 -9
  162. data/spec/fixtures/json_responses/other_error_no_details.json +0 -8
  163. data/spec/fixtures/json_responses/other_error_no_message.json +0 -8
  164. data/spec/fixtures/json_responses/other_error_no_request_id.json +0 -8
  165. data/spec/fixtures/json_responses/other_error_nothing.json +0 -6
  166. data/spec/fixtures/json_responses/self_link.json +0 -82
  167. data/spec/fixtures/json_responses/unparsable.json +0 -13
  168. data/spec/fixtures/vcr_cassettes/array/marshal_custom_classes.yml +0 -159
  169. data/spec/fixtures/vcr_cassettes/array/marshal_unpublished.yml +0 -315
  170. data/spec/fixtures/vcr_cassettes/array/nested_resources.yml +0 -159
  171. data/spec/fixtures/vcr_cassettes/array.yml +0 -288
  172. data/spec/fixtures/vcr_cassettes/arrayField.yml +0 -87
  173. data/spec/fixtures/vcr_cassettes/array_page_1.yml +0 -106
  174. data/spec/fixtures/vcr_cassettes/array_page_2.yml +0 -73
  175. data/spec/fixtures/vcr_cassettes/asset/select_empty_array.yml +0 -104
  176. data/spec/fixtures/vcr_cassettes/asset/select_no_sys.yml +0 -119
  177. data/spec/fixtures/vcr_cassettes/asset/select_one_field.yml +0 -97
  178. data/spec/fixtures/vcr_cassettes/asset/select_only_sys.yml +0 -88
  179. data/spec/fixtures/vcr_cassettes/asset.yml +0 -96
  180. data/spec/fixtures/vcr_cassettes/assets/issues_129.yml +0 -90
  181. data/spec/fixtures/vcr_cassettes/assets/issues_jekyll_46.yml +0 -115
  182. data/spec/fixtures/vcr_cassettes/bad_request.yml +0 -76
  183. data/spec/fixtures/vcr_cassettes/content_type.yml +0 -147
  184. data/spec/fixtures/vcr_cassettes/entries/empty_fields.yml +0 -246
  185. data/spec/fixtures/vcr_cassettes/entries/issue_117.yml +0 -201
  186. data/spec/fixtures/vcr_cassettes/entries/issue_125.yml +0 -198
  187. data/spec/fixtures/vcr_cassettes/entries/rich_text.yml +0 -1707
  188. data/spec/fixtures/vcr_cassettes/entries/rich_text_hydration_issue.yml +0 -460
  189. data/spec/fixtures/vcr_cassettes/entries/rich_text_nested_fields.yml +0 -653
  190. data/spec/fixtures/vcr_cassettes/entries/rich_text_unresolved_relationships.yml +0 -983
  191. data/spec/fixtures/vcr_cassettes/entries/unresolvable_assets.yml +0 -89
  192. data/spec/fixtures/vcr_cassettes/entries/unresolvable_filter.yml +0 -159
  193. data/spec/fixtures/vcr_cassettes/entries/unresolvable_filter_deeply_nested.yml +0 -167
  194. data/spec/fixtures/vcr_cassettes/entries.yml +0 -561
  195. data/spec/fixtures/vcr_cassettes/entry/custom_resource.yml +0 -168
  196. data/spec/fixtures/vcr_cassettes/entry/include_resolution.yml +0 -101
  197. data/spec/fixtures/vcr_cassettes/entry/include_resolution_uniques.yml +0 -81
  198. data/spec/fixtures/vcr_cassettes/entry/json_objects.yml +0 -88
  199. data/spec/fixtures/vcr_cassettes/entry/json_objects_client.yml +0 -86
  200. data/spec/fixtures/vcr_cassettes/entry/marshal_138.yml +0 -159
  201. data/spec/fixtures/vcr_cassettes/entry/marshal_unpublished.yml +0 -303
  202. data/spec/fixtures/vcr_cassettes/entry/marshall.yml +0 -293
  203. data/spec/fixtures/vcr_cassettes/entry/raw.yml +0 -201
  204. data/spec/fixtures/vcr_cassettes/entry/search_link_to_asset.yml +0 -81
  205. data/spec/fixtures/vcr_cassettes/entry/search_link_to_entry.yml +0 -81
  206. data/spec/fixtures/vcr_cassettes/entry/search_link_to_entry_with_custom_query.yml +0 -115
  207. data/spec/fixtures/vcr_cassettes/entry/select_empty_array.yml +0 -111
  208. data/spec/fixtures/vcr_cassettes/entry/select_no_sys.yml +0 -102
  209. data/spec/fixtures/vcr_cassettes/entry/select_one_field.yml +0 -76
  210. data/spec/fixtures/vcr_cassettes/entry/select_one_field_proper.yml +0 -114
  211. data/spec/fixtures/vcr_cassettes/entry/select_only_sys.yml +0 -111
  212. data/spec/fixtures/vcr_cassettes/entry.yml +0 -102
  213. data/spec/fixtures/vcr_cassettes/entry_cache.yml +0 -288
  214. data/spec/fixtures/vcr_cassettes/entry_locales.yml +0 -104
  215. data/spec/fixtures/vcr_cassettes/field.yml +0 -147
  216. data/spec/fixtures/vcr_cassettes/human.yml +0 -118
  217. data/spec/fixtures/vcr_cassettes/linkField.yml +0 -83
  218. data/spec/fixtures/vcr_cassettes/locale.yml +0 -83
  219. data/spec/fixtures/vcr_cassettes/locale_from_environment.yml +0 -121
  220. data/spec/fixtures/vcr_cassettes/location.yml +0 -193
  221. data/spec/fixtures/vcr_cassettes/multi_locale_array_reference.yml +0 -196
  222. data/spec/fixtures/vcr_cassettes/multi_locale_reference.yml +0 -214
  223. data/spec/fixtures/vcr_cassettes/not_found.yml +0 -76
  224. data/spec/fixtures/vcr_cassettes/nyancat.yml +0 -102
  225. data/spec/fixtures/vcr_cassettes/query_array_1.yml +0 -89
  226. data/spec/fixtures/vcr_cassettes/query_array_2.yml +0 -89
  227. data/spec/fixtures/vcr_cassettes/ratelimit.yml +0 -64
  228. data/spec/fixtures/vcr_cassettes/ratelimit_retry.yml +0 -294
  229. data/spec/fixtures/vcr_cassettes/reloaded_entry.yml +0 -102
  230. data/spec/fixtures/vcr_cassettes/space.yml +0 -83
  231. data/spec/fixtures/vcr_cassettes/sync_deleted_asset.yml +0 -174
  232. data/spec/fixtures/vcr_cassettes/sync_deleted_entry.yml +0 -89
  233. data/spec/fixtures/vcr_cassettes/sync_deletion.yml +0 -191
  234. data/spec/fixtures/vcr_cassettes/sync_environment.yml +0 -81
  235. data/spec/fixtures/vcr_cassettes/sync_page.yml +0 -637
  236. data/spec/fixtures/vcr_cassettes/sync_page_2.yml +0 -71
  237. data/spec/fixtures/vcr_cassettes/sync_page_short.yml +0 -106
  238. data/spec/fixtures/vcr_cassettes/unauthorized.yml +0 -64
  239. data/spec/fixtures/vcr_cassettes/unavailable.yml +0 -76
  240. data/spec/link_spec.rb +0 -50
  241. data/spec/locale_spec.rb +0 -37
  242. data/spec/location_spec.rb +0 -25
  243. data/spec/request_spec.rb +0 -57
  244. data/spec/resource_building_spec.rb +0 -31
  245. data/spec/response_spec.rb +0 -62
  246. data/spec/space_spec.rb +0 -31
  247. data/spec/spec_helper.rb +0 -14
  248. data/spec/support/client.rb +0 -6
  249. data/spec/support/json_responses.rb +0 -18
  250. data/spec/support/vcr.rb +0 -16
  251. data/spec/sync_page_spec.rb +0 -103
  252. data/spec/sync_spec.rb +0 -180
data/spec/entry_spec.rb DELETED
@@ -1,787 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Contentful::Entry do
4
- let(:entry) { vcr('entry') { create_client.entry 'nyancat' } }
5
-
6
- let(:subclass) do
7
- Class.new(described_class) do
8
- # An overridden sys method:
9
- def created_at; 'yesterday'; end
10
-
11
- # An overridden field method:
12
- def best_friend; 'octocat'; end
13
- end
14
- end
15
-
16
- let(:raw) { entry.raw }
17
- let(:subclassed_entry) { subclass.new(raw, create_client.configuration) }
18
-
19
- describe 'SystemProperties' do
20
- it 'has a #sys getter returning a hash with symbol keys' do
21
- expect(entry.sys).to be_a Hash
22
- expect(entry.sys.keys.sample).to be_a Symbol
23
- end
24
-
25
- it 'has #id' do
26
- expect(entry.id).to eq 'nyancat'
27
- end
28
-
29
- it 'has #type' do
30
- expect(entry.type).to eq 'Entry'
31
- end
32
-
33
- it 'has #space' do
34
- expect(entry.space).to be_a Contentful::Link
35
- end
36
-
37
- it 'has #content_type' do
38
- expect(entry.content_type).to be_a Contentful::Link
39
- end
40
-
41
- it 'has #created_at' do
42
- expect(entry.created_at).to be_a DateTime
43
- end
44
-
45
- it 'has #updated_at' do
46
- expect(entry.updated_at).to be_a DateTime
47
- end
48
-
49
- it 'has #revision' do
50
- expect(entry.revision).to eq 5
51
- end
52
-
53
- context 'when subclassed' do
54
- it 'does not redefine existing methods' do
55
- expect(subclassed_entry.created_at).to eq 'yesterday'
56
- end
57
- end
58
- end
59
-
60
- describe 'Fields' do
61
- it 'has a #fields getter returning a hash with symbol keys' do
62
- expect(entry.sys).to be_a Hash
63
- expect(entry.sys.keys.sample).to be_a Symbol
64
- end
65
-
66
- it "contains the entry's fields" do
67
- expect(entry.fields[:color]).to eq 'rainbow'
68
- expect(entry.fields[:best_friend]).to be_a Contentful::Entry
69
- end
70
-
71
- context 'when subclassed' do
72
- it 'does not redefine existing methods' do
73
- expect(subclassed_entry.best_friend).to eq 'octocat'
74
- end
75
- end
76
- end
77
-
78
- describe 'multiple locales' do
79
- it 'can handle multiple locales' do
80
- vcr('entry_locales') {
81
- nyancat = create_client.entries(locale: "*", 'sys.id' => 'nyancat').items.first
82
- expect(nyancat.fields('en-US')[:name]).to eq "Nyan Cat"
83
- expect(nyancat.fields('tlh')[:name]).to eq "Nyan vIghro'"
84
-
85
-
86
- expect(nyancat.fields(:'en-US')[:name]).to eq "Nyan Cat"
87
- expect(nyancat.fields(:tlh)[:name]).to eq "Nyan vIghro'"
88
- }
89
- end
90
-
91
- describe '#fields_with_locales' do
92
- it 'can handle entries with just 1 locale' do
93
- vcr('entry') {
94
- nyancat = create_client.entry('nyancat')
95
- expect(nyancat.fields_with_locales[:name].size).to eq(1)
96
- expect(nyancat.fields_with_locales[:name][:'en-US']).to eq("Nyan Cat")
97
- }
98
- end
99
-
100
- it 'can handle entries with multiple locales' do
101
- vcr('entry_locales') {
102
- nyancat = create_client.entries(locale: "*", 'sys.id' => 'nyancat').items.first
103
- expect(nyancat.fields_with_locales[:name].size).to eq(2)
104
- expect(nyancat.fields_with_locales[:name][:'en-US']).to eq("Nyan Cat")
105
- expect(nyancat.fields_with_locales[:name][:tlh]).to eq("Nyan vIghro'")
106
- }
107
- end
108
-
109
- it 'can have references in multiple locales and they are properly solved' do
110
- vcr('multi_locale_reference') {
111
- client = create_client(
112
- space: '1sjfpsn7l90g',
113
- access_token: 'e451a3cdfced9000220be41ed9c899866e8d52aa430eaf7c35b09df8fc6326f9',
114
- dynamic_entries: :auto
115
- )
116
-
117
- entry = client.entries(locale: '*').first
118
-
119
- expect(entry.image).to be_a ::Contentful::Asset
120
- expect(entry.fields('zh')[:image]).to be_a ::Contentful::Asset
121
- expect(entry.fields('es')[:image]).to be_a ::Contentful::Asset
122
-
123
- expect(entry.image.id).not_to eq entry.fields('zh')[:image].id
124
- }
125
- end
126
-
127
- it 'can have references with arrays in multiple locales and have them properly solved' do
128
- vcr('multi_locale_array_reference') {
129
- client = create_client(
130
- space: 'cma9f9g4dxvs',
131
- access_token: '3e4560614990c9ac47343b9eea762bdaaebd845766f619660d7230787fd545e1',
132
- dynamic_entries: :auto
133
- )
134
-
135
- entry = client.entries(content_type: 'test', locale: '*').first
136
-
137
- expect(entry.files).to be_a ::Array
138
- expect(entry.references).to be_a ::Array
139
- expect(entry.files.first).to be_a ::Contentful::Asset
140
- expect(entry.references.first.entry?).to be_truthy
141
-
142
- expect(entry.fields('zh')[:files]).to be_a ::Array
143
- expect(entry.fields('zh')[:references]).to be_a ::Array
144
- expect(entry.fields('zh')[:files].first).to be_a ::Contentful::Asset
145
- expect(entry.fields('zh')[:references].first.entry?).to be_truthy
146
-
147
- expect(entry.files.first.id).not_to eq entry.fields('zh')[:files].first.id
148
- }
149
- end
150
- end
151
- end
152
-
153
- it '#raw' do
154
- vcr('entry/raw') {
155
- nyancat = create_client.entry('nyancat')
156
- expect(nyancat.raw).to eq(create_client(raw_mode: true).entry('nyancat').object['items'].first)
157
- }
158
- end
159
-
160
- describe 'can be marshalled' do
161
- def test_dump(nyancat)
162
- dump = Marshal.dump(nyancat)
163
- yield if block_given?
164
- new_cat = Marshal.load(dump)
165
-
166
- # Attributes
167
- expect(new_cat).to be_a Contentful::Entry
168
- expect(new_cat.name).to eq "Nyan Cat"
169
- expect(new_cat.lives).to eq 1337
170
-
171
- # Single linked objects
172
- expect(new_cat.best_friend).to be_a Contentful::Entry
173
- expect(new_cat.best_friend.name).to eq "Happy Cat"
174
-
175
- # Array of linked objects
176
- expect(new_cat.cat_pack.count).to eq 2
177
- expect(new_cat.cat_pack[0].name).to eq "Happy Cat"
178
- expect(new_cat.cat_pack[1].name).to eq "Worried Cat"
179
-
180
- # Nested Links
181
- expect(new_cat.best_friend.best_friend).to be_a Contentful::Entry
182
- expect(new_cat.best_friend.best_friend.name).to eq "Nyan Cat"
183
-
184
- # Asset
185
- expect(new_cat.image.file.url).to eq "//images.contentful.com/cfexampleapi/4gp6taAwW4CmSgumq2ekUm/9da0cd1936871b8d72343e895a00d611/Nyan_cat_250px_frame.png"
186
- end
187
-
188
- it 'marshals properly when entry_mapping changed' do
189
- vcr('entry/marshall') {
190
- class TestEntryMapping; end
191
- nyancat = create_client(gzip_encoded: false, max_include_resolution_depth: 2, entry_mapping: { 'irrelevant_model' => TestEntryMapping }).entries(include: 2, 'sys.id' => 'nyancat').first
192
- test_dump(nyancat) { Object.send(:remove_const, :TestEntryMapping) }
193
- }
194
- end
195
-
196
- it 'marshals properly' do
197
- vcr('entry/marshall') {
198
- nyancat = create_client(gzip_encoded: false, max_include_resolution_depth: 2).entries(include: 2, 'sys.id' => 'nyancat').first
199
- test_dump(nyancat)
200
- }
201
- end
202
-
203
- it 'marshals with a logger set but keeps the instance' do
204
- logger = Logger.new(IO::NULL)
205
- vcr('entry/marshall') {
206
- nyancat = create_client(gzip_encoded: false, max_include_resolution_depth: 2, logger: logger).entries(include: 2, 'sys.id' => 'nyancat').first
207
- expect(nyancat.instance_variable_get(:@configuration)[:logger]).to eq(logger)
208
- test_dump(nyancat)
209
- expect(nyancat.instance_variable_get(:@configuration)[:logger]).to eq(logger)
210
- }
211
- end
212
-
213
- it 'can remarshall an unmarshalled object' do
214
- vcr('entry/marshall') {
215
- nyancat = create_client(max_include_resolution_depth: 2).entries(include: 2, 'sys.id' => 'nyancat').first
216
-
217
- # The double load/dump is on purpose
218
- test_dump(Marshal.load(Marshal.dump(nyancat)))
219
- }
220
- end
221
-
222
- it 'can properly marshal multiple level nested resources - #138' do
223
- vcr('entry/marshal_138') {
224
- parent = create_client(
225
- space: 'j8tb59fszch7',
226
- access_token: '5f711401f965951eb724ac72ac905e13d892294ba209268f13a9b32e896c8694',
227
- dynamic_entries: :auto,
228
- max_include_resolution_depth: 5
229
- ).entry('5aV3O0l5jU0cwQ2OkyYsyU')
230
-
231
- rehydrated = Marshal.load(Marshal.dump(parent))
232
-
233
- expect(rehydrated.childs.first.image1.url).to eq '//images.contentful.com/j8tb59fszch7/7FjliblAmAoGMwU62MeQ6k/62509df90ef4bed38c0701bb9aa8c74c/Funny-Cat-Pictures-with-Captions-25.jpg'
234
- expect(rehydrated.childs.first.image2.url).to eq '//images.contentful.com/j8tb59fszch7/1pbGuWZ27O6GMO0OGemgcA/a4185036a3640ad4491f38d8926003ab/Funny-Cat-Pictures-with-Captions-1.jpg'
235
- expect(rehydrated.childs.last.image1.url).to eq '//images.contentful.com/j8tb59fszch7/4SXVTr0KEUyWiMMCOaUeUU/c9fa2246d5529a9c8e1ec6f5387dc4f6/e0194eca1c8135636ce0e014341548c3.jpg'
236
- expect(rehydrated.childs.last.image2.url).to eq '//images.contentful.com/j8tb59fszch7/1NU1YcNQJGIA22gAKmKqWo/56fa672bb17a7b7ae2773d08e101d059/57ee64921c25faa649fc79288197c313.jpg'
237
- }
238
- end
239
-
240
- it 'filters out unpublished resources after rehydration' do
241
- vcr('entry/marshal_unpublished') {
242
- parent = create_client(
243
- space: 'z3eix6mwjid2',
244
- access_token: '9047c4394a2130dff8e9dc544a7a3ec299703fdac8e52575eb5a6678be06c468',
245
- dynamic_entries: :auto
246
- ).entry('5Etc0jWzIWwMeSu4W0SCi8')
247
-
248
- rehydrated = Marshal.load(Marshal.dump(parent))
249
-
250
- expect(rehydrated.children).to be_empty
251
-
252
- preview_parent = create_client(
253
- space: 'z3eix6mwjid2',
254
- access_token: '38153b942011a70b5482fda61c6a3a9d22f5e8a512662dac00fcf7eb344b75f4',
255
- dynamic_entries: :auto,
256
- api_url: 'preview.contentful.com'
257
- ).entry('5Etc0jWzIWwMeSu4W0SCi8')
258
-
259
- preview_rehydrated = Marshal.load(Marshal.dump(preview_parent))
260
-
261
- expect(preview_rehydrated.children).not_to be_empty
262
- expect(preview_rehydrated.children.first.title).to eq 'Child'
263
- }
264
- end
265
- end
266
-
267
- describe 'incoming links' do
268
- let(:client) { create_client }
269
-
270
- it 'will fetch entries referencing the entry using a query' do
271
- vcr('entry/search_link_to_entry') {
272
- entries = client.entries(links_to_entry: 'nyancat')
273
- expect(entries).not_to be_empty
274
- expect(entries.count).to eq 1
275
- expect(entries.first.id).to eq 'happycat'
276
- }
277
- end
278
-
279
- it 'will fetch entries referencing the entry using instance method' do
280
- vcr('entry/search_link_to_entry') {
281
- entries = entry.incoming_references client
282
- expect(entries).not_to be_empty
283
- expect(entries.count).to eq 1
284
- expect(entries.first.id).to eq 'happycat'
285
- }
286
- end
287
-
288
- it 'will fetch entries referencing the entry using instance method + query' do
289
- vcr('entry/search_link_to_entry_with_custom_query') {
290
- entries = entry.incoming_references(client, { content_type: 'cat', select: ['fields.name'] })
291
- expect(entries).not_to be_empty
292
- expect(entries.count).to eq 1
293
- expect(entries.first.id).to eq 'happycat'
294
- expect(entries.first.fields.keys).to eq([:name])
295
- }
296
- end
297
-
298
- end
299
-
300
- describe 'select operator' do
301
- let(:client) { create_client }
302
-
303
- context 'with sys sent' do
304
- it 'properly creates an entry' do
305
- vcr('entry/select_only_sys') {
306
- entry = client.entries(select: ['sys'], 'sys.id' => 'nyancat').first
307
- expect(entry.fields).to be_empty
308
- expect(entry.entry?).to be_truthy
309
- }
310
- end
311
-
312
- describe 'can contain only one field' do
313
- context 'with content_type sent' do
314
- it 'will properly create the entry with one field' do
315
- vcr('entry/select_one_field_proper') {
316
- entry = client.entries(content_type: 'cat', select: ['sys', 'fields.name'], 'sys.id' => 'nyancat').first
317
- expect(entry.fields).not_to be_empty
318
- expect(entry.entry?).to be_truthy
319
- expect(entry.fields[:name]).to eq 'Nyan Cat'
320
- expect(entry.fields).to eq({name: 'Nyan Cat'})
321
- }
322
- end
323
- end
324
-
325
- context 'without content_type sent' do
326
- it 'will raise an error' do
327
- vcr('entry/select_one_field') {
328
- expect { client.entries(select: ['sys', 'fields.name'], 'sys.id' => 'nyancat') }.to raise_error Contentful::BadRequest
329
- }
330
- end
331
- end
332
- end
333
- end
334
-
335
- context 'without sys sent' do
336
- it 'will enforce sys anyway' do
337
- vcr('entry/select_no_sys') {
338
- entry = client.entries(select: ['fields'], 'sys.id' => 'nyancat').first
339
-
340
- expect(entry.id).to eq 'nyancat'
341
- expect(entry.sys).not_to be_empty
342
- }
343
- end
344
-
345
- it 'works with empty array as well, as sys is enforced' do
346
- vcr('entry/select_empty_array') {
347
- entry = client.entries(select: [], 'sys.id' => 'nyancat').first
348
-
349
- expect(entry.id).to eq 'nyancat'
350
- expect(entry.sys).not_to be_empty
351
- }
352
- end
353
- end
354
- end
355
-
356
- describe 'reuse objects' do
357
- it 'should handle recursion as well as not reusing' do
358
- vcr('entry/include_resolution') {
359
- entry = create_client(reuse_objects: true).entry('nyancat', include: 2)
360
-
361
- expect(entry.best_friend.name).to eq 'Happy Cat'
362
- expect(entry
363
- .best_friend.best_friend
364
- .best_friend.best_friend
365
- .best_friend.best_friend
366
- .best_friend.best_friend
367
- .best_friend.best_friend
368
- .best_friend.best_friend
369
- .best_friend.best_friend
370
- .best_friend.best_friend
371
- .best_friend.best_friend
372
- .best_friend.best_friend.name).to eq 'Nyan Cat'
373
- }
374
- end
375
- it 'should use the same object for the same entry' do
376
- vcr('entry/include_resolution') {
377
- entry = create_client(reuse_entries: true).entry('nyancat', include: 2)
378
-
379
- expect(entry.best_friend.name).to eq 'Happy Cat'
380
- expect(entry.best_friend.best_friend).to be(entry)
381
- }
382
- end
383
- it 'works on nested structures with unique objects' do
384
- vcr('entry/include_resolution_uniques') {
385
- entry = create_client(
386
- space: 'v7cxgyxt0w5x',
387
- access_token: '96e5d256e9a5349ce30e84356597e409f8f1bb485cb4719285b555e0f78aa27e',
388
- reuse_entries: true
389
- ).entry('1nLXjjWvk4MEeWeQCWmymc', include: 10)
390
-
391
- expect(entry.title).to eq '1'
392
- expect(entry
393
- .child.child
394
- .child.child
395
- .child.child
396
- .child.child
397
- .child.title).to eq '10'
398
- expect(entry
399
- .child.child
400
- .child.child
401
- .child.child
402
- .child.child
403
- .child.child.title).to eq '1'
404
- expect(entry
405
- .child.child.child.child
406
- .child.child.child.child
407
- .child.child.child.child
408
- .child.child.child.child
409
- .child.child.child.child.title).to eq '1'
410
- }
411
- end
412
- end
413
-
414
- describe 'include resolution' do
415
- it 'should not reuse objects by default' do
416
- vcr('entry/include_resolution') {
417
- entry = create_client.entry('nyancat', include: 2)
418
-
419
- expect(entry.best_friend.name).to eq 'Happy Cat'
420
- expect(entry.best_friend.best_friend).not_to be(entry)
421
- }
422
- end
423
- it 'defaults to 20 depth' do
424
- vcr('entry/include_resolution') {
425
- entry = create_client.entry('nyancat', include: 2)
426
-
427
- expect(entry.best_friend.name).to eq 'Happy Cat'
428
- expect(entry
429
- .best_friend.best_friend
430
- .best_friend.best_friend
431
- .best_friend.best_friend
432
- .best_friend.best_friend
433
- .best_friend.best_friend
434
- .best_friend.best_friend
435
- .best_friend.best_friend
436
- .best_friend.best_friend
437
- .best_friend.best_friend
438
- .best_friend.best_friend.name).to eq 'Nyan Cat'
439
-
440
- expect(entry
441
- .best_friend.best_friend
442
- .best_friend.best_friend
443
- .best_friend.best_friend
444
- .best_friend.best_friend
445
- .best_friend.best_friend
446
- .best_friend.best_friend
447
- .best_friend.best_friend
448
- .best_friend.best_friend
449
- .best_friend.best_friend
450
- .best_friend.best_friend
451
- .best_friend).to be_a ::Contentful::Link
452
- }
453
- end
454
-
455
- it 'can be configured arbitrarily' do
456
- vcr('entry/include_resolution') {
457
- entry = create_client(max_include_resolution_depth: 3).entry('nyancat', include: 2)
458
-
459
- expect(entry.best_friend.name).to eq 'Happy Cat'
460
- expect(entry
461
- .best_friend.best_friend
462
- .best_friend.name).to eq 'Happy Cat'
463
- expect(entry
464
- .best_friend.best_friend
465
- .best_friend.best_friend).to be_a ::Contentful::Link
466
- }
467
- end
468
- it 'works on nested structures with unique objects' do
469
- vcr('entry/include_resolution_uniques') {
470
- entry = create_client(
471
- space: 'v7cxgyxt0w5x',
472
- access_token: '96e5d256e9a5349ce30e84356597e409f8f1bb485cb4719285b555e0f78aa27e',
473
- ).entry('1nLXjjWvk4MEeWeQCWmymc', include: 10)
474
-
475
- expect(entry.title).to eq '1'
476
- expect(entry
477
- .child.child
478
- .child.child
479
- .child.child
480
- .child.child
481
- .child.title).to eq '10'
482
- expect(entry
483
- .child.child
484
- .child.child
485
- .child.child
486
- .child.child
487
- .child.child.title).to eq '1'
488
- expect(entry
489
- .child.child.child.child
490
- .child.child.child.child
491
- .child.child.child.child
492
- .child.child.child.child
493
- .child.child.child.child.title).to eq '1'
494
- }
495
- end
496
- end
497
-
498
- describe 'issues' do
499
- it 'filters out unresolvable assets' do
500
- vcr('entries/unresolvable_assets') {
501
- client = create_client(space: 'facgnwwgj5fe', access_token: '4d0f55d940975f78139daae5d965b463c0816e88ad16062d2c1ee3d6cb930521')
502
- entry = client.entry('gLVzQlb09IeOeU181fwtz')
503
-
504
- expect(entry.single_asset).to be_nil
505
- expect(entry.multi_asset.size).to eq 1
506
- expect(entry.raw["fields"]["multiAsset"].size).to eq 2
507
- }
508
- end
509
-
510
- it 'Symbol/Text field with null values should be serialized as nil - #117' do
511
- vcr('entries/issue_117') {
512
- client = create_client(space: '8jbbayggj9gj', access_token: '4ce0108f04e55c76476ba84ab0e6149734db73d67cd1b429323ef67f00977e07')
513
- entry = client.entries.first
514
-
515
- expect(entry.nil).to be_nil
516
- expect(entry.nil).not_to eq ''
517
- }
518
- end
519
-
520
- describe 'JSON Fields should not be treated as locale data - #96' do
521
- before do
522
- vcr('entry/json_objects_client') {
523
- @client = create_client(
524
- space: 'h425t6gef30p',
525
- access_token: '278f7aa72f2eb90c0e002d60f85bf2144c925acd2d37dd990d3ca274f25076cf',
526
- dynamic_entries: :auto
527
- )
528
-
529
- }
530
- vcr('entry/json_objects') {
531
- @entry = @client.entries.first
532
- }
533
- end
534
-
535
- it 'only has default locale' do
536
- expect(@entry.locales).to eq ['en-US']
537
- end
538
-
539
- it 'can obtain all values properly' do
540
- expect(@entry.name).to eq('Test')
541
- expect(@entry.object_test).to eq({
542
- null: nil,
543
- text: 'some text',
544
- array: [1, 2, 3],
545
- number: 123,
546
- boolean: true,
547
- object: {
548
- null: nil,
549
- text: 'bar',
550
- array: [1, 2, 3],
551
- number: 123,
552
- boolean: false,
553
- object: {foo: 'bar'}
554
- }
555
- })
556
- end
557
- end
558
-
559
- it 'Number (Integer and Decimal) values get properly serialized - #125' do
560
- vcr('entries/issue_125') {
561
- client = create_client(space: 'zui87wsu8q80', access_token: '64ff902c58cd14ea063d3ded810d1111a0266537e9aba283bad3319b1762c302', dynamic_entries: :auto)
562
- entry = client.entries.first
563
-
564
- expect(entry.integer).to eq 123
565
- expect(entry.decimal).to eq 12.3
566
- }
567
- end
568
-
569
- it 'unresolvable entries get filtered from results' do
570
- vcr('entries/unresolvable_filter') {
571
- client = create_client(space: '011npgaszg5o', access_token: '42c9d93410a7319e9a735671fc1e415348f65e94a99fc768b70a7c649859d4fd', dynamic_entries: :auto)
572
- entry = client.entry('1HR1QvURo4MoSqO0eqmUeO')
573
-
574
- expect(entry.modules.size).to eq 2
575
- }
576
- end
577
-
578
- it 'unresolvable entries get filtered from results in deeply nested objects - #177' do
579
- vcr('entries/unresolvable_filter_deeply_nested') {
580
- client = create_client(space: 'z471hdso7l1a', access_token: '8a0e09fe71f1cb41e8788ace86a8c8d9d084599fe43a40070f232045014d2585', dynamic_entries: :auto)
581
- entry = client.entry('1hb8sipClkQ8ggeGaeSQWm', include: 3)
582
- expect(entry.should_published.first.should_unpublished.size).to eq 0
583
- }
584
- end
585
- end
586
-
587
- describe 'camel case' do
588
- it 'supports camel case' do
589
- vcr('entry') {
590
- entry = create_client(use_camel_case: true).entry 'nyancat'
591
-
592
- expect(entry.bestFriend.name).to eq 'Happy Cat'
593
- expect(entry.createdAt).to be_a DateTime
594
- }
595
- end
596
- end
597
-
598
- describe 'empty fields' do
599
- context 'when default configuration' do
600
- it 'raises an exception by default' do
601
- vcr('entries/empty_fields') {
602
- entry = create_client(
603
- space: 'z4ssexir3p93',
604
- access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
605
- dynamic_entries: :auto
606
- ).entry('2t1x77MgUA4SM2gMiaUcsy')
607
-
608
- expect { entry.title }.to raise_error Contentful::EmptyFieldError
609
- }
610
- end
611
-
612
- it 'returns nil if raise_for_empty_fields is false' do
613
- vcr('entries/empty_fields') {
614
- entry = create_client(
615
- space: 'z4ssexir3p93',
616
- access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
617
- dynamic_entries: :auto,
618
- raise_for_empty_fields: false
619
- ).entry('2t1x77MgUA4SM2gMiaUcsy')
620
-
621
- expect(entry.title).to be_nil
622
- }
623
- end
624
-
625
- it 'will properly raise NoMethodError for non-fields' do
626
- vcr('entries/empty_fields') {
627
- entry = create_client(
628
- space: 'z4ssexir3p93',
629
- access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
630
- dynamic_entries: :auto
631
- ).entry('2t1x77MgUA4SM2gMiaUcsy')
632
-
633
- expect { entry.unexisting_field }.to raise_error NoMethodError
634
- }
635
- end
636
- end
637
-
638
- context 'when use_camel_case is true it should still work' do
639
- it 'raises an exception by default' do
640
- vcr('entries/empty_fields') {
641
- entry = create_client(
642
- space: 'z4ssexir3p93',
643
- access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
644
- dynamic_entries: :auto,
645
- use_camel_case: true
646
- ).entry('2t1x77MgUA4SM2gMiaUcsy')
647
-
648
- expect { entry.title }.to raise_error Contentful::EmptyFieldError
649
- }
650
- end
651
-
652
- it 'returns nil if raise_for_empty_fields is false' do
653
- vcr('entries/empty_fields') {
654
- entry = create_client(
655
- space: 'z4ssexir3p93',
656
- access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
657
- dynamic_entries: :auto,
658
- raise_for_empty_fields: false,
659
- use_camel_case: true
660
- ).entry('2t1x77MgUA4SM2gMiaUcsy')
661
-
662
- expect(entry.title).to be_nil
663
- }
664
- end
665
-
666
- it 'will properly raise NoMethodError for non-fields' do
667
- vcr('entries/empty_fields') {
668
- entry = create_client(
669
- space: 'z4ssexir3p93',
670
- access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
671
- dynamic_entries: :auto,
672
- use_camel_case: true
673
- ).entry('2t1x77MgUA4SM2gMiaUcsy')
674
-
675
- expect { entry.unexisting_field }.to raise_error NoMethodError
676
- }
677
- end
678
- end
679
- end
680
-
681
- describe 'rich text support' do
682
- it 'properly serializes and resolves includes' do
683
- vcr('entries/rich_text') {
684
- entry = create_client(
685
- space: 'jd7yc4wnatx3',
686
- access_token: '6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248',
687
- raise_errors: true,
688
- dynamic_entries: :auto,
689
- gzip_encoded: false
690
- ).entry('4BupPSmi4M02m0U48AQCSM')
691
-
692
- expected_entry_occurrances = 2
693
- embedded_entry_index = 1
694
- entry.body['content'].each do |content|
695
- if content['nodeType'] == 'embedded-entry-block'
696
- expect(content['data']['target']).to be_a Contentful::Entry
697
- expect(content['data']['target'].body).to eq "Embedded #{embedded_entry_index}"
698
- expected_entry_occurrances -= 1
699
- embedded_entry_index += 1
700
- end
701
- end
702
-
703
- expect(expected_entry_occurrances).to eq 0
704
- }
705
- end
706
-
707
- it 'doesnt hydrate the same entry twice - #194' do
708
- vcr('entries/rich_text_hydration_issue') {
709
- entry = nil
710
-
711
- expect {
712
- entry = create_client(
713
- space: 'fds721b88p6b',
714
- access_token: '45ba81cc69423fcd2e3f0a4779de29481bb5c11495bc7e14649a996cf984e98e',
715
- raise_errors: true,
716
- dynamic_entries: :auto,
717
- gzip_encoded: false
718
- ).entry('1tBAu0wP9qAQEg6qCqMics')
719
- }.not_to raise_error
720
-
721
- expect(entry.children[0].id).to eq entry.children[1].id
722
- expect(entry.children[0].body).to eq entry.children[1].body
723
- }
724
- end
725
-
726
- it 'respects content in data attribute if its not a Link' do
727
- vcr('entries/rich_text_nested_fields') {
728
- entry = create_client(
729
- space: 'jd7yc4wnatx3',
730
- access_token: '6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248',
731
- raise_errors: true,
732
- dynamic_entries: :auto,
733
- gzip_encoded: false
734
- ).entry('6NGLswCREsGA28kGouScyY')
735
-
736
- expect(entry.body['content'][0]).to eq({
737
- 'data' => {},
738
- 'content' => [
739
- {'marks' => [], 'value' => 'A link to ', 'nodeType' => 'text', 'nodeClass' => 'text'},
740
- {
741
- 'data' => {'uri' => 'https://google.com'},
742
- 'content' => [{'marks' => [], 'value' => 'google', 'nodeType' => 'text', 'nodeClass' => 'text'}],
743
- 'nodeType' => 'hyperlink',
744
- 'nodeClass' => 'inline'
745
- },
746
- {'marks' => [], 'value' => '', 'nodeType' => 'text', 'nodeClass' => 'text'}
747
- ],
748
- 'nodeType' => 'paragraph',
749
- 'nodeClass' => 'block'
750
- })
751
- }
752
- end
753
-
754
- it 'supports includes in nested fields' do
755
- vcr('entries/rich_text_nested_fields') {
756
- entry = create_client(
757
- space: 'jd7yc4wnatx3',
758
- access_token: '6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248',
759
- raise_errors: true,
760
- dynamic_entries: :auto,
761
- gzip_encoded: false
762
- ).entry('6NGLswCREsGA28kGouScyY')
763
-
764
- expect(entry.body['content'][3]['nodeType']).to eq('unordered-list')
765
- expect(entry.body['content'][3]['content'][2]['content'][0]['data']['target'].is_a?(Contentful::Entry)).to be_truthy
766
-
767
- expect(entry.body['content'][4]['nodeType']).to eq('ordered-list')
768
- expect(entry.body['content'][4]['content'][2]['content'][0]['data']['target'].is_a?(Contentful::Entry)).to be_truthy
769
- }
770
- end
771
-
772
- it 'returns a link when resource is valid but unreachable' do
773
- vcr('entries/rich_text_unresolved_relationships') {
774
- parent = create_client(
775
- space: 'jd7yc4wnatx3',
776
- access_token: '6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248',
777
- raise_errors: true,
778
- dynamic_entries: :auto,
779
- gzip_encoded: false
780
- ).entry('4fvSwl5Ob6UEWKg6MQicuC')
781
-
782
- entry = parent.rich_text_child
783
- expect(entry.body['content'][19]['data']['target'].is_a?(Contentful::Link)).to be_truthy
784
- }
785
- end
786
- end
787
- end