contentful-management 1.8.1 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +15 -0
  4. data/README.md +209 -41
  5. data/contentful-management.gemspec +1 -1
  6. data/lib/contentful/management/asset.rb +1 -1
  7. data/lib/contentful/management/client.rb +155 -31
  8. data/lib/contentful/management/client_organization_methods_factory.rb +23 -0
  9. data/lib/contentful/management/client_personal_access_tokens_methods_factory.rb +27 -0
  10. data/lib/contentful/management/client_snapshot_methods_factory.rb +16 -6
  11. data/lib/contentful/management/client_space_membership_methods_factory.rb +15 -0
  12. data/lib/contentful/management/client_ui_extension_methods_factory.rb +15 -0
  13. data/lib/contentful/management/client_user_methods_factory.rb +27 -0
  14. data/lib/contentful/management/client_webhook_call_methods_factory.rb +30 -0
  15. data/lib/contentful/management/client_webhook_health_methods_factory.rb +27 -0
  16. data/lib/contentful/management/content_type.rb +10 -0
  17. data/lib/contentful/management/content_type_snapshot_methods_factory.rb +35 -0
  18. data/lib/contentful/management/editor_interface.rb +1 -1
  19. data/lib/contentful/management/organization.rb +20 -0
  20. data/lib/contentful/management/personal_access_token.rb +45 -0
  21. data/lib/contentful/management/request.rb +0 -1
  22. data/lib/contentful/management/resource.rb +4 -2
  23. data/lib/contentful/management/resource_builder.rb +15 -0
  24. data/lib/contentful/management/snapshot.rb +31 -20
  25. data/lib/contentful/management/space.rb +32 -10
  26. data/lib/contentful/management/space_membership.rb +43 -0
  27. data/lib/contentful/management/space_space_membership_methods_factory.rb +15 -0
  28. data/lib/contentful/management/space_ui_extension_methods_factory.rb +15 -0
  29. data/lib/contentful/management/ui_extension.rb +106 -0
  30. data/lib/contentful/management/user.rb +28 -0
  31. data/lib/contentful/management/version.rb +1 -1
  32. data/lib/contentful/management/webhook.rb +20 -0
  33. data/lib/contentful/management/webhook_call.rb +77 -0
  34. data/lib/contentful/management/webhook_health.rb +79 -0
  35. data/lib/contentful/management/webhook_webhook_call_methods_factory.rb +30 -0
  36. data/lib/contentful/management/webhook_webhook_health_methods_factory.rb +28 -0
  37. data/spec/fixtures/vcr_cassettes/get_request.yml +34 -17
  38. data/spec/fixtures/vcr_cassettes/organization/all.yml +100 -0
  39. data/spec/fixtures/vcr_cassettes/personal_access_token/all.yml +101 -0
  40. data/spec/fixtures/vcr_cassettes/personal_access_token/create.yml +94 -0
  41. data/spec/fixtures/vcr_cassettes/personal_access_token/find.yml +91 -0
  42. data/spec/fixtures/vcr_cassettes/personal_access_token/find_not_found.yml +88 -0
  43. data/spec/fixtures/vcr_cassettes/personal_access_token/revoke.yml +179 -0
  44. data/spec/fixtures/vcr_cassettes/snapshot/ct_all.yml +207 -0
  45. data/spec/fixtures/vcr_cassettes/snapshot/ct_find.yml +198 -0
  46. data/spec/fixtures/vcr_cassettes/snapshot/ct_find_not_found.yml +94 -0
  47. data/spec/fixtures/vcr_cassettes/space/all_disabled_cache.yml +428 -0
  48. data/spec/fixtures/vcr_cassettes/space/disabled_cache.yml +120 -0
  49. data/spec/fixtures/vcr_cassettes/space_memberships/all.yml +190 -0
  50. data/spec/fixtures/vcr_cassettes/space_memberships/create.yml +143 -0
  51. data/spec/fixtures/vcr_cassettes/space_memberships/delete.yml +322 -0
  52. data/spec/fixtures/vcr_cassettes/space_memberships/find.yml +141 -0
  53. data/spec/fixtures/vcr_cassettes/ui_extension/all.yml +1020 -0
  54. data/spec/fixtures/vcr_cassettes/ui_extension/create.yml +133 -0
  55. data/spec/fixtures/vcr_cassettes/ui_extension/delete.yml +291 -0
  56. data/spec/fixtures/vcr_cassettes/ui_extension/find.yml +126 -0
  57. data/spec/fixtures/vcr_cassettes/user/find.yml +96 -0
  58. data/spec/fixtures/vcr_cassettes/webhook_call/all.yml +151 -0
  59. data/spec/fixtures/vcr_cassettes/webhook_call/find.yml +88 -0
  60. data/spec/fixtures/vcr_cassettes/webhook_call/find_not_found.yml +93 -0
  61. data/spec/fixtures/vcr_cassettes/webhook_health/find.yml +111 -0
  62. data/spec/lib/contentful/management/client_spec.rb +25 -26
  63. data/spec/lib/contentful/management/entry_spec.rb +48 -48
  64. data/spec/lib/contentful/management/organization_spec.rb +33 -0
  65. data/spec/lib/contentful/management/personal_access_token_spec.rb +85 -0
  66. data/spec/lib/contentful/management/snapshot_spec.rb +134 -47
  67. data/spec/lib/contentful/management/space_membership_spec.rb +147 -0
  68. data/spec/lib/contentful/management/space_spec.rb +35 -1
  69. data/spec/lib/contentful/management/ui_extension_spec.rb +276 -0
  70. data/spec/lib/contentful/management/user_spec.rb +52 -0
  71. data/spec/lib/contentful/management/webhook_calls_spec.rb +69 -0
  72. data/spec/lib/contentful/management/webhook_health_spec.rb +51 -0
  73. metadata +88 -8
  74. data/lib/contentful/management/http_client.rb +0 -89
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+ require 'contentful/management/space'
3
+ require 'contentful/management/client'
4
+
5
+ module Contentful
6
+ module Management
7
+ describe User do
8
+ let(:token) { ENV.fetch('CF_TEST_CMA_TOKEN', '<ACCESS_TOKEN>') }
9
+ let!(:client) { Client.new(token) }
10
+
11
+ subject { client.users }
12
+
13
+ describe '.all' do
14
+ it 'is not supported' do
15
+ expect { subject.all }.to raise_error 'Not supported'
16
+ end
17
+ end
18
+
19
+ describe '.find' do
20
+ it 'fetches the current user' do
21
+ vcr('user/find') {
22
+ user = subject.find('me')
23
+ expect(user).to be_a Contentful::Management::User
24
+ expect(user.first_name).to eq 'David'
25
+ expect(user.last_name).to eq 'Test'
26
+ expect(user.email).to eq 'david.test@testytest.com'
27
+ expect(user.activated).to eq true
28
+ expect(user.confirmed).to eq true
29
+ expect(user.sign_in_count).to eq 26
30
+ expect(user.avatar_url).to be_truthy
31
+ }
32
+ end
33
+ end
34
+
35
+ describe '.me' do
36
+ it 'is an alias to .find("me")' do
37
+ vcr('user/find') {
38
+ user = subject.me
39
+ expect(user).to be_a Contentful::Management::User
40
+ expect(user.first_name).to eq 'David'
41
+ expect(user.last_name).to eq 'Test'
42
+ expect(user.email).to eq 'david.test@testytest.com'
43
+ expect(user.activated).to eq true
44
+ expect(user.confirmed).to eq true
45
+ expect(user.sign_in_count).to eq 26
46
+ expect(user.avatar_url).to be_truthy
47
+ }
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+ require 'contentful/management/space'
3
+ require 'contentful/management/client'
4
+
5
+ module Contentful
6
+ module Management
7
+ describe WebhookCall do
8
+ let(:token) { ENV.fetch('CF_TEST_CMA_TOKEN', '<ACCESS_TOKEN>') }
9
+ let(:space_id) { 'orzkxlxlq59d' }
10
+ let(:webhook_id) { '16ypL3XjNK6oreLPPoVBxI' }
11
+ let(:webhook_call_id) { '6r2EQ0iVBmYyyq0UMWKoge' }
12
+ let!(:client) { Client.new(token) }
13
+
14
+ subject { client.webhook_calls }
15
+
16
+ describe '.all' do
17
+ it 'class method also works' do
18
+ vcr('webhook_call/all') { expect(Contentful::Management::WebhookCall.all(client, space_id, webhook_id)).to be_kind_of Contentful::Management::Array }
19
+ end
20
+ it 'returns a Contentful::Array' do
21
+ vcr('webhook_call/all') { expect(subject.all(space_id, webhook_id)).to be_kind_of Contentful::Management::Array }
22
+ end
23
+ it 'builds a Contentful::Management::WebhookCall object' do
24
+ vcr('webhook_call/all') {
25
+ webhook_call = subject.all(space_id, webhook_id).first
26
+
27
+ expect(webhook_call).to be_kind_of Contentful::Management::WebhookCall
28
+ expect(webhook_call.id).to be_truthy
29
+ expect(webhook_call.status_code).to eq 201
30
+ expect(webhook_call.event_type).to eq "publish"
31
+ expect(webhook_call.errors).to be_empty
32
+ expect(webhook_call.response_at).to be_truthy
33
+ expect(webhook_call.url).to eq "https://circleci.com/api/v1/project/virgendeloreto/blog_source/tree/master?circle-token=foobar"
34
+ expect(webhook_call.request_at).to be_truthy
35
+ }
36
+ end
37
+ end
38
+
39
+ describe '.find' do
40
+ it 'class method also works' do
41
+ vcr('webhook_call/find') { expect(Contentful::Management::WebhookCall.find(client, space_id, webhook_id, webhook_call_id)).to be_kind_of Contentful::Management::WebhookCall }
42
+ end
43
+ it 'returns a Contentful::Management::WebhookCall' do
44
+ vcr('webhook_call/find') { expect(subject.find(space_id, webhook_id, webhook_call_id)).to be_kind_of Contentful::Management::WebhookCall }
45
+ end
46
+ it 'returns webhook for a given id' do
47
+ vcr('webhook_call/find') do
48
+ webhook_call = subject.find(space_id, webhook_id, webhook_call_id)
49
+ expect(webhook_call.id).to eq webhook_call_id
50
+ expect(webhook_call.status_code).to eq 201
51
+ expect(webhook_call.event_type).to eq "publish"
52
+ expect(webhook_call.errors).to be_empty
53
+ expect(webhook_call.response_at).to be_truthy
54
+ expect(webhook_call.url).to be_truthy
55
+ expect(webhook_call.request_at).to be_truthy
56
+ expect(webhook_call.request).to be_truthy
57
+ expect(webhook_call.response).to be_truthy
58
+ end
59
+ end
60
+ it 'returns an error when call does not exists' do
61
+ vcr('webhook_call/find_not_found') do
62
+ result = subject.find(space_id, webhook_id, 'not_exist')
63
+ expect(result).to be_kind_of Contentful::Management::NotFound
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+ require 'contentful/management/space'
3
+ require 'contentful/management/client'
4
+
5
+ module Contentful
6
+ module Management
7
+ describe WebhookHealth do
8
+ let(:token) { ENV.fetch('CF_TEST_CMA_TOKEN', '<ACCESS_TOKEN>') }
9
+ let(:space_id) { 'orzkxlxlq59d' }
10
+ let(:webhook_id) { '16ypL3XjNK6oreLPPoVBxI' }
11
+ let!(:client) { Client.new(token) }
12
+
13
+ subject { client.webhook_health }
14
+
15
+ describe '.all' do
16
+ it 'is not supported' do
17
+ expect { subject.all }.to raise_error 'Not supported'
18
+ end
19
+ end
20
+
21
+ describe '.find' do
22
+ it 'class method also works' do
23
+ vcr('webhook_health/find') {
24
+ expect(Contentful::Management::WebhookHealth.find(
25
+ client,
26
+ space_id,
27
+ webhook_id
28
+ )).to be_kind_of Contentful::Management::WebhookHealth
29
+ }
30
+ end
31
+ it 'returns a Contentful::Management::WebhookHealth' do
32
+ vcr('webhook_health/find') { expect(subject.find(space_id, webhook_id)).to be_kind_of Contentful::Management::WebhookHealth }
33
+ end
34
+ it 'returns webhook for a given id' do
35
+ vcr('webhook_health/find') do
36
+ webhook_health = subject.find(space_id, webhook_id)
37
+ expect(webhook_health.calls).to be_a ::Hash
38
+
39
+ expect(webhook_health.calls['total']).to eq 2
40
+ expect(webhook_health.calls['healthy']).to eq 2
41
+
42
+ expect(webhook_health.healthy).to eq 2
43
+ expect(webhook_health.total).to eq 2
44
+ expect(webhook_health.errors?).to eq false
45
+ expect(webhook_health.healthy?).to eq true
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ 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: 1.8.1
4
+ version: 1.9.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: 2017-07-05 00:00:00.000000000 Z
13
+ date: 2017-10-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -204,16 +204,16 @@ dependencies:
204
204
  name: listen
205
205
  requirement: !ruby/object:Gem::Requirement
206
206
  requirements:
207
- - - '='
207
+ - - "~>"
208
208
  - !ruby/object:Gem::Version
209
- version: 3.0.0
209
+ version: '3.0'
210
210
  type: :development
211
211
  prerelease: false
212
212
  version_requirements: !ruby/object:Gem::Requirement
213
213
  requirements:
214
- - - '='
214
+ - - "~>"
215
215
  - !ruby/object:Gem::Version
216
- version: 3.0.0
216
+ version: '3.0'
217
217
  - !ruby/object:Gem::Dependency
218
218
  name: vcr
219
219
  requirement: !ruby/object:Gem::Requirement
@@ -304,14 +304,22 @@ files:
304
304
  - lib/contentful/management/client_editor_interface_methods_factory.rb
305
305
  - lib/contentful/management/client_entry_methods_factory.rb
306
306
  - lib/contentful/management/client_locale_methods_factory.rb
307
+ - lib/contentful/management/client_organization_methods_factory.rb
308
+ - lib/contentful/management/client_personal_access_tokens_methods_factory.rb
307
309
  - lib/contentful/management/client_role_methods_factory.rb
308
310
  - lib/contentful/management/client_snapshot_methods_factory.rb
311
+ - lib/contentful/management/client_space_membership_methods_factory.rb
309
312
  - lib/contentful/management/client_space_methods_factory.rb
313
+ - lib/contentful/management/client_ui_extension_methods_factory.rb
310
314
  - lib/contentful/management/client_upload_methods_factory.rb
315
+ - lib/contentful/management/client_user_methods_factory.rb
316
+ - lib/contentful/management/client_webhook_call_methods_factory.rb
317
+ - lib/contentful/management/client_webhook_health_methods_factory.rb
311
318
  - lib/contentful/management/client_webhook_methods_factory.rb
312
319
  - lib/contentful/management/content_type.rb
313
320
  - lib/contentful/management/content_type_editor_interface_methods_factory.rb
314
321
  - lib/contentful/management/content_type_entry_methods_factory.rb
322
+ - lib/contentful/management/content_type_snapshot_methods_factory.rb
315
323
  - lib/contentful/management/dynamic_entry.rb
316
324
  - lib/contentful/management/editor_interface.rb
317
325
  - lib/contentful/management/entry.rb
@@ -320,10 +328,11 @@ files:
320
328
  - lib/contentful/management/error.rb
321
329
  - lib/contentful/management/field.rb
322
330
  - lib/contentful/management/file.rb
323
- - lib/contentful/management/http_client.rb
324
331
  - lib/contentful/management/link.rb
325
332
  - lib/contentful/management/locale.rb
326
333
  - lib/contentful/management/location.rb
334
+ - lib/contentful/management/organization.rb
335
+ - lib/contentful/management/personal_access_token.rb
327
336
  - lib/contentful/management/request.rb
328
337
  - lib/contentful/management/resource.rb
329
338
  - lib/contentful/management/resource/all_published.rb
@@ -350,13 +359,22 @@ files:
350
359
  - lib/contentful/management/space_editor_interface_methods_factory.rb
351
360
  - lib/contentful/management/space_entry_methods_factory.rb
352
361
  - lib/contentful/management/space_locale_methods_factory.rb
362
+ - lib/contentful/management/space_membership.rb
353
363
  - lib/contentful/management/space_role_methods_factory.rb
364
+ - lib/contentful/management/space_space_membership_methods_factory.rb
365
+ - lib/contentful/management/space_ui_extension_methods_factory.rb
354
366
  - lib/contentful/management/space_webhook_methods_factory.rb
355
367
  - lib/contentful/management/support.rb
368
+ - lib/contentful/management/ui_extension.rb
356
369
  - lib/contentful/management/upload.rb
370
+ - lib/contentful/management/user.rb
357
371
  - lib/contentful/management/validation.rb
358
372
  - lib/contentful/management/version.rb
359
373
  - lib/contentful/management/webhook.rb
374
+ - lib/contentful/management/webhook_call.rb
375
+ - lib/contentful/management/webhook_health.rb
376
+ - lib/contentful/management/webhook_webhook_call_methods_factory.rb
377
+ - lib/contentful/management/webhook_webhook_health_methods_factory.rb
360
378
  - spec/fixtures/pixel.jpg
361
379
  - spec/fixtures/vcr_cassettes/api_key/all_for_space.yml
362
380
  - spec/fixtures/vcr_cassettes/api_key/create_for_space.yml
@@ -554,6 +572,12 @@ files:
554
572
  - spec/fixtures/vcr_cassettes/locale/update_both.yml
555
573
  - spec/fixtures/vcr_cassettes/locale/update_code.yml
556
574
  - spec/fixtures/vcr_cassettes/locale/update_name.yml
575
+ - spec/fixtures/vcr_cassettes/organization/all.yml
576
+ - spec/fixtures/vcr_cassettes/personal_access_token/all.yml
577
+ - spec/fixtures/vcr_cassettes/personal_access_token/create.yml
578
+ - spec/fixtures/vcr_cassettes/personal_access_token/find.yml
579
+ - spec/fixtures/vcr_cassettes/personal_access_token/find_not_found.yml
580
+ - spec/fixtures/vcr_cassettes/personal_access_token/revoke.yml
557
581
  - spec/fixtures/vcr_cassettes/post_request.yml
558
582
  - spec/fixtures/vcr_cassettes/proxy_request.yml
559
583
  - spec/fixtures/vcr_cassettes/put_request.yml
@@ -564,10 +588,14 @@ files:
564
588
  - spec/fixtures/vcr_cassettes/roles/find_for_space_not_found.yml
565
589
  - spec/fixtures/vcr_cassettes/roles/update.yml
566
590
  - spec/fixtures/vcr_cassettes/snapshot/all.yml
591
+ - spec/fixtures/vcr_cassettes/snapshot/ct_all.yml
592
+ - spec/fixtures/vcr_cassettes/snapshot/ct_find.yml
593
+ - spec/fixtures/vcr_cassettes/snapshot/ct_find_not_found.yml
567
594
  - spec/fixtures/vcr_cassettes/snapshot/find.yml
568
595
  - spec/fixtures/vcr_cassettes/snapshot/find_not_found.yml
569
596
  - spec/fixtures/vcr_cassettes/snapshot/properties.yml
570
597
  - spec/fixtures/vcr_cassettes/space/all.yml
598
+ - spec/fixtures/vcr_cassettes/space/all_disabled_cache.yml
571
599
  - spec/fixtures/vcr_cassettes/space/api_key/all.yml
572
600
  - spec/fixtures/vcr_cassettes/space/api_key/create.yml
573
601
  - spec/fixtures/vcr_cassettes/space/api_key/find.yml
@@ -589,6 +617,7 @@ files:
589
617
  - spec/fixtures/vcr_cassettes/space/create_with_unknown_organization.yml
590
618
  - spec/fixtures/vcr_cassettes/space/create_without_organization.yml
591
619
  - spec/fixtures/vcr_cassettes/space/destory.yml
620
+ - spec/fixtures/vcr_cassettes/space/disabled_cache.yml
592
621
  - spec/fixtures/vcr_cassettes/space/entry/all.yml
593
622
  - spec/fixtures/vcr_cassettes/space/entry/all_public.yml
594
623
  - spec/fixtures/vcr_cassettes/space/entry/content_type_entires.yml
@@ -612,12 +641,21 @@ files:
612
641
  - spec/fixtures/vcr_cassettes/space/webhook/all.yml
613
642
  - spec/fixtures/vcr_cassettes/space/webhook/create.yml
614
643
  - spec/fixtures/vcr_cassettes/space/webhook/find.yml
644
+ - spec/fixtures/vcr_cassettes/space_memberships/all.yml
645
+ - spec/fixtures/vcr_cassettes/space_memberships/create.yml
646
+ - spec/fixtures/vcr_cassettes/space_memberships/delete.yml
647
+ - spec/fixtures/vcr_cassettes/space_memberships/find.yml
648
+ - spec/fixtures/vcr_cassettes/ui_extension/all.yml
649
+ - spec/fixtures/vcr_cassettes/ui_extension/create.yml
650
+ - spec/fixtures/vcr_cassettes/ui_extension/delete.yml
651
+ - spec/fixtures/vcr_cassettes/ui_extension/find.yml
615
652
  - spec/fixtures/vcr_cassettes/upload/associate_with_asset.yml
616
653
  - spec/fixtures/vcr_cassettes/upload/create_file.yml
617
654
  - spec/fixtures/vcr_cassettes/upload/create_path.yml
618
655
  - spec/fixtures/vcr_cassettes/upload/destroy.yml
619
656
  - spec/fixtures/vcr_cassettes/upload/find.yml
620
657
  - spec/fixtures/vcr_cassettes/upload/find_not_found.yml
658
+ - spec/fixtures/vcr_cassettes/user/find.yml
621
659
  - spec/fixtures/vcr_cassettes/webhook/all.yml
622
660
  - spec/fixtures/vcr_cassettes/webhook/create.yml
623
661
  - spec/fixtures/vcr_cassettes/webhook/create_with_name_and_headers.yml
@@ -627,6 +665,10 @@ files:
627
665
  - spec/fixtures/vcr_cassettes/webhook/find_not_found.yml
628
666
  - spec/fixtures/vcr_cassettes/webhook/topics.yml
629
667
  - spec/fixtures/vcr_cassettes/webhook/update.yml
668
+ - spec/fixtures/vcr_cassettes/webhook_call/all.yml
669
+ - spec/fixtures/vcr_cassettes/webhook_call/find.yml
670
+ - spec/fixtures/vcr_cassettes/webhook_call/find_not_found.yml
671
+ - spec/fixtures/vcr_cassettes/webhook_health/find.yml
630
672
  - spec/lib/contentful/management/api_key_spec.rb
631
673
  - spec/lib/contentful/management/array_spec.rb
632
674
  - spec/lib/contentful/management/asset_spec.rb
@@ -635,10 +677,17 @@ files:
635
677
  - spec/lib/contentful/management/editor_interface_spec.rb
636
678
  - spec/lib/contentful/management/entry_spec.rb
637
679
  - spec/lib/contentful/management/locale_spec.rb
680
+ - spec/lib/contentful/management/organization_spec.rb
681
+ - spec/lib/contentful/management/personal_access_token_spec.rb
638
682
  - spec/lib/contentful/management/role_spec.rb
639
683
  - spec/lib/contentful/management/snapshot_spec.rb
684
+ - spec/lib/contentful/management/space_membership_spec.rb
640
685
  - spec/lib/contentful/management/space_spec.rb
686
+ - spec/lib/contentful/management/ui_extension_spec.rb
641
687
  - spec/lib/contentful/management/upload_spec.rb
688
+ - spec/lib/contentful/management/user_spec.rb
689
+ - spec/lib/contentful/management/webhook_calls_spec.rb
690
+ - spec/lib/contentful/management/webhook_health_spec.rb
642
691
  - spec/lib/contentful/management/webhook_spec.rb
643
692
  - spec/spec_helper.rb
644
693
  - spec/support/vcr.rb
@@ -662,7 +711,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
662
711
  version: '0'
663
712
  requirements: []
664
713
  rubyforge_project:
665
- rubygems_version: 2.6.12
714
+ rubygems_version: 2.6.11
666
715
  signing_key:
667
716
  specification_version: 4
668
717
  summary: contentful management api
@@ -864,6 +913,12 @@ test_files:
864
913
  - spec/fixtures/vcr_cassettes/locale/update_both.yml
865
914
  - spec/fixtures/vcr_cassettes/locale/update_code.yml
866
915
  - spec/fixtures/vcr_cassettes/locale/update_name.yml
916
+ - spec/fixtures/vcr_cassettes/organization/all.yml
917
+ - spec/fixtures/vcr_cassettes/personal_access_token/all.yml
918
+ - spec/fixtures/vcr_cassettes/personal_access_token/create.yml
919
+ - spec/fixtures/vcr_cassettes/personal_access_token/find.yml
920
+ - spec/fixtures/vcr_cassettes/personal_access_token/find_not_found.yml
921
+ - spec/fixtures/vcr_cassettes/personal_access_token/revoke.yml
867
922
  - spec/fixtures/vcr_cassettes/post_request.yml
868
923
  - spec/fixtures/vcr_cassettes/proxy_request.yml
869
924
  - spec/fixtures/vcr_cassettes/put_request.yml
@@ -874,10 +929,14 @@ test_files:
874
929
  - spec/fixtures/vcr_cassettes/roles/find_for_space_not_found.yml
875
930
  - spec/fixtures/vcr_cassettes/roles/update.yml
876
931
  - spec/fixtures/vcr_cassettes/snapshot/all.yml
932
+ - spec/fixtures/vcr_cassettes/snapshot/ct_all.yml
933
+ - spec/fixtures/vcr_cassettes/snapshot/ct_find.yml
934
+ - spec/fixtures/vcr_cassettes/snapshot/ct_find_not_found.yml
877
935
  - spec/fixtures/vcr_cassettes/snapshot/find.yml
878
936
  - spec/fixtures/vcr_cassettes/snapshot/find_not_found.yml
879
937
  - spec/fixtures/vcr_cassettes/snapshot/properties.yml
880
938
  - spec/fixtures/vcr_cassettes/space/all.yml
939
+ - spec/fixtures/vcr_cassettes/space/all_disabled_cache.yml
881
940
  - spec/fixtures/vcr_cassettes/space/api_key/all.yml
882
941
  - spec/fixtures/vcr_cassettes/space/api_key/create.yml
883
942
  - spec/fixtures/vcr_cassettes/space/api_key/find.yml
@@ -899,6 +958,7 @@ test_files:
899
958
  - spec/fixtures/vcr_cassettes/space/create_with_unknown_organization.yml
900
959
  - spec/fixtures/vcr_cassettes/space/create_without_organization.yml
901
960
  - spec/fixtures/vcr_cassettes/space/destory.yml
961
+ - spec/fixtures/vcr_cassettes/space/disabled_cache.yml
902
962
  - spec/fixtures/vcr_cassettes/space/entry/all.yml
903
963
  - spec/fixtures/vcr_cassettes/space/entry/all_public.yml
904
964
  - spec/fixtures/vcr_cassettes/space/entry/content_type_entires.yml
@@ -922,12 +982,21 @@ test_files:
922
982
  - spec/fixtures/vcr_cassettes/space/webhook/all.yml
923
983
  - spec/fixtures/vcr_cassettes/space/webhook/create.yml
924
984
  - spec/fixtures/vcr_cassettes/space/webhook/find.yml
985
+ - spec/fixtures/vcr_cassettes/space_memberships/all.yml
986
+ - spec/fixtures/vcr_cassettes/space_memberships/create.yml
987
+ - spec/fixtures/vcr_cassettes/space_memberships/delete.yml
988
+ - spec/fixtures/vcr_cassettes/space_memberships/find.yml
989
+ - spec/fixtures/vcr_cassettes/ui_extension/all.yml
990
+ - spec/fixtures/vcr_cassettes/ui_extension/create.yml
991
+ - spec/fixtures/vcr_cassettes/ui_extension/delete.yml
992
+ - spec/fixtures/vcr_cassettes/ui_extension/find.yml
925
993
  - spec/fixtures/vcr_cassettes/upload/associate_with_asset.yml
926
994
  - spec/fixtures/vcr_cassettes/upload/create_file.yml
927
995
  - spec/fixtures/vcr_cassettes/upload/create_path.yml
928
996
  - spec/fixtures/vcr_cassettes/upload/destroy.yml
929
997
  - spec/fixtures/vcr_cassettes/upload/find.yml
930
998
  - spec/fixtures/vcr_cassettes/upload/find_not_found.yml
999
+ - spec/fixtures/vcr_cassettes/user/find.yml
931
1000
  - spec/fixtures/vcr_cassettes/webhook/all.yml
932
1001
  - spec/fixtures/vcr_cassettes/webhook/create.yml
933
1002
  - spec/fixtures/vcr_cassettes/webhook/create_with_name_and_headers.yml
@@ -937,6 +1006,10 @@ test_files:
937
1006
  - spec/fixtures/vcr_cassettes/webhook/find_not_found.yml
938
1007
  - spec/fixtures/vcr_cassettes/webhook/topics.yml
939
1008
  - spec/fixtures/vcr_cassettes/webhook/update.yml
1009
+ - spec/fixtures/vcr_cassettes/webhook_call/all.yml
1010
+ - spec/fixtures/vcr_cassettes/webhook_call/find.yml
1011
+ - spec/fixtures/vcr_cassettes/webhook_call/find_not_found.yml
1012
+ - spec/fixtures/vcr_cassettes/webhook_health/find.yml
940
1013
  - spec/lib/contentful/management/api_key_spec.rb
941
1014
  - spec/lib/contentful/management/array_spec.rb
942
1015
  - spec/lib/contentful/management/asset_spec.rb
@@ -945,10 +1018,17 @@ test_files:
945
1018
  - spec/lib/contentful/management/editor_interface_spec.rb
946
1019
  - spec/lib/contentful/management/entry_spec.rb
947
1020
  - spec/lib/contentful/management/locale_spec.rb
1021
+ - spec/lib/contentful/management/organization_spec.rb
1022
+ - spec/lib/contentful/management/personal_access_token_spec.rb
948
1023
  - spec/lib/contentful/management/role_spec.rb
949
1024
  - spec/lib/contentful/management/snapshot_spec.rb
1025
+ - spec/lib/contentful/management/space_membership_spec.rb
950
1026
  - spec/lib/contentful/management/space_spec.rb
1027
+ - spec/lib/contentful/management/ui_extension_spec.rb
951
1028
  - spec/lib/contentful/management/upload_spec.rb
1029
+ - spec/lib/contentful/management/user_spec.rb
1030
+ - spec/lib/contentful/management/webhook_calls_spec.rb
1031
+ - spec/lib/contentful/management/webhook_health_spec.rb
952
1032
  - spec/lib/contentful/management/webhook_spec.rb
953
1033
  - spec/spec_helper.rb
954
1034
  - spec/support/vcr.rb
@@ -1,89 +0,0 @@
1
- module Contentful
2
- module Management
3
- # Thin HTTP Client with Restful Operations
4
- module HTTPClient
5
- # Get Request
6
- #
7
- # @param [String] url
8
- # @param [Hash] query
9
- # @param [Hash] headers
10
- #
11
- # @return [HTTP::Response]
12
- def get_http(url, query, headers = {}, proxy = {})
13
- http_send(:get, url, { params: query }, headers, proxy)
14
- end
15
-
16
- # Post Request
17
- #
18
- # @param [String] url
19
- # @param [Hash] params
20
- # @param [Hash] headers
21
- #
22
- # @return [HTTP::Response]
23
- def post_http(url, params, headers = {}, proxy = {})
24
- data = if url.include?(Client::DEFAULT_CONFIGURATION[:uploads_url])
25
- { body: params }
26
- else
27
- { json: params }
28
- end
29
-
30
- http_send(:post, url, data, headers, proxy)
31
- end
32
-
33
- # Delete Request
34
- #
35
- # @param [String] url
36
- # @param [Hash] params
37
- # @param [Hash] headers
38
- #
39
- # @return [HTTP::Response]
40
- def delete_http(url, params, headers = {}, proxy = {})
41
- http_send(:delete, url, { params: params }, headers, proxy)
42
- end
43
-
44
- # Put Request
45
- #
46
- # @param [String] url
47
- # @param [Hash] params
48
- # @param [Hash] headers
49
- #
50
- # @return [HTTP::Response]
51
- def put_http(url, params, headers = {}, proxy = {})
52
- http_send(:put, url, { json: params }, headers, proxy)
53
- end
54
-
55
- # Proxy Helper
56
- #
57
- # @param [Symbol] type
58
- # @param [String] url
59
- # @param [Hash] params
60
- # @param [Hash] headers
61
- # @param [Hash] proxy
62
- #
63
- # @return [HTTP::Response]
64
- def proxy_send(type, url, params, headers, proxy)
65
- HTTP[headers].via(
66
- proxy[:host],
67
- proxy[:port],
68
- proxy[:username],
69
- proxy[:password]
70
- ).public_send(type, url, params)
71
- end
72
-
73
- # HTTP Helper
74
- # Abtracts the Proxy/No-Proxy logic
75
- #
76
- # @param [Symbol] type
77
- # @param [String] url
78
- # @param [Hash] params
79
- # @param [Hash] headers
80
- # @param [Hash] proxy
81
- #
82
- # @return [HTTP::Response]
83
- def http_send(type, url, params, headers, proxy)
84
- return proxy_send(type, url, params, headers, proxy) unless proxy[:host].nil?
85
- HTTP[headers].public_send(type, url, params)
86
- end
87
- end
88
- end
89
- end