contentful-management 2.12.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -457,6 +457,37 @@ module Contentful
457
457
  end
458
458
 
459
459
  describe 'issues' do
460
+ describe 'metadata and tags do not break entry fetching - #219' do
461
+ let(:space_id) { '2l3j7k267g9k' }
462
+ let(:space) { client.spaces.find(space_id) }
463
+ let(:environment) { space.environments.find('master') }
464
+ let(:asset_id) { '2lxYoWv3LWHe0yhO3w2Yid' }
465
+
466
+ it 'can load an entry with tags' do
467
+ vcr('asset/issue_219') {
468
+ expect {
469
+ entry = environment.assets.find(asset_id)
470
+ }.not_to raise_error
471
+ }
472
+ end
473
+
474
+ it 'hydrates tags' do
475
+ vcr('asset/issue_219') {
476
+ asset = environment.assets.find(asset_id)
477
+ expect(asset._metadata[:tags].first).to be_a Contentful::Management::Link
478
+ }
479
+ end
480
+
481
+ it 'loads tag links with their proper attributes' do
482
+ vcr('asset/issue_219') {
483
+ asset = environment.assets.find(asset_id)
484
+ tag = asset._metadata[:tags].first
485
+ expect(tag.id).to eq 'mobQa'
486
+ expect(tag.link_type).to eq 'Tag'
487
+ }
488
+ end
489
+ end
490
+
460
491
  describe "Pagination on assets doesn't work without first calling limit - #143" do
461
492
  it 'shouldnt break on next page without parameters on original query' do
462
493
  vcr('asset/143_assets_next_page') do
@@ -870,6 +870,35 @@ describe Contentful::Management::Entry do
870
870
  let(:space) { client.spaces.find(space_id) }
871
871
  let(:environment) { space.environments.find('master') }
872
872
 
873
+ describe 'metadata and tags do not break entry fetching - #219' do
874
+ let(:space_id) { '2l3j7k267g9k' }
875
+ let(:entry_id) { '2AtqG09C50s7kE66POudAV' }
876
+
877
+ it 'can load an entry with tags' do
878
+ vcr('entry/issue_219') {
879
+ expect {
880
+ entry = environment.entries.find(entry_id)
881
+ }.not_to raise_error
882
+ }
883
+ end
884
+
885
+ it 'hydrates tags' do
886
+ vcr('entry/issue_219') {
887
+ entry = environment.entries.find(entry_id)
888
+ expect(entry._metadata[:tags].first).to be_a Contentful::Management::Link
889
+ }
890
+ end
891
+
892
+ it 'loads tag links with their proper attributes' do
893
+ vcr('entry/issue_219') {
894
+ entry = environment.entries.find(entry_id)
895
+ tag = entry._metadata[:tags].first
896
+ expect(tag.id).to eq 'mobQa'
897
+ expect(tag.link_type).to eq 'Tag'
898
+ }
899
+ end
900
+ end
901
+
873
902
  describe 'json fields do not get reset on save - #215' do
874
903
  it 'can load a json array, modify it, save it, and retrieve it' do
875
904
  vcr('entry/issue_215_1') {
@@ -28,6 +28,36 @@ module Contentful
28
28
  expect { subject.find }.to raise_error 'Not supported'
29
29
  end
30
30
  end
31
+
32
+ describe "users" do
33
+ describe '.find' do
34
+ it "should fetch the user if under the organizaton id" do
35
+ vcr('organization/user') {
36
+ organization = subject.all.first
37
+ user = organization.users.find('user_id')
38
+
39
+ expect(user).to be_a Contentful::Management::User
40
+ expect(user.first_name).to eq 'Bhushan'
41
+ expect(user.last_name).to eq 'Lodha'
42
+ expect(user.email).to eq 'bhushanlodha@gmail.com'
43
+ expect(user.activated).to eq true
44
+ expect(user.confirmed).to eq true
45
+ expect(user.sign_in_count).to eq 42
46
+ expect(user.avatar_url).to be_truthy
47
+ }
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
59
+ end
60
+ end
31
61
  end
32
62
  end
33
63
  end
@@ -240,6 +240,36 @@ module Contentful
240
240
  }
241
241
  end
242
242
  end
243
+
244
+ describe "users" do
245
+ describe "find" do
246
+ it "should fetch the user if under the space id" do
247
+ vcr('space/user') {
248
+ space = subject.find('space_id')
249
+ user = space.users.find('user_id')
250
+
251
+ expect(user).to be_a Contentful::Management::User
252
+ expect(user.first_name).to eq 'Bhushan'
253
+ expect(user.last_name).to eq 'Test'
254
+ expect(user.email).to eq 'bhushanlodha@gmail.com'
255
+ expect(user.activated).to eq true
256
+ expect(user.confirmed).to eq true
257
+ expect(user.sign_in_count).to eq 42
258
+ expect(user.avatar_url).to be_truthy
259
+ }
260
+ end
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
272
+ end
243
273
  end
244
274
  end
245
275
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful-management
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Protas
8
8
  - Tomasz Warkocki
9
9
  - Contentful GmbH (Andreas Tiefenthaler)
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-07-02 00:00:00.000000000 Z
13
+ date: 2021-06-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -359,6 +359,7 @@ files:
359
359
  - lib/contentful/management/location.rb
360
360
  - lib/contentful/management/organization.rb
361
361
  - lib/contentful/management/organization_periodic_usage.rb
362
+ - lib/contentful/management/organization_user_methods_factory.rb
362
363
  - lib/contentful/management/personal_access_token.rb
363
364
  - lib/contentful/management/preview_api_key.rb
364
365
  - lib/contentful/management/request.rb
@@ -371,6 +372,7 @@ files:
371
372
  - lib/contentful/management/resource/environment_aware.rb
372
373
  - lib/contentful/management/resource/field_aware.rb
373
374
  - lib/contentful/management/resource/fields.rb
375
+ - lib/contentful/management/resource/metadata.rb
374
376
  - lib/contentful/management/resource/publisher.rb
375
377
  - lib/contentful/management/resource/refresher.rb
376
378
  - lib/contentful/management/resource/system_properties.rb
@@ -388,8 +390,10 @@ files:
388
390
  - lib/contentful/management/space_preview_api_key_methods_factory.rb
389
391
  - lib/contentful/management/space_role_methods_factory.rb
390
392
  - lib/contentful/management/space_space_membership_methods_factory.rb
393
+ - lib/contentful/management/space_user_methods_factory.rb
391
394
  - lib/contentful/management/space_webhook_methods_factory.rb
392
395
  - lib/contentful/management/support.rb
396
+ - lib/contentful/management/tag.rb
393
397
  - lib/contentful/management/ui_extension.rb
394
398
  - lib/contentful/management/upload.rb
395
399
  - lib/contentful/management/user.rb
@@ -449,6 +453,7 @@ files:
449
453
  - spec/fixtures/vcr_cassettes/asset/destroy_published.yml
450
454
  - spec/fixtures/vcr_cassettes/asset/find.yml
451
455
  - spec/fixtures/vcr_cassettes/asset/find_not_found.yml
456
+ - spec/fixtures/vcr_cassettes/asset/issue_219.yml
452
457
  - spec/fixtures/vcr_cassettes/asset/limited_assets_next_page.yml
453
458
  - spec/fixtures/vcr_cassettes/asset/locale.yml
454
459
  - spec/fixtures/vcr_cassettes/asset/process.yml
@@ -569,6 +574,7 @@ files:
569
574
  - spec/fixtures/vcr_cassettes/entry/issue_215_1.yml
570
575
  - spec/fixtures/vcr_cassettes/entry/issue_215_2.yml
571
576
  - spec/fixtures/vcr_cassettes/entry/issue_215_3.yml
577
+ - spec/fixtures/vcr_cassettes/entry/issue_219.yml
572
578
  - spec/fixtures/vcr_cassettes/entry/issue_61_1.yml
573
579
  - spec/fixtures/vcr_cassettes/entry/issue_61_2.yml
574
580
  - spec/fixtures/vcr_cassettes/entry/issue_61_3.yml
@@ -649,6 +655,8 @@ files:
649
655
  - spec/fixtures/vcr_cassettes/locale/update_code.yml
650
656
  - spec/fixtures/vcr_cassettes/locale/update_name.yml
651
657
  - spec/fixtures/vcr_cassettes/organization/all.yml
658
+ - spec/fixtures/vcr_cassettes/organization/user.yml
659
+ - spec/fixtures/vcr_cassettes/organization/users.yml
652
660
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/all.yml
653
661
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/filters.yml
654
662
  - spec/fixtures/vcr_cassettes/personal_access_token/all.yml
@@ -718,6 +726,8 @@ files:
718
726
  - spec/fixtures/vcr_cassettes/space/save_update_space.yml
719
727
  - spec/fixtures/vcr_cassettes/space/update.yml
720
728
  - spec/fixtures/vcr_cassettes/space/update_with_the_same_data.yml
729
+ - spec/fixtures/vcr_cassettes/space/user.yml
730
+ - spec/fixtures/vcr_cassettes/space/users.yml
721
731
  - spec/fixtures/vcr_cassettes/space/webhook/all.yml
722
732
  - spec/fixtures/vcr_cassettes/space/webhook/create.yml
723
733
  - spec/fixtures/vcr_cassettes/space/webhook/find.yml
@@ -787,7 +797,7 @@ homepage: https://github.com/contentful/contentful-management.rb
787
797
  licenses:
788
798
  - MIT
789
799
  metadata: {}
790
- post_install_message:
800
+ post_install_message:
791
801
  rdoc_options: []
792
802
  require_paths:
793
803
  - lib
@@ -802,8 +812,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
802
812
  - !ruby/object:Gem::Version
803
813
  version: '0'
804
814
  requirements: []
805
- rubygems_version: 3.1.2
806
- signing_key:
815
+ rubygems_version: 3.0.3
816
+ signing_key:
807
817
  specification_version: 4
808
818
  summary: contentful management api
809
819
  test_files:
@@ -856,6 +866,7 @@ test_files:
856
866
  - spec/fixtures/vcr_cassettes/asset/destroy_published.yml
857
867
  - spec/fixtures/vcr_cassettes/asset/find.yml
858
868
  - spec/fixtures/vcr_cassettes/asset/find_not_found.yml
869
+ - spec/fixtures/vcr_cassettes/asset/issue_219.yml
859
870
  - spec/fixtures/vcr_cassettes/asset/limited_assets_next_page.yml
860
871
  - spec/fixtures/vcr_cassettes/asset/locale.yml
861
872
  - spec/fixtures/vcr_cassettes/asset/process.yml
@@ -976,6 +987,7 @@ test_files:
976
987
  - spec/fixtures/vcr_cassettes/entry/issue_215_1.yml
977
988
  - spec/fixtures/vcr_cassettes/entry/issue_215_2.yml
978
989
  - spec/fixtures/vcr_cassettes/entry/issue_215_3.yml
990
+ - spec/fixtures/vcr_cassettes/entry/issue_219.yml
979
991
  - spec/fixtures/vcr_cassettes/entry/issue_61_1.yml
980
992
  - spec/fixtures/vcr_cassettes/entry/issue_61_2.yml
981
993
  - spec/fixtures/vcr_cassettes/entry/issue_61_3.yml
@@ -1056,6 +1068,8 @@ test_files:
1056
1068
  - spec/fixtures/vcr_cassettes/locale/update_code.yml
1057
1069
  - spec/fixtures/vcr_cassettes/locale/update_name.yml
1058
1070
  - spec/fixtures/vcr_cassettes/organization/all.yml
1071
+ - spec/fixtures/vcr_cassettes/organization/user.yml
1072
+ - spec/fixtures/vcr_cassettes/organization/users.yml
1059
1073
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/all.yml
1060
1074
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/filters.yml
1061
1075
  - spec/fixtures/vcr_cassettes/personal_access_token/all.yml
@@ -1125,6 +1139,8 @@ test_files:
1125
1139
  - spec/fixtures/vcr_cassettes/space/save_update_space.yml
1126
1140
  - spec/fixtures/vcr_cassettes/space/update.yml
1127
1141
  - spec/fixtures/vcr_cassettes/space/update_with_the_same_data.yml
1142
+ - spec/fixtures/vcr_cassettes/space/user.yml
1143
+ - spec/fixtures/vcr_cassettes/space/users.yml
1128
1144
  - spec/fixtures/vcr_cassettes/space/webhook/all.yml
1129
1145
  - spec/fixtures/vcr_cassettes/space/webhook/create.yml
1130
1146
  - spec/fixtures/vcr_cassettes/space/webhook/find.yml