contentful-management 2.13.1 → 3.3.0

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.
@@ -474,14 +474,14 @@ module Contentful
474
474
  it 'hydrates tags' do
475
475
  vcr('asset/issue_219') {
476
476
  asset = environment.assets.find(asset_id)
477
- expect(asset.metadata[:tags].first).to be_a Contentful::Management::Link
477
+ expect(asset._metadata[:tags].first).to be_a Contentful::Management::Link
478
478
  }
479
479
  end
480
480
 
481
481
  it 'loads tag links with their proper attributes' do
482
482
  vcr('asset/issue_219') {
483
483
  asset = environment.assets.find(asset_id)
484
- tag = asset.metadata[:tags].first
484
+ tag = asset._metadata[:tags].first
485
485
  expect(tag.id).to eq 'mobQa'
486
486
  expect(tag.link_type).to eq 'Tag'
487
487
  }
@@ -51,6 +51,21 @@ module Contentful
51
51
  expect(editor_interface.controls.first['widgetId']).to eq 'urlEditor'
52
52
  end
53
53
  end
54
+
55
+ it 'can update the sidebar' do
56
+ vcr('editor_interfaces/update_sidebar') do
57
+ editor_interface = described_class.default(client, space_id, 'master', content_type_id)
58
+
59
+ expect(editor_interface.sidebar.first['widgetId']).to eq 'flow-editor'
60
+
61
+ editor_interface.sidebar.first['widgetId'] = 'date-range-editor'
62
+ editor_interface.update(sidebar: editor_interface.sidebar)
63
+
64
+ editor_interface.reload
65
+
66
+ expect(editor_interface.sidebar.first['widgetId']).to eq 'date-range-editor'
67
+ end
68
+ end
54
69
  end
55
70
 
56
71
  describe '#save' do
@@ -70,6 +85,21 @@ module Contentful
70
85
  expect(editor_interface.controls.first['widgetId']).to eq 'urlEditor'
71
86
  end
72
87
  end
88
+
89
+ it 'can save sidebar' do
90
+ vcr('editor_interfaces/update_sidebar') do
91
+ editor_interface = described_class.default(client, space_id, 'master', content_type_id)
92
+
93
+ expect(editor_interface.sidebar.first['widgetId']).to eq 'flow-editor'
94
+
95
+ editor_interface.sidebar.first['widgetId'] = 'date-range-editor'
96
+ editor_interface.save
97
+
98
+ editor_interface.reload
99
+
100
+ expect(editor_interface.sidebar.first['widgetId']).to eq 'date-range-editor'
101
+ end
102
+ end
73
103
  end
74
104
  end
75
105
  end
@@ -885,14 +885,14 @@ describe Contentful::Management::Entry do
885
885
  it 'hydrates tags' do
886
886
  vcr('entry/issue_219') {
887
887
  entry = environment.entries.find(entry_id)
888
- expect(entry.metadata[:tags].first).to be_a Contentful::Management::Link
888
+ expect(entry._metadata[:tags].first).to be_a Contentful::Management::Link
889
889
  }
890
890
  end
891
891
 
892
892
  it 'loads tag links with their proper attributes' do
893
893
  vcr('entry/issue_219') {
894
894
  entry = environment.entries.find(entry_id)
895
- tag = entry.metadata[:tags].first
895
+ tag = entry._metadata[:tags].first
896
896
  expect(tag.id).to eq 'mobQa'
897
897
  expect(tag.link_type).to eq 'Tag'
898
898
  }
@@ -46,6 +46,16 @@ module Contentful
46
46
  expect(user.avatar_url).to be_truthy
47
47
  }
48
48
  end
49
+
50
+ describe "all" do
51
+ it 'returns a Contentful::Array' do
52
+ vcr('organization/users') { expect(subject.all.first.users.all).to be_kind_of Contentful::Management::Array }
53
+ end
54
+
55
+ it 'builds a Contentful::Management::Space object' do
56
+ vcr('organization/users') { expect(subject.all.first.users.all.first).to be_kind_of Contentful::Management::User }
57
+ end
58
+ end
49
59
  end
50
60
  end
51
61
  end
@@ -259,6 +259,16 @@ module Contentful
259
259
  }
260
260
  end
261
261
  end
262
+
263
+ describe "all" do
264
+ it 'returns a Contentful::Array' do
265
+ vcr('space/users') { expect(subject.find('space_id').users.all).to be_kind_of Contentful::Management::Array }
266
+ end
267
+
268
+ it 'builds a Contentful::Management::Space object' do
269
+ vcr('space/users') { expect(subject.find('space_id').users.all.first).to be_kind_of Contentful::Management::User }
270
+ end
271
+ end
262
272
  end
263
273
  end
264
274
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful-management
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.1
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Protas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-01-07 00:00:00.000000000 Z
13
+ date: 2021-08-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -546,6 +546,7 @@ files:
546
546
  - spec/fixtures/vcr_cassettes/delete_request.yml
547
547
  - spec/fixtures/vcr_cassettes/editor_interfaces/default_for_space.yml
548
548
  - spec/fixtures/vcr_cassettes/editor_interfaces/update.yml
549
+ - spec/fixtures/vcr_cassettes/editor_interfaces/update_sidebar.yml
549
550
  - spec/fixtures/vcr_cassettes/entry/all.yml
550
551
  - spec/fixtures/vcr_cassettes/entry/archive.yml
551
552
  - spec/fixtures/vcr_cassettes/entry/archive_published.yml
@@ -656,6 +657,7 @@ files:
656
657
  - spec/fixtures/vcr_cassettes/locale/update_name.yml
657
658
  - spec/fixtures/vcr_cassettes/organization/all.yml
658
659
  - spec/fixtures/vcr_cassettes/organization/user.yml
660
+ - spec/fixtures/vcr_cassettes/organization/users.yml
659
661
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/all.yml
660
662
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/filters.yml
661
663
  - spec/fixtures/vcr_cassettes/personal_access_token/all.yml
@@ -726,6 +728,7 @@ files:
726
728
  - spec/fixtures/vcr_cassettes/space/update.yml
727
729
  - spec/fixtures/vcr_cassettes/space/update_with_the_same_data.yml
728
730
  - spec/fixtures/vcr_cassettes/space/user.yml
731
+ - spec/fixtures/vcr_cassettes/space/users.yml
729
732
  - spec/fixtures/vcr_cassettes/space/webhook/all.yml
730
733
  - spec/fixtures/vcr_cassettes/space/webhook/create.yml
731
734
  - spec/fixtures/vcr_cassettes/space/webhook/find.yml
@@ -957,6 +960,7 @@ test_files:
957
960
  - spec/fixtures/vcr_cassettes/delete_request.yml
958
961
  - spec/fixtures/vcr_cassettes/editor_interfaces/default_for_space.yml
959
962
  - spec/fixtures/vcr_cassettes/editor_interfaces/update.yml
963
+ - spec/fixtures/vcr_cassettes/editor_interfaces/update_sidebar.yml
960
964
  - spec/fixtures/vcr_cassettes/entry/all.yml
961
965
  - spec/fixtures/vcr_cassettes/entry/archive.yml
962
966
  - spec/fixtures/vcr_cassettes/entry/archive_published.yml
@@ -1067,6 +1071,7 @@ test_files:
1067
1071
  - spec/fixtures/vcr_cassettes/locale/update_name.yml
1068
1072
  - spec/fixtures/vcr_cassettes/organization/all.yml
1069
1073
  - spec/fixtures/vcr_cassettes/organization/user.yml
1074
+ - spec/fixtures/vcr_cassettes/organization/users.yml
1070
1075
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/all.yml
1071
1076
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/filters.yml
1072
1077
  - spec/fixtures/vcr_cassettes/personal_access_token/all.yml
@@ -1137,6 +1142,7 @@ test_files:
1137
1142
  - spec/fixtures/vcr_cassettes/space/update.yml
1138
1143
  - spec/fixtures/vcr_cassettes/space/update_with_the_same_data.yml
1139
1144
  - spec/fixtures/vcr_cassettes/space/user.yml
1145
+ - spec/fixtures/vcr_cassettes/space/users.yml
1140
1146
  - spec/fixtures/vcr_cassettes/space/webhook/all.yml
1141
1147
  - spec/fixtures/vcr_cassettes/space/webhook/create.yml
1142
1148
  - spec/fixtures/vcr_cassettes/space/webhook/find.yml