contentful-management 0.9.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.rubocop_todo.yml +2 -2
  4. data/CHANGELOG.md +27 -3
  5. data/README.md +34 -7
  6. data/lib/contentful/management/api_key.rb +4 -43
  7. data/lib/contentful/management/array.rb +1 -2
  8. data/lib/contentful/management/asset.rb +29 -191
  9. data/lib/contentful/management/client.rb +96 -7
  10. data/lib/contentful/management/client_api_key_methods_factory.rb +15 -0
  11. data/lib/contentful/management/client_asset_methods_factory.rb +13 -0
  12. data/lib/contentful/management/client_association_all_published_method_factory.rb +21 -0
  13. data/lib/contentful/management/client_association_methods_factory.rb +54 -0
  14. data/lib/contentful/management/client_content_type_methods_factory.rb +13 -0
  15. data/lib/contentful/management/client_entry_methods_factory.rb +21 -0
  16. data/lib/contentful/management/client_locale_methods_factory.rb +15 -0
  17. data/lib/contentful/management/client_space_methods_factory.rb +58 -0
  18. data/lib/contentful/management/client_webhook_methods_factory.rb +15 -0
  19. data/lib/contentful/management/content_type.rb +30 -151
  20. data/lib/contentful/management/content_type_entry_methods_factory.rb +9 -3
  21. data/lib/contentful/management/dynamic_entry.rb +20 -39
  22. data/lib/contentful/management/entry.rb +47 -182
  23. data/lib/contentful/management/http_client.rb +41 -8
  24. data/lib/contentful/management/locale.rb +7 -76
  25. data/lib/contentful/management/request.rb +3 -3
  26. data/lib/contentful/management/resource.rb +105 -7
  27. data/lib/contentful/management/resource/all_published.rb +24 -0
  28. data/lib/contentful/management/resource/archiver.rb +37 -0
  29. data/lib/contentful/management/resource/field_aware.rb +49 -29
  30. data/lib/contentful/management/resource/publisher.rb +37 -0
  31. data/lib/contentful/management/resource/refresher.rb +1 -1
  32. data/lib/contentful/management/resource_builder.rb +8 -4
  33. data/lib/contentful/management/resource_requester.rb +96 -0
  34. data/lib/contentful/management/space.rb +40 -43
  35. data/lib/contentful/management/space_association_all_published_method_factory.rb +1 -1
  36. data/lib/contentful/management/space_association_methods_factory.rb +6 -3
  37. data/lib/contentful/management/space_entry_methods_factory.rb +1 -1
  38. data/lib/contentful/management/version.rb +1 -1
  39. data/lib/contentful/management/webhook.rb +9 -82
  40. data/spec/fixtures/vcr_cassettes/asset/create.yml +1 -1
  41. data/spec/fixtures/vcr_cassettes/asset/create_with_locale.yml +1 -1
  42. data/spec/fixtures/vcr_cassettes/asset/process.yml +1 -1
  43. data/spec/fixtures/vcr_cassettes/asset/publish_after_create.yml +1 -1
  44. data/spec/fixtures/vcr_cassettes/content_type/create.yml +1 -1
  45. data/spec/fixtures/vcr_cassettes/content_type/create_with_Array_field.yml +1 -1
  46. data/spec/fixtures/vcr_cassettes/content_type/create_with_Boolean_field.yml +1 -1
  47. data/spec/fixtures/vcr_cassettes/content_type/create_with_Date_field.yml +1 -1
  48. data/spec/fixtures/vcr_cassettes/content_type/create_with_Integer_field.yml +1 -1
  49. data/spec/fixtures/vcr_cassettes/content_type/create_with_Link_field.yml +1 -1
  50. data/spec/fixtures/vcr_cassettes/content_type/create_with_Location_field.yml +1 -1
  51. data/spec/fixtures/vcr_cassettes/content_type/create_with_Number_field.yml +1 -1
  52. data/spec/fixtures/vcr_cassettes/content_type/create_with_Object_field.yml +1 -1
  53. data/spec/fixtures/vcr_cassettes/content_type/create_with_Symbol_field.yml +1 -1
  54. data/spec/fixtures/vcr_cassettes/content_type/create_with_Text_field.yml +1 -1
  55. data/spec/fixtures/vcr_cassettes/content_type/entry/create.yml +1 -1
  56. data/spec/fixtures/vcr_cassettes/content_type/entry/create_only_with_localized_fields.yml +1 -1
  57. data/spec/fixtures/vcr_cassettes/content_type/entry/create_to_single_locale_only_with_localized_fields.yml +1 -1
  58. data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_camel_case_id_to_multiple_locales.yml +1 -1
  59. data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_entries.yml +1 -1
  60. data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_entries_for_multiple_locales.yml +1 -1
  61. data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_multiple_locales.yml +1 -1
  62. data/spec/fixtures/vcr_cassettes/content_type/fields/create_array_types.yml +1 -1
  63. data/spec/fixtures/vcr_cassettes/content_type/save_new.yml +1 -1
  64. data/spec/fixtures/vcr_cassettes/delete_request.yml +38 -0
  65. data/spec/fixtures/vcr_cassettes/entry/create.yml +1 -1
  66. data/spec/fixtures/vcr_cassettes/entry/create_with_asset.yml +1 -1
  67. data/spec/fixtures/vcr_cassettes/entry/create_with_assets.yml +1 -1
  68. data/spec/fixtures/vcr_cassettes/entry/create_with_entries.yml +1 -1
  69. data/spec/fixtures/vcr_cassettes/entry/create_with_entry.yml +1 -1
  70. data/spec/fixtures/vcr_cassettes/entry/create_with_just_id.yml +1 -1
  71. data/spec/fixtures/vcr_cassettes/entry/create_with_location.yml +1 -1
  72. data/spec/fixtures/vcr_cassettes/entry/create_with_specified_locale.yml +1 -1
  73. data/spec/fixtures/vcr_cassettes/entry/create_with_symbols.yml +1 -1
  74. data/spec/fixtures/vcr_cassettes/entry/too_many_requests.yml +1 -1
  75. data/spec/fixtures/vcr_cassettes/entry/update_bool_field.yml +1 -1
  76. data/spec/fixtures/vcr_cassettes/post_request.yml +64 -0
  77. data/spec/fixtures/vcr_cassettes/proxy_request.yml +562 -0
  78. data/spec/fixtures/vcr_cassettes/put_request.yml +40 -0
  79. data/spec/fixtures/vcr_cassettes/space/asset/create.yml +1 -1
  80. data/spec/fixtures/vcr_cassettes/space/asset/create_with_multiple_locales.yml +1 -1
  81. data/spec/fixtures/vcr_cassettes/space/content_type/create.yml +1 -1
  82. data/spec/fixtures/vcr_cassettes/space/create_with_client_default_locale.yml +197 -36
  83. data/spec/fixtures/vcr_cassettes/space/webhook/create.yml +1 -1
  84. data/spec/lib/contentful/management/api_key_spec.rb +7 -1
  85. data/spec/lib/contentful/management/array_spec.rb +1 -1
  86. data/spec/lib/contentful/management/asset_spec.rb +52 -32
  87. data/spec/lib/contentful/management/client_spec.rb +38 -0
  88. data/spec/lib/contentful/management/content_type_spec.rb +37 -22
  89. data/spec/lib/contentful/management/entry_spec.rb +68 -57
  90. data/spec/lib/contentful/management/locale_spec.rb +7 -1
  91. data/spec/lib/contentful/management/space_spec.rb +9 -3
  92. data/spec/lib/contentful/management/webhook_spec.rb +11 -5
  93. metadata +23 -2
@@ -6,7 +6,7 @@ describe Contentful::Management::Array do
6
6
  let(:token) { '<ACCESS_TOKEN>' }
7
7
  let(:space_id) { 'yr5m0jky5hsh' }
8
8
  let!(:client) { Contentful::Management::Client.new(token) }
9
- let(:array) { vcr('space/all') { Contentful::Management::Space.all } }
9
+ let(:array) { vcr('space/all') { client.spaces.all } }
10
10
 
11
11
  describe 'SystemProperties' do
12
12
  it 'has a #sys getter returning a hash with symbol keys' do
@@ -13,9 +13,12 @@ module Contentful
13
13
 
14
14
  let!(:client) { Client.new(token) }
15
15
 
16
- subject { Contentful::Management::Asset }
16
+ subject { client.assets }
17
17
 
18
18
  describe '.all' do
19
+ it 'class method also works' do
20
+ vcr('asset/all') { expect(Contentful::Management::Asset.all(client, space_id)).to be_kind_of Contentful::Management::Array }
21
+ end
19
22
  it 'returns a Contentful::Array' do
20
23
  vcr('asset/all') { expect(subject.all(space_id)).to be_kind_of Contentful::Management::Array }
21
24
  end
@@ -24,7 +27,7 @@ module Contentful
24
27
  end
25
28
  it 'return limited number of assets with next_page' do
26
29
  vcr('asset/limited_assets_next_page') do
27
- assets = Contentful::Management::Asset.all('bfsvtul0c41g', limit: 20, skip: 2)
30
+ assets = subject.all('bfsvtul0c41g', limit: 20, skip: 2)
28
31
  expect(assets).to be_kind_of Contentful::Management::Array
29
32
  expect(assets.limit).to eq 20
30
33
  expect(assets.skip).to eq 2
@@ -35,6 +38,9 @@ module Contentful
35
38
 
36
39
  describe '.all_published' do
37
40
  let!(:space_id) { 'bjwq7b86vgmm' }
41
+ it 'class method also works' do
42
+ vcr('asset/all_public') { expect(Contentful::Management::Asset.all_published(client, space_id)).to be_kind_of Contentful::Management::Array }
43
+ end
38
44
  it 'returns a Contentful::Array' do
39
45
  vcr('asset/all_public') { expect(subject.all_published(space_id)).to be_kind_of Contentful::Management::Array }
40
46
  end
@@ -43,7 +49,10 @@ module Contentful
43
49
  end
44
50
  end
45
51
 
46
- describe '#find' do
52
+ describe '.find' do
53
+ it 'class method also works' do
54
+ vcr('asset/find') { expect(Contentful::Management::Asset.find(client, space_id, asset_id)).to be_kind_of Contentful::Management::Asset }
55
+ end
47
56
  it 'returns a Contentful::Management::Asset' do
48
57
  vcr('asset/find') { expect(subject.find(space_id, asset_id)).to be_kind_of Contentful::Management::Asset }
49
58
  end
@@ -106,10 +115,12 @@ module Contentful
106
115
  file.properties[:fileName] = 'pic1.jpg'
107
116
  file.properties[:upload] = 'https://upload.wikimedia.org/wikipedia/commons/c/c7/Gasometer_Berlin_Sch%C3%B6neberg_2011.jpg'
108
117
 
109
- asset = Contentful::Management::Asset.create(space_id,
110
- title: 'titlebyCreateAPI',
111
- description: 'descByAPI',
112
- file: file)
118
+ asset = subject.create(
119
+ space_id,
120
+ title: 'titlebyCreateAPI',
121
+ description: 'descByAPI',
122
+ file: file
123
+ )
113
124
  expect(asset).to be_kind_of Contentful::Management::Asset
114
125
  asset.publish
115
126
  expect(asset.published?).to be_truthy
@@ -241,10 +252,12 @@ module Contentful
241
252
  file.properties[:fileName] = 'pic1.jpg'
242
253
  file.properties[:upload] = 'https://upload.wikimedia.org/wikipedia/commons/c/c7/Gasometer_Berlin_Sch%C3%B6neberg_2011.jpg'
243
254
 
244
- asset = Contentful::Management::Asset.create(space_id,
245
- title: 'titlebyCreateAPI',
246
- description: 'descByAPI',
247
- file: file)
255
+ asset = subject.create(
256
+ space_id,
257
+ title: 'titlebyCreateAPI',
258
+ description: 'descByAPI',
259
+ file: file
260
+ )
248
261
  expect(asset).to be_kind_of Contentful::Management::Asset
249
262
  expect(asset.title).to eq 'titlebyCreateAPI'
250
263
  expect(asset.description).to eq 'descByAPI'
@@ -258,10 +271,13 @@ module Contentful
258
271
  file.properties[:fileName] = 'pic1.jpg'
259
272
  file.properties[:upload] = 'https://upload.wikimedia.org/wikipedia/commons/c/c7/Gasometer_Berlin_Sch%C3%B6neberg_2011.jpg'
260
273
 
261
- asset = Contentful::Management::Asset.create('bfsvtul0c41g',
262
- title: 'Title PL',
263
- description: 'Description PL',
264
- file: file, locale: 'pl-PL')
274
+ asset = subject.create(
275
+ 'bfsvtul0c41g',
276
+ title: 'Title PL',
277
+ description: 'Description PL',
278
+ file: file,
279
+ locale: 'pl-PL'
280
+ )
265
281
  expect(asset).to be_kind_of Contentful::Management::Asset
266
282
  expect(asset.title).to eq 'Title PL'
267
283
  expect(asset.description).to eq 'Description PL'
@@ -275,11 +291,13 @@ module Contentful
275
291
  file.properties[:fileName] = 'codequest.jpg'
276
292
  file.properties[:upload] = 'http://static.goldenline.pl/firm_logo/082/firm_225106_22f37f_small.jpg'
277
293
 
278
- asset = Contentful::Management::Asset.create(space_id,
279
- id: 'codequest_id_test_custom',
280
- title: 'titlebyCreateAPI_custom_id',
281
- description: 'descByAPI_custom_id',
282
- file: file)
294
+ asset = subject.create(
295
+ space_id,
296
+ id: 'codequest_id_test_custom',
297
+ title: 'titlebyCreateAPI_custom_id',
298
+ description: 'descByAPI_custom_id',
299
+ file: file
300
+ )
283
301
  expect(asset).to be_kind_of Contentful::Management::Asset
284
302
  expect(asset.id).to eq 'codequest_id_test_custom'
285
303
  expect(asset.title).to eq 'titlebyCreateAPI_custom_id'
@@ -294,11 +312,13 @@ module Contentful
294
312
  file.properties[:fileName] = 'codequest.jpg'
295
313
  file.properties[:upload] = 'http://static.goldenline.pl/firm_logo/082/firm_225106_22f37f_small.jpg'
296
314
 
297
- asset = Contentful::Management::Asset.create(space_id,
298
- id: 'codequest_id_test_custom_id',
299
- title: 'titlebyCreateAPI_custom_id',
300
- description: 'descByAPI_custom_id',
301
- file: file)
315
+ asset = subject.create(
316
+ space_id,
317
+ id: 'codequest_id_test_custom_id',
318
+ title: 'titlebyCreateAPI_custom_id',
319
+ description: 'descByAPI_custom_id',
320
+ file: file
321
+ )
302
322
  expect(asset).to be_kind_of Contentful::Management::Conflict
303
323
  end
304
324
  end
@@ -350,7 +370,7 @@ module Contentful
350
370
  describe '#save' do
351
371
  it 'updated' do
352
372
  vcr('asset/save_update') do
353
- asset = Contentful::Management::Asset.find(space_id, '35Kt2tInIsoauo8sC82q04')
373
+ asset = subject.find(space_id, '35Kt2tInIsoauo8sC82q04')
354
374
  asset.fields[:description] = 'Firmowe logo.'
355
375
  asset.save
356
376
  expect(asset).to be_kind_of Contentful::Management::Asset
@@ -363,7 +383,7 @@ module Contentful
363
383
  let(:space_id) { 'bfsvtul0c41g' }
364
384
  it 'update the current version of the object to the version on the system' do
365
385
  vcr('asset/reload') do
366
- asset = Contentful::Management::Asset.find(space_id, '8R4vbQXKbCkcSu26Wy2U0')
386
+ asset = subject.find(space_id, '8R4vbQXKbCkcSu26Wy2U0')
367
387
  asset.sys[:version] = 999
368
388
  update_asset = asset.update(title: 'Updated name')
369
389
  expect(update_asset).to be_kind_of Contentful::Management::Conflict
@@ -377,7 +397,7 @@ module Contentful
377
397
 
378
398
  it 'updates fields collection when reloaded' do
379
399
  vcr('asset/reload_with_fields') do
380
- asset = Contentful::Management::Asset.find(space_id, '8R4vbQXKbCkcSu26Wy2U0')
400
+ asset = subject.find(space_id, '8R4vbQXKbCkcSu26Wy2U0')
381
401
  valid_fields = asset.instance_variable_get(:@fields)
382
402
  asset.instance_variable_set(:@fields, 'changed')
383
403
  asset.reload
@@ -391,12 +411,12 @@ module Contentful
391
411
 
392
412
  describe '#image_url' do
393
413
  it 'empty_query' do
394
- asset = Contentful::Management::Asset.new
414
+ asset = subject.new
395
415
  asset.file = double('file', url: 'http://assets.com/asset.jpg')
396
416
  expect(asset.image_url).to eq 'http://assets.com/asset.jpg'
397
417
  end
398
418
  it 'with_params' do
399
- asset = Contentful::Management::Asset.new
419
+ asset = subject.new
400
420
  asset.file = double('file', url: 'http://assets.com/asset.jpg')
401
421
  expect(asset.image_url(w: 100, h: 100, fm: 'format', q: 1)).to eq 'http://assets.com/asset.jpg?w=100&h=100&fm=format&q=1'
402
422
  end
@@ -421,12 +441,12 @@ module Contentful
421
441
 
422
442
  describe '#image_url' do
423
443
  it 'empty_query' do
424
- asset = Contentful::Management::Asset.new
444
+ asset = subject.new
425
445
  asset.file = double('file', url: 'http://assets.com/asset.jpg')
426
446
  expect(asset.image_url).to eq 'http://assets.com/asset.jpg'
427
447
  end
428
448
  it 'with_params' do
429
- asset = Contentful::Management::Asset.new
449
+ asset = subject.new
430
450
  asset.file = double('file', url: 'http://assets.com/asset.jpg')
431
451
  expect(asset.image_url(w: 100, h: 100, fm: 'format', q: 1)).to eq 'http://assets.com/asset.jpg?w=100&h=100&fm=format&q=1'
432
452
  end
@@ -74,6 +74,44 @@ module Contentful
74
74
  end
75
75
  end
76
76
 
77
+ describe '.post_http' do
78
+ subject { Client }
79
+ it 'does a POST request' do
80
+ vcr(:post_request) { subject.post_http('http://example.com', foo: 'bar') }
81
+ end
82
+ end
83
+
84
+ describe '.put_http' do
85
+ subject { Client }
86
+ it 'does a PUT request' do
87
+ vcr(:put_request) { subject.put_http('http://example.com', foo: 'bar') }
88
+ end
89
+ end
90
+
91
+ describe '.delete_http' do
92
+ subject { Client }
93
+ it 'does a DELETE request' do
94
+ vcr(:delete_request) { subject.delete_http('http://example.com', foo: 'bar') }
95
+ end
96
+ end
97
+
98
+ describe 'running with a proxy' do
99
+ subject { Client.new("<ACCESS_TOKEN>", proxy_host: 'localhost', proxy_port: 8888) }
100
+ it 'can run through a proxy' do
101
+ vcr(:proxy_request) {
102
+ space = subject.spaces.find('zh42n1tmsaiq')
103
+ expect(space.name).to eq 'MinecraftVR'
104
+ }
105
+ end
106
+
107
+ it 'effectively requests via proxy' do
108
+ vcr(:proxy_request) {
109
+ expect(subject.class).to receive(:proxy_send).twice.and_call_original
110
+ subject.spaces.find('zh42n1tmsaiq')
111
+ }
112
+ end
113
+ end
114
+
77
115
  describe '.raise_error' do
78
116
  it 'raise error set to true' do
79
117
  expect(subject.configuration[:raise_errors]).to be_falsey
@@ -10,9 +10,12 @@ module Contentful
10
10
  let!(:client) { Client.new(token) }
11
11
  let(:content_type_id) { '5DSpuKrl04eMAGQoQckeIq' }
12
12
 
13
- subject { Contentful::Management::ContentType }
13
+ subject { client.content_types }
14
14
 
15
15
  describe '.all' do
16
+ it 'class method also works' do
17
+ vcr('content_type/all') { expect(Contentful::Management::ContentType.all(client, space_id)).to be_kind_of Contentful::Management::Array }
18
+ end
16
19
  it 'returns a Contentful::Array' do
17
20
  vcr('content_type/all') { expect(subject.all(space_id)).to be_kind_of Contentful::Management::Array }
18
21
  end
@@ -23,6 +26,9 @@ module Contentful
23
26
 
24
27
  describe '.all_published' do
25
28
  let!(:space_id) { 'bjwq7b86vgmm' }
29
+ it 'class method also works' do
30
+ vcr('content_type/all_public') { expect(Contentful::Management::ContentType.all_published(client, space_id)).to be_kind_of Contentful::Management::Array }
31
+ end
26
32
  it 'returns a Contentful::Array' do
27
33
  vcr('content_type/all_public') { expect(subject.all_published(space_id)).to be_kind_of Contentful::Management::Array }
28
34
  end
@@ -31,7 +37,10 @@ module Contentful
31
37
  end
32
38
  end
33
39
 
34
- describe '#find' do
40
+ describe '.find' do
41
+ it 'class method also works' do
42
+ vcr('content_type/find') { expect(Contentful::Management::ContentType.find(client, space_id, content_type_id)).to be_kind_of Contentful::Management::ContentType }
43
+ end
35
44
  it 'returns a Contentful::Management::ContentType' do
36
45
  vcr('content_type/find') { expect(subject.find(space_id, content_type_id)).to be_kind_of Contentful::Management::ContentType }
37
46
  end
@@ -148,9 +157,11 @@ module Contentful
148
157
 
149
158
  it 'creates a content_type within a space without id and without fields' do
150
159
  vcr('content_type/create') do
151
- content_type = Contentful::Management::ContentType.create(space_id,
152
- name: content_type_name,
153
- description: content_type_description)
160
+ content_type = subject.create(
161
+ space_id,
162
+ name: content_type_name,
163
+ description: content_type_description
164
+ )
154
165
  expect(content_type).to be_kind_of Contentful::Management::ContentType
155
166
  expect(content_type.name).to eq content_type_name
156
167
  expect(content_type.description).to eq content_type_description
@@ -160,9 +171,11 @@ module Contentful
160
171
  it 'creates a content_type within a space with custom id and without fields' do
161
172
  vcr('content_type/create_content_type_with_id') do
162
173
  content_type_id = 'custom_id'
163
- content_type = Contentful::Management::ContentType.create(space_id,
164
- name: content_type_name,
165
- id: content_type_id)
174
+ content_type = subject.create(
175
+ space_id,
176
+ name: content_type_name,
177
+ id: content_type_id
178
+ )
166
179
  expect(content_type).to be_kind_of Contentful::Management::ContentType
167
180
  expect(content_type.name).to eq content_type_name
168
181
  expect(content_type.id).to eq content_type_id
@@ -177,10 +190,12 @@ module Contentful
177
190
  field.name = "My #{ field_type } Field"
178
191
  field.type = field_type
179
192
  field.link_type = 'Entry' if field_type == 'Link'
180
- content_type = Contentful::Management::ContentType.create(space_id,
181
- name: "#{ field_type }",
182
- description: "Content type with #{ field_type } field",
183
- fields: [field])
193
+ content_type = subject.create(
194
+ space_id,
195
+ name: "#{ field_type }",
196
+ description: "Content type with #{ field_type } field",
197
+ fields: [field]
198
+ )
184
199
  expect(content_type).to be_kind_of Contentful::Management::ContentType
185
200
  expect(content_type.name).to eq "#{ field_type }"
186
201
  expect(content_type.description).to eq "Content type with #{ field_type } field"
@@ -251,7 +266,7 @@ module Contentful
251
266
 
252
267
  it 'update with multiple locales' do
253
268
  vcr('content_type/entry/update_only_with_localized_fields') do
254
- space = Contentful::Management::Space.find('v2umtz8ths9v')
269
+ space = client.spaces.find('v2umtz8ths9v')
255
270
  entry = space.entries.find('2dEkgsQRnSW2QuW4AMaa86')
256
271
  entry.name_with_locales = {'en-US' => 'Contentful EN up', 'de-DE' => 'Contentful DE up', 'pl-PL' => 'Contentful PL up'}
257
272
  entry.description_with_locales = {'en-US' => 'Description EN up', 'de-DE' => 'Description DE up', 'pl-PL' => 'Description PL up'}
@@ -290,7 +305,7 @@ module Contentful
290
305
 
291
306
  it 'saves new object' do
292
307
  vcr('content_type/save_new') do
293
- space = Contentful::Management::Space.find(space_id)
308
+ space = client.spaces.find(space_id)
294
309
  content_type = space.content_types.new
295
310
  content_type.name = 'Post title'
296
311
  field = Contentful::Management::Field.new
@@ -397,7 +412,7 @@ module Contentful
397
412
 
398
413
  it 'with entry' do
399
414
  vcr('content_type/entry/create_with_entries') do
400
- entry_en = Entry.find(space_id, 'Qa8TW5nPWgiU4MA6AGYgq')
415
+ entry_en = client.entries.find(space_id, 'Qa8TW5nPWgiU4MA6AGYgq')
401
416
  content_type = subject.find(space_id, '6xzrdCr33OMAeIYUgs6UKi')
402
417
  entry = content_type.entries.create(blog_name: 'Piotrek',
403
418
  blog_entry: entry_en,
@@ -449,7 +464,7 @@ module Contentful
449
464
  end
450
465
  it 'with entries' do
451
466
  vcr('content_type/entry/create_with_entries_for_multiple_locales') do
452
- space = Contentful::Management::Space.find(space_id)
467
+ space = client.spaces.find(space_id)
453
468
  space.content_types # filling cache
454
469
 
455
470
  entry_en = space.entries.find('664EPJ6zHqAeMO6O0mGggU')
@@ -467,7 +482,7 @@ module Contentful
467
482
 
468
483
  it 'with assets' do
469
484
  vcr('content_type/entry/create_with_entries_for_multiple_locales') do
470
- space = Contentful::Management::Space.find(space_id)
485
+ space = client.spaces.find(space_id)
471
486
  space.content_types # filling cache
472
487
 
473
488
  entry_en = space.entries.find('664EPJ6zHqAeMO6O0mGggU')
@@ -519,7 +534,7 @@ module Contentful
519
534
  let(:space_id) { '9lxkhjnp8gyx' }
520
535
  it 'returns entries' do
521
536
  vcr('content_type/entry/all') do
522
- space = Contentful::Management::Space.find(space_id)
537
+ space = client.spaces.find(space_id)
523
538
  content_type = space.content_types.find('category_content_type')
524
539
  entries = content_type.entries.all
525
540
  expect(entries).to be_kind_of Contentful::Management::Array
@@ -534,7 +549,7 @@ module Contentful
534
549
  let(:space_id) { 'bfsvtul0c41g' }
535
550
  it 'update the current version of the object to the version on the system' do
536
551
  vcr('content_type/reload') do
537
- content_type = Contentful::Management::ContentType.find(space_id, 'category_content_type')
552
+ content_type = subject.find(space_id, 'category_content_type')
538
553
  content_type.sys[:version] = 999
539
554
  update_ct = content_type.update(name: 'Updated content type name')
540
555
  expect(update_ct).to be_kind_of Contentful::Management::Conflict
@@ -548,7 +563,7 @@ module Contentful
548
563
 
549
564
 
550
565
  describe '#validations' do
551
- let(:space) { Contentful::Management::Space.find('v2umtz8ths9v') }
566
+ let(:space) { client.spaces.find('v2umtz8ths9v') }
552
567
  let(:content_type) { space.content_types.find('category_content_type') }
553
568
 
554
569
  it "adds 'in validation' to a new field" do
@@ -700,7 +715,7 @@ module Contentful
700
715
  it 'creates new content type with fields' do
701
716
  vcr('content_type/fields/create_array_types') do
702
717
 
703
- space = Contentful::Management::Space.find('2jtuu7nex6e6')
718
+ space = client.spaces.find('2jtuu7nex6e6')
704
719
 
705
720
  items = Contentful::Management::Field.new
706
721
  items.type = 'Link'
@@ -734,7 +749,7 @@ module Contentful
734
749
  describe 'issues' do
735
750
  it 'content types should be valid on creation - #79' do
736
751
  vcr('content_type/issue_79') {
737
- space = Contentful::Management::Space.find('ngtgiva4wofg')
752
+ space = client.spaces.find('ngtgiva4wofg')
738
753
 
739
754
  field = Contentful::Management::Field.new
740
755
  field.id = 'name'
@@ -11,9 +11,12 @@ module Contentful
11
11
 
12
12
  let!(:client) { Client.new(token) }
13
13
 
14
- subject { Contentful::Management::Entry }
14
+ subject { client.entries }
15
15
 
16
16
  describe '.all' do
17
+ it 'class method also works' do
18
+ vcr('entry/all') { expect(Contentful::Management::Entry.all(client, 'bfsvtul0c41g')).to be_kind_of Contentful::Management::Array }
19
+ end
17
20
  it 'returns a Contentful::Array' do
18
21
  vcr('entry/all') { expect(subject.all('bfsvtul0c41g')).to be_kind_of Contentful::Management::Array }
19
22
  end
@@ -22,7 +25,7 @@ module Contentful
22
25
  end
23
26
  it 'returns entries in context of specified content type' do
24
27
  vcr('entry/content_type_entires') do
25
- entries = Contentful::Management::Entry.all('bfsvtul0c41g', content_type: 'category_content_type')
28
+ entries = subject.all('bfsvtul0c41g', content_type: 'category_content_type')
26
29
  expect(entries).to be_kind_of Contentful::Management::Array
27
30
  expect(entries.first).to be_kind_of Contentful::Management::Entry
28
31
  expect(entries.first.sys[:contentType].id).to eq 'category_content_type'
@@ -30,7 +33,7 @@ module Contentful
30
33
  end
31
34
  it 'return limited number of entries with next_page' do
32
35
  vcr('entry/limited_entries') do
33
- entries = Contentful::Management::Entry.all('bfsvtul0c41g', limit: 20, skip: 2)
36
+ entries = subject.all('bfsvtul0c41g', limit: 20, skip: 2)
34
37
  expect(entries).to be_kind_of Contentful::Management::Array
35
38
  expect(entries.limit).to eq 20
36
39
  expect(entries.skip).to eq 2
@@ -41,6 +44,9 @@ module Contentful
41
44
 
42
45
  describe '.all_published' do
43
46
  let!(:space_id) { 'bjwq7b86vgmm' }
47
+ it 'class method also works' do
48
+ vcr('entry/all_public') { expect(Contentful::Management::Entry.all_published(client, space_id)).to be_kind_of Contentful::Management::Array }
49
+ end
44
50
  it 'returns a Contentful::Array' do
45
51
  vcr('entry/all_public') { expect(subject.all_published(space_id)).to be_kind_of Contentful::Management::Array }
46
52
  end
@@ -49,10 +55,14 @@ module Contentful
49
55
  end
50
56
  end
51
57
 
52
- describe '#find' do
58
+ describe '.find' do
59
+ it 'class method also works' do
60
+ vcr('entry/find') { expect(Contentful::Management::Entry.find(client, space_id, entry_id)).to be_kind_of Contentful::Management::Entry }
61
+ end
62
+
53
63
  it 'returns null as nil on empty Symbols' do
54
64
  vcr('entry/find-with-null-symbols') do
55
- space = Contentful::Management::Space.find space_id
65
+ space = client.spaces.find(space_id)
56
66
  entry = space.entries.find(entry_id)
57
67
  expect(entry.fields[:videoid]).to_not be_kind_of(String)
58
68
  expect(entry.fields[:videoid]).to be_nil
@@ -233,30 +243,31 @@ module Contentful
233
243
 
234
244
  describe '.create' do
235
245
  let(:content_type_id) { '5DSpuKrl04eMAGQoQckeIq' }
236
- let(:content_type) { Contentful::Management::ContentType.find(space_id, content_type_id) }
246
+ let(:content_type) { client.content_types.find(space_id, content_type_id) }
237
247
 
238
248
  it 'create with all attributes' do
239
249
  vcr('entry/create') do
240
- content_type = Contentful::Management::ContentType.find('ene4qtp2sh7u', '5BHZB1vi4ooq4wKcmA8e2c')
250
+ content_type = client.content_types.find('ene4qtp2sh7u', '5BHZB1vi4ooq4wKcmA8e2c')
241
251
  location = Location.new.tap do |location|
242
252
  location.lat = 22.44
243
253
  location.lon = 33.33
244
254
  end
245
- file = Asset.find('ene4qtp2sh7u', '2oNoT3vSAs82SOIQmKe0KG')
246
- entry_att = Entry.find('ene4qtp2sh7u', '60zYC7nY9GcKGiCYwAs4wm')
247
- entry = subject.create(content_type,
248
- name: 'Test name',
249
- number: 30,
250
- float1: 1.1,
251
- boolean: true, date: '2000-07-12T11:11:00+02:00',
252
- time: '2000-07-12T11:11:00+02:00',
253
- location: location,
254
- file: file,
255
- image: file,
256
- array: %w(PL USD XX),
257
- entry: entry_att,
258
- entries: [entry_att, entry_att],
259
- object_json: {'test' => {'@type' => 'Codequest'}}
255
+ file = client.assets.find('ene4qtp2sh7u', '2oNoT3vSAs82SOIQmKe0KG')
256
+ entry_att = subject.find('ene4qtp2sh7u', '60zYC7nY9GcKGiCYwAs4wm')
257
+ entry = subject.create(
258
+ content_type,
259
+ name: 'Test name',
260
+ number: 30,
261
+ float1: 1.1,
262
+ boolean: true, date: '2000-07-12T11:11:00+02:00',
263
+ time: '2000-07-12T11:11:00+02:00',
264
+ location: location,
265
+ file: file,
266
+ image: file,
267
+ array: %w(PL USD XX),
268
+ entry: entry_att,
269
+ entries: [entry_att, entry_att],
270
+ object_json: {'test' => {'@type' => 'Codequest'}}
260
271
  )
261
272
  expect(entry.name).to eq 'Test name'
262
273
  expect(entry.number).to eq 30
@@ -288,7 +299,7 @@ module Contentful
288
299
 
289
300
  it 'with entry' do
290
301
  vcr('entry/create_with_entry') do
291
- entry_att = Entry.find(space_id, '4o6ghKSmSko4i828YCYaEo')
302
+ entry_att = client.entries.find(space_id, '4o6ghKSmSko4i828YCYaEo')
292
303
  entry = subject.create(content_type, name: 'EntryWithEntry', age: 20, entry: entry_att)
293
304
  expect(entry.name).to eq 'EntryWithEntry'
294
305
  expect(entry.age).to eq 20
@@ -298,7 +309,7 @@ module Contentful
298
309
 
299
310
  it 'with entries' do
300
311
  vcr('entry/create_with_entries') do
301
- entry_att = Entry.find(space_id, '1d1QDYzeiyWmgqQYysae8u')
312
+ entry_att = subject.find(space_id, '1d1QDYzeiyWmgqQYysae8u')
302
313
  new_entry = subject.create(content_type,
303
314
  name: 'EntryWithEntries',
304
315
  age: 20,
@@ -310,14 +321,14 @@ module Contentful
310
321
 
311
322
  it 'with asset' do
312
323
  vcr('entry/create_with_asset') do
313
- asset = Asset.find(space_id, 'codequest_id_test_custom')
324
+ asset = client.assets.find(space_id, 'codequest_id_test_custom')
314
325
  entry = subject.create(content_type, name: 'OneAsset', asset: asset)
315
326
  expect(entry.name).to eq 'OneAsset'
316
327
  end
317
328
  end
318
329
  it 'with assets' do
319
330
  vcr('entry/create_with_assets') do
320
- asset = Asset.find(space_id, 'codequest_id_test_custom')
331
+ asset = client.assets.find(space_id, 'codequest_id_test_custom')
321
332
  entry = subject.create(content_type, name: 'multiAssets', assets: [asset, asset, asset])
322
333
  expect(entry.name).to eq 'multiAssets'
323
334
  end
@@ -337,7 +348,7 @@ module Contentful
337
348
  end
338
349
  it 'to specified locale' do
339
350
  vcr('entry/create_with_specified_locale') do
340
- space = Contentful::Management::Space.find('s37a4pe35l1x')
351
+ space = client.spaces.find('s37a4pe35l1x')
341
352
  ct = space.content_types.find('category_content_type')
342
353
  entry = ct.entries.create(name: 'Create test', description: 'Test - create entry with specified locale.', locale: 'pl-PL')
343
354
  expect(entry.name).to eq 'Create test'
@@ -346,7 +357,7 @@ module Contentful
346
357
 
347
358
  it 'too many requests' do
348
359
  vcr('entry/too_many_requests') do
349
- space = Contentful::Management::Space.find('286arvy86ry9')
360
+ space = client.spaces.find('286arvy86ry9')
350
361
  invalid_entry = space.entries.find('1YNepnMpXGiMWikaKC4GG0')
351
362
  ct = space.content_types.find('5lIEiXrCIoKoIKaSW2C8aa')
352
363
  entry = ct.entries.create(name: 'Create test', entry: invalid_entry)
@@ -358,7 +369,7 @@ module Contentful
358
369
 
359
370
  it 'with just an id' do
360
371
  vcr('entry/create_with_just_id') do
361
- space = Contentful::Management::Space.find('bbukbffokvih')
372
+ space = client.spaces.find('bbukbffokvih')
362
373
  entry = space.content_types.all.first.entries.create({'id' => 'yol'})
363
374
  entry.save
364
375
  expect(entry).to be_a Contentful::Management::Entry
@@ -370,9 +381,9 @@ module Contentful
370
381
  let(:entry_id) { '1I3qWOiP8k2WWYCogKy88S' }
371
382
  it 'update entry' do
372
383
  vcr('entry/update') do
373
- asset = Asset.find(space_id, 'codequest_id_test_custom_id')
374
- entry_att = Entry.find(space_id, '1d1QDYzeiyWmgqQYysae8u')
375
- entry = Contentful::Management::Entry.find(space_id, '4o6ghKSmSko4i828YCYaEo')
384
+ asset = client.assets.find(space_id, 'codequest_id_test_custom_id')
385
+ entry_att = subject.find(space_id, '1d1QDYzeiyWmgqQYysae8u')
386
+ entry = subject.find(space_id, '4o6ghKSmSko4i828YCYaEo')
376
387
 
377
388
  location = Location.new
378
389
  location.lat = 22.44
@@ -400,7 +411,7 @@ module Contentful
400
411
 
401
412
  it 'update entry for custom locale' do
402
413
  vcr('entry/update_with_custom_locale') do
403
- entry = Contentful::Management::Entry.find(space_id, '3U7JqGuVzOWIimU40mKeem')
414
+ entry = subject.find(space_id, '3U7JqGuVzOWIimU40mKeem')
404
415
  entry.locale = 'pl'
405
416
  result = entry.update(name: 'testName', bool: true)
406
417
  expect(result).to be_kind_of Contentful::Management::Entry
@@ -411,12 +422,12 @@ module Contentful
411
422
 
412
423
  it 'return Error when update not localized field' do
413
424
  vcr('entry/update_unlocalized_field') do
414
- asset = Asset.find(space_id, 'codequest_id_test_custom_id')
425
+ asset = client.assets.find(space_id, 'codequest_id_test_custom_id')
415
426
 
416
427
  location = Location.new
417
428
  location.lat = 22.44
418
429
  location.lon = 33.33
419
- entry = Contentful::Management::Entry.find(space_id, '3U7JqGuVzOWIimU40mKeem')
430
+ entry = subject.find(space_id, '3U7JqGuVzOWIimU40mKeem')
420
431
  entry.locale = 'pl'
421
432
  result = entry.update(name: 'DoestMatter', bool: false, city: location, asset: asset)
422
433
  expect(result).to be_kind_of Contentful::Management::Error
@@ -425,7 +436,7 @@ module Contentful
425
436
 
426
437
  it 'can update boolean fields to `false`' do
427
438
  vcr('entry/update_bool_field') do
428
- space = Contentful::Management::Space.find('fujuvqn6zcl1')
439
+ space = client.spaces.find('fujuvqn6zcl1')
429
440
  content_type = space.content_types.find('1kUEViTN4EmGiEaaeC6ouY')
430
441
 
431
442
  q = content_type.entries.new
@@ -443,7 +454,7 @@ module Contentful
443
454
  describe '#save' do
444
455
  it 'save updated' do
445
456
  vcr('entry/save_update') do
446
- entry = Contentful::Management::Entry.find(space_id, '664EPJ6zHqAeMO6O0mGggU')
457
+ entry = subject.find(space_id, '664EPJ6zHqAeMO6O0mGggU')
447
458
  entry.fields[:carMark] = 'Merc'
448
459
  entry.save
449
460
  expect(entry).to be_kind_of Contentful::Management::Entry
@@ -456,7 +467,7 @@ module Contentful
456
467
  let(:space_id) { 'bfsvtul0c41g' }
457
468
  it 'update the current version of the object to the version on the system' do
458
469
  vcr('entry/reload') do
459
- space = Contentful::Management::Space.find(space_id)
470
+ space = client.spaces.find(space_id)
460
471
  entry = space.entries.find('2arjcjtY7ucC4AGeIOIkok')
461
472
  entry.sys[:version] = 999
462
473
  update_entry = entry.update(post_title: 'Updated title')
@@ -471,7 +482,7 @@ module Contentful
471
482
 
472
483
  describe 'search filters' do
473
484
  let(:space) do
474
- Contentful::Management::Space.find('bfsvtul0c41g')
485
+ client.spaces.find('bfsvtul0c41g')
475
486
  end
476
487
  context 'order' do
477
488
  it 'returns ordered entries by createdAt' do
@@ -632,7 +643,7 @@ module Contentful
632
643
  describe 'handling of localized values' do
633
644
  it 'retrieves localized value if it exists' do
634
645
  vcr('entry/locales/retrieve_localized') do
635
- space = Contentful::Management::Space.find('0agypmo1waov')
646
+ space = client.spaces.find('0agypmo1waov')
636
647
  entry = space.entries.find('5cMXsmSd5So6iggWi268eG')
637
648
  entry.locale = 'de-DE'
638
649
 
@@ -643,7 +654,7 @@ module Contentful
643
654
 
644
655
  it 'retrieves value of default locale if it has not been localized' do
645
656
  vcr('entry/locales/fallback_to_default_locale') do
646
- space = Contentful::Management::Space.find('0agypmo1waov')
657
+ space = client.spaces.find('0agypmo1waov')
647
658
  entry = space.entries.find('4epXENbO8wsaOukgqquYcI')
648
659
  entry.locale = 'de-DE'
649
660
 
@@ -654,7 +665,7 @@ module Contentful
654
665
 
655
666
  it 'sets value for the default locale when using simple assignments' do
656
667
  vcr('entry/locales/simple_assignments_use_default_locale') do
657
- space = Contentful::Management::Space.find('0agypmo1waov')
668
+ space = client.spaces.find('0agypmo1waov')
658
669
  entry = space.entries.find('4epXENbO8wsaOukgqquYcI')
659
670
 
660
671
  entry.yolo = 'changed'
@@ -665,7 +676,7 @@ module Contentful
665
676
 
666
677
  it 'sets value for the specified locales when using *_with_locales' do
667
678
  vcr('entry/locales/simple_assignments_use_specified_locale') do
668
- space = Contentful::Management::Space.find('0agypmo1waov')
679
+ space = client.spaces.find('0agypmo1waov')
669
680
  entry = space.entries.find('4epXENbO8wsaOukgqquYcI')
670
681
 
671
682
  entry.yolo_with_locales = {'de-DE' => 'changed'}
@@ -733,7 +744,7 @@ module Contentful
733
744
  describe 'handles multiple locales even when they are not all defined for the default locale - #70' do
734
745
  it 'merges all present locales' do
735
746
  vcr('entry/issue_70') {
736
- space = Contentful::Management::Space.find('9sh5dtmfyzhj')
747
+ space = client.spaces.find('9sh5dtmfyzhj')
737
748
 
738
749
  entry_non_default_locale = space.entries.find('1PdCkb5maYgqsSUCOweseM')
739
750
 
@@ -751,7 +762,7 @@ module Contentful
751
762
  vcr('entry/issue_73') {
752
763
  begin
753
764
  client.configuration[:default_locale] = 'en-GB'
754
- content_type = Contentful::Management::ContentType.find('u2viwgfeal0o', 'someType')
765
+ content_type = client.content_types.find('u2viwgfeal0o', 'someType')
755
766
  new_entry = content_type.entries.create(id: 'hello-world')
756
767
 
757
768
  new_entry.name = 'Hello World!'
@@ -776,7 +787,7 @@ module Contentful
776
787
  vcr('entry/issue_61.1') {
777
788
  begin
778
789
  client.configuration[:default_locale] = 'en-GB'
779
- content_type = Contentful::Management::ContentType.find('u2viwgfeal0o', 'someType')
790
+ content_type = client.content_types.find('u2viwgfeal0o', 'someType')
780
791
  new_entry = content_type.entries.create(id: 'issue61_1', value: 'hello')
781
792
 
782
793
  expect(new_entry.value).to eq 'hello'
@@ -786,7 +797,7 @@ module Contentful
786
797
  new_entry.save
787
798
  new_entry.publish
788
799
 
789
- expected_entry = Contentful::Management::Entry.find('u2viwgfeal0o', new_entry.id)
800
+ expected_entry = subject.find('u2viwgfeal0o', new_entry.id)
790
801
 
791
802
  expect(expected_entry.value).to eq 'goodbye'
792
803
  ensure
@@ -799,7 +810,7 @@ module Contentful
799
810
  vcr('entry/issue_61.2') {
800
811
  begin
801
812
  client.configuration[:default_locale] = 'en-GB'
802
- content_type = Contentful::Management::ContentType.find('u2viwgfeal0o', 'someType')
813
+ content_type = client.content_types.find('u2viwgfeal0o', 'someType')
803
814
  new_entry = content_type.entries.create(id: 'issue61_2')
804
815
 
805
816
  new_entry.value = 'goodbye'
@@ -809,7 +820,7 @@ module Contentful
809
820
 
810
821
  expect(new_entry.value).to eq 'goodbye'
811
822
 
812
- expected_entry = Contentful::Management::Entry.find('u2viwgfeal0o', new_entry.id)
823
+ expected_entry = subject.find('u2viwgfeal0o', new_entry.id)
813
824
 
814
825
  expect(expected_entry.value).to eq 'goodbye'
815
826
  ensure
@@ -824,12 +835,12 @@ module Contentful
824
835
  vcr('entry/issue_61.3') {
825
836
  begin
826
837
  client.configuration[:default_locale] = 'en-GB'
827
- content_type = Contentful::Management::ContentType.find('u2viwgfeal0o', 'someType')
838
+ content_type = client.content_types.find('u2viwgfeal0o', 'someType')
828
839
  new_entry = content_type.entries.create(id: 'issue61_3', value: 'hello')
829
840
 
830
841
  expect(new_entry.value).to eq 'hello'
831
842
 
832
- expected_entry = Contentful::Management::Entry.find('u2viwgfeal0o', new_entry.id)
843
+ expected_entry = subject.find('u2viwgfeal0o', new_entry.id)
833
844
 
834
845
  expected_entry.value = 'goodbye'
835
846
 
@@ -847,10 +858,10 @@ module Contentful
847
858
  vcr('entry/issue_61.4') {
848
859
  begin
849
860
  client.configuration[:default_locale] = 'en-GB'
850
- content_type = Contentful::Management::ContentType.find('u2viwgfeal0o', 'someType')
861
+ content_type = client.content_types.find('u2viwgfeal0o', 'someType')
851
862
  new_entry = content_type.entries.create(id: 'issue61_4')
852
863
 
853
- expected_entry = Contentful::Management::Entry.find('u2viwgfeal0o', new_entry.id)
864
+ expected_entry = subject.find('u2viwgfeal0o', new_entry.id)
854
865
 
855
866
  expected_entry.value = 'goodbye'
856
867
 
@@ -874,7 +885,7 @@ module Contentful
874
885
  begin
875
886
  client.configuration[:default_locale] = 'en-GB'
876
887
 
877
- expected_entry = Contentful::Management::Entry.find('u2viwgfeal0o', 'fIpsfQSOd22IsqMQCiG0K')
888
+ expected_entry = subject.find('u2viwgfeal0o', 'fIpsfQSOd22IsqMQCiG0K')
878
889
 
879
890
  expect(expected_entry.value).to eq 'hello'
880
891
 
@@ -898,7 +909,7 @@ module Contentful
898
909
  begin
899
910
  client.configuration[:default_locale] = 'en-GB'
900
911
 
901
- expected_entry = Contentful::Management::Entry.find('u2viwgfeal0o', '2GmtCwDBcIu4giMgQGIIcq')
912
+ expected_entry = subject.find('u2viwgfeal0o', '2GmtCwDBcIu4giMgQGIIcq')
902
913
 
903
914
  expect(expected_entry.value).to eq nil
904
915
 
@@ -925,7 +936,7 @@ module Contentful
925
936
  begin
926
937
  client.configuration[:default_locale] = 'en-GB'
927
938
 
928
- expected_entry = Contentful::Management::Entry.find('u2viwgfeal0o', 'fIpsfQSOd22IsqMQCiG0K')
939
+ expected_entry = subject.find('u2viwgfeal0o', 'fIpsfQSOd22IsqMQCiG0K')
929
940
 
930
941
  expect(expected_entry.value).to eq 'hello'
931
942
 
@@ -949,7 +960,7 @@ module Contentful
949
960
  begin
950
961
  client.configuration[:default_locale] = 'en-GB'
951
962
 
952
- expected_entry = Contentful::Management::Entry.find('u2viwgfeal0o', '2GmtCwDBcIu4giMgQGIIcq')
963
+ expected_entry = subject.find('u2viwgfeal0o', '2GmtCwDBcIu4giMgQGIIcq')
953
964
 
954
965
  expect(expected_entry.value).to eq nil
955
966