contentful-management 1.10.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +48 -0
- data/README.md +92 -50
- data/lib/contentful/management/api_key.rb +25 -2
- data/lib/contentful/management/array.rb +3 -3
- data/lib/contentful/management/asset.rb +13 -8
- data/lib/contentful/management/client.rb +73 -60
- data/lib/contentful/management/client_api_key_methods_factory.rb +8 -0
- data/lib/contentful/management/client_asset_methods_factory.rb +0 -2
- data/lib/contentful/management/client_association_all_published_method_factory.rb +2 -3
- data/lib/contentful/management/client_association_methods_factory.rb +9 -9
- data/lib/contentful/management/client_content_type_methods_factory.rb +8 -2
- data/lib/contentful/management/client_editor_interface_methods_factory.rb +12 -6
- data/lib/contentful/management/client_entry_methods_factory.rb +1 -3
- data/lib/contentful/management/client_environment_methods_factory.rb +59 -0
- data/lib/contentful/management/client_organization_methods_factory.rb +1 -1
- data/lib/contentful/management/client_personal_access_tokens_methods_factory.rb +3 -3
- data/lib/contentful/management/client_role_methods_factory.rb +8 -0
- data/lib/contentful/management/client_snapshot_methods_factory.rb +8 -6
- data/lib/contentful/management/client_space_methods_factory.rb +2 -6
- data/lib/contentful/management/client_upload_methods_factory.rb +8 -0
- data/lib/contentful/management/client_user_methods_factory.rb +1 -1
- data/lib/contentful/management/client_webhook_call_methods_factory.rb +11 -6
- data/lib/contentful/management/client_webhook_health_methods_factory.rb +2 -2
- data/lib/contentful/management/client_webhook_methods_factory.rb +8 -0
- data/lib/contentful/management/content_type.rb +9 -7
- data/lib/contentful/management/content_type_editor_interface_methods_factory.rb +7 -3
- data/lib/contentful/management/content_type_entry_methods_factory.rb +2 -2
- data/lib/contentful/management/content_type_snapshot_methods_factory.rb +16 -2
- data/lib/contentful/management/dynamic_entry.rb +1 -1
- data/lib/contentful/management/editor_interface.rb +14 -6
- data/lib/contentful/management/entry.rb +12 -10
- data/lib/contentful/management/entry_association_methods_factory.rb +2 -2
- data/lib/contentful/management/environment.rb +138 -0
- data/lib/contentful/management/environment_asset_methods_factory.rb +11 -0
- data/lib/contentful/management/environment_association_methods_factory.rb +42 -0
- data/lib/contentful/management/environment_content_type_methods_factory.rb +11 -0
- data/lib/contentful/management/environment_editor_interface_methods_factory.rb +15 -0
- data/lib/contentful/management/environment_entry_methods_factory.rb +11 -0
- data/lib/contentful/management/environment_locale_methods_factory.rb +11 -0
- data/lib/contentful/management/environment_ui_extension_methods_factory.rb +11 -0
- data/lib/contentful/management/field.rb +3 -3
- data/lib/contentful/management/file.rb +2 -2
- data/lib/contentful/management/link.rb +21 -7
- data/lib/contentful/management/locale.rb +4 -2
- data/lib/contentful/management/organization.rb +1 -1
- data/lib/contentful/management/personal_access_token.rb +2 -2
- data/lib/contentful/management/resource.rb +34 -13
- data/lib/contentful/management/resource/all_published.rb +2 -2
- data/lib/contentful/management/resource/archiver.rb +12 -2
- data/lib/contentful/management/resource/environment_aware.rb +13 -0
- data/lib/contentful/management/resource/publisher.rb +12 -2
- data/lib/contentful/management/resource/refresher.rb +1 -1
- data/lib/contentful/management/resource_builder.rb +16 -14
- data/lib/contentful/management/response.rb +1 -1
- data/lib/contentful/management/role.rb +29 -2
- data/lib/contentful/management/snapshot.rb +13 -7
- data/lib/contentful/management/space.rb +14 -93
- data/lib/contentful/management/space_association_methods_factory.rb +1 -1
- data/lib/contentful/management/{space_locale_methods_factory.rb → space_environment_methods_factory.rb} +2 -6
- data/lib/contentful/management/space_membership.rb +3 -3
- data/lib/contentful/management/ui_extension.rb +4 -2
- data/lib/contentful/management/upload.rb +24 -1
- data/lib/contentful/management/user.rb +4 -4
- data/lib/contentful/management/validation.rb +5 -5
- data/lib/contentful/management/version.rb +1 -1
- data/lib/contentful/management/webhook.rb +26 -3
- data/lib/contentful/management/webhook_call.rb +8 -8
- data/lib/contentful/management/webhook_health.rb +2 -2
- data/spec/fixtures/vcr_cassettes/asset/143_assets_next_page.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/all.yml +1 -1
- data/spec/fixtures/vcr_cassettes/asset/archive.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/archive_published.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/archived_false.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/archived_true.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/create.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/create_with_already_used_id.yml +1 -1
- data/spec/fixtures/vcr_cassettes/asset/create_with_custom_id.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/create_with_locale.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/destroy.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/destroy_published.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/find.yml +1 -1
- data/spec/fixtures/vcr_cassettes/asset/find_not_found.yml +1 -1
- data/spec/fixtures/vcr_cassettes/asset/limited_assets_next_page.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/locale.yml +1 -1
- data/spec/fixtures/vcr_cassettes/asset/process.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/publish.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/publish_after_create.yml +3 -3
- data/spec/fixtures/vcr_cassettes/asset/publish_already_published.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/published_false.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/published_true.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/reload.yml +4 -4
- data/spec/fixtures/vcr_cassettes/asset/reload_with_fields.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/save_update.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/select_operator.yml +1 -1
- data/spec/fixtures/vcr_cassettes/asset/set_locale.yml +1 -1
- data/spec/fixtures/vcr_cassettes/asset/unarchive.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/unarchive_already_unarchive.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/unarchive_already_unarchived.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/unpublish.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/unpublish_already_unpublished.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/update_file.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/update_to_specified_locale.yml +2 -2
- data/spec/fixtures/vcr_cassettes/asset/update_with_default_locale_without_file.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/activate.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/activate_with_invalid_version.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/activated_false.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/activated_true.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/all.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/all_public.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_content_type_with_id.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_Array_field.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_Boolean_field.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_Date_field.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_Integer_field.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_Link_field.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_Location_field.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_Number_field.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_Object_field.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_Symbol_field.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_Text_field.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/deactivate.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/deactivate_already_deactivated.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/deactivate_with_entries.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/deactivate_with_version_change.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/destroy.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/destroy_activated.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/entry/all.yml +4 -4
- data/spec/fixtures/vcr_cassettes/content_type/entry/create.yml +4 -4
- data/spec/fixtures/vcr_cassettes/content_type/entry/create_only_with_localized_fields.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/entry/create_to_single_locale_only_with_localized_fields.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_camel_case_id_to_multiple_locales.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_entries.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_entries_for_multiple_locales.yml +9 -9
- data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_multiple_locales.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/entry/update_only_with_localized_fields.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/fields/add.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/fields/create.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/fields/create_array_types.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/fields/create_array_with_params.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/fields/create_with_params.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/fields/destroy.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/fields/update_field.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/find.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/find_not_found.yml +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/issue_79.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/omitted_field.yml +4 -4
- data/spec/fixtures/vcr_cassettes/content_type/reload.yml +4 -4
- data/spec/fixtures/vcr_cassettes/content_type/save_new.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/save_updated.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/save_with_added_field.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/update.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/update_change_field_name.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/update_remove_field.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/update_with_fields.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/update_with_one_new_field.yml +2 -2
- data/spec/fixtures/vcr_cassettes/content_type/validation/in.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/in_add.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/in_update.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/link_content_type.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/link_field.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/link_mimetype_group.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/multiple_add.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/present.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/range.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/range_update.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/regexp.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/size.yml +3 -3
- data/spec/fixtures/vcr_cassettes/content_type/validation/unique.yml +3 -3
- data/spec/fixtures/vcr_cassettes/editor_interfaces/default_for_space.yml +1 -1
- data/spec/fixtures/vcr_cassettes/editor_interfaces/update.yml +3 -3
- data/spec/fixtures/vcr_cassettes/entry/all.yml +1 -1
- data/spec/fixtures/vcr_cassettes/entry/archive.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/archive_published.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/archived_false.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/archived_true.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/content_type_entires.yml +1 -1
- data/spec/fixtures/vcr_cassettes/entry/create.yml +4 -4
- data/spec/fixtures/vcr_cassettes/entry/create_with_asset.yml +3 -3
- data/spec/fixtures/vcr_cassettes/entry/create_with_assets.yml +3 -3
- data/spec/fixtures/vcr_cassettes/entry/create_with_custom_id.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/create_with_entries.yml +3 -3
- data/spec/fixtures/vcr_cassettes/entry/create_with_entry.yml +3 -3
- data/spec/fixtures/vcr_cassettes/entry/create_with_just_id.yml +4 -4
- data/spec/fixtures/vcr_cassettes/entry/create_with_location.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/create_with_specified_locale.yml +3 -3
- data/spec/fixtures/vcr_cassettes/entry/create_with_symbols.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/destory_published.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/destroy.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/fallback_undefined.yml +3 -3
- data/spec/fixtures/vcr_cassettes/entry/find-with-null-symbols.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/find.yml +1 -1
- data/spec/fixtures/vcr_cassettes/entry/find_not_found.yml +1 -1
- data/spec/fixtures/vcr_cassettes/entry/issue_61_1.yml +6 -6
- data/spec/fixtures/vcr_cassettes/entry/issue_61_2.yml +6 -6
- data/spec/fixtures/vcr_cassettes/entry/issue_61_3.yml +6 -6
- data/spec/fixtures/vcr_cassettes/entry/issue_61_4.yml +6 -6
- data/spec/fixtures/vcr_cassettes/entry/issue_61_5.yml +305 -198
- data/spec/fixtures/vcr_cassettes/entry/issue_61_6.yml +5 -5
- data/spec/fixtures/vcr_cassettes/entry/issue_61_7.yml +6 -6
- data/spec/fixtures/vcr_cassettes/entry/issue_61_8.yml +6 -6
- data/spec/fixtures/vcr_cassettes/entry/issue_61_spaces.yml +143 -188
- data/spec/fixtures/vcr_cassettes/entry/issue_70.yml +3 -3
- data/spec/fixtures/vcr_cassettes/entry/issue_73.yml +4 -4
- data/spec/fixtures/vcr_cassettes/entry/issue_91.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/limited_entries.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/locales/fallback_to_default_locale.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/locales/retrieve_localized.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/locales/simple_assignments_use_default_locale.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/locales/simple_assignments_use_specified_locale.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/publish.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/publish_already_published.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/published_false.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/published_true.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/reload.yml +6 -6
- data/spec/fixtures/vcr_cassettes/entry/save_update.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/equality_operator.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/exclusion_operator.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/full_search.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/full_search_match_operator.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/including_linked_entries.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/inclusion_operator.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/inequality_operator.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/location_search_near_operator.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/location_search_within_operator.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/matching_array_fields.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/order_sys_createdAt.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/order_sys_updatedAt.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/range_operators_greater_than_or_equal.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/range_operators_less.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/search_filter/reverse_order_sys_updatedAt.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/select_operator.yml +1 -1
- data/spec/fixtures/vcr_cassettes/entry/service_unavailable.yml +1 -1
- data/spec/fixtures/vcr_cassettes/entry/too_many_requests.yml +5 -5
- data/spec/fixtures/vcr_cassettes/entry/too_many_requests_retry.yml +6 -6
- data/spec/fixtures/vcr_cassettes/entry/unarchive.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/unarchive_already_unarchived.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/unpublish.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/unpublish_already_unpublished.yml +2 -2
- data/spec/fixtures/vcr_cassettes/entry/update.yml +4 -4
- data/spec/fixtures/vcr_cassettes/entry/update_bool_field.yml +4 -4
- data/spec/fixtures/vcr_cassettes/entry/update_unlocalized_field.yml +3 -3
- data/spec/fixtures/vcr_cassettes/entry/update_with_custom_locale.yml +3 -3
- data/spec/fixtures/vcr_cassettes/environment/all.yml +226 -0
- data/spec/fixtures/vcr_cassettes/environment/create.yml +155 -0
- data/spec/fixtures/vcr_cassettes/environment/destroy.yml +89 -0
- data/spec/fixtures/vcr_cassettes/environment/find.yml +155 -0
- data/spec/fixtures/vcr_cassettes/environment/find_2.yml +155 -0
- data/spec/fixtures/vcr_cassettes/environment/not_found.yml +98 -0
- data/spec/fixtures/vcr_cassettes/locale/all_for_space.yml +1 -1
- data/spec/fixtures/vcr_cassettes/locale/create_for_space.yml +2 -2
- data/spec/fixtures/vcr_cassettes/locale/destroy.yml +5 -5
- data/spec/fixtures/vcr_cassettes/locale/fallback_code.yml +3 -3
- data/spec/fixtures/vcr_cassettes/locale/find.yml +1 -1
- data/spec/fixtures/vcr_cassettes/locale/find_default.yml +1 -1
- data/spec/fixtures/vcr_cassettes/locale/find_for_space_not_found.yml +1 -1
- data/spec/fixtures/vcr_cassettes/locale/find_not_default.yml +1 -1
- data/spec/fixtures/vcr_cassettes/locale/find_not_optional.yml +1 -1
- data/spec/fixtures/vcr_cassettes/locale/find_optional.yml +1 -1
- data/spec/fixtures/vcr_cassettes/locale/reload.yml +3 -3
- data/spec/fixtures/vcr_cassettes/locale/update_both.yml +3 -3
- data/spec/fixtures/vcr_cassettes/locale/update_code.yml +3 -3
- data/spec/fixtures/vcr_cassettes/locale/update_name.yml +3 -3
- data/spec/fixtures/vcr_cassettes/snapshot/all.yml +1 -1
- data/spec/fixtures/vcr_cassettes/snapshot/ct_all.yml +1 -1
- data/spec/fixtures/vcr_cassettes/snapshot/ct_find.yml +1 -1
- data/spec/fixtures/vcr_cassettes/snapshot/ct_find_not_found.yml +1 -1
- data/spec/fixtures/vcr_cassettes/snapshot/find.yml +1 -1
- data/spec/fixtures/vcr_cassettes/snapshot/find_not_found.yml +1 -1
- data/spec/fixtures/vcr_cassettes/snapshot/properties.yml +2 -2
- data/spec/fixtures/vcr_cassettes/ui_extension/all.yml +1 -1
- data/spec/fixtures/vcr_cassettes/ui_extension/create.yml +1 -1
- data/spec/fixtures/vcr_cassettes/ui_extension/delete.yml +3 -3
- data/spec/fixtures/vcr_cassettes/ui_extension/find.yml +1 -1
- data/spec/fixtures/vcr_cassettes/upload/associate_with_asset.yml +3 -3
- data/spec/lib/contentful/management/api_key_spec.rb +7 -7
- data/spec/lib/contentful/management/asset_spec.rb +38 -57
- data/spec/lib/contentful/management/client_spec.rb +1 -1
- data/spec/lib/contentful/management/content_type_spec.rb +78 -78
- data/spec/lib/contentful/management/editor_interface_spec.rb +4 -4
- data/spec/lib/contentful/management/entry_spec.rb +104 -114
- data/spec/lib/contentful/management/environment_spec.rb +87 -0
- data/spec/lib/contentful/management/locale_spec.rb +22 -22
- data/spec/lib/contentful/management/role_spec.rb +11 -11
- data/spec/lib/contentful/management/snapshot_spec.rb +27 -27
- data/spec/lib/contentful/management/space_membership_spec.rb +6 -7
- data/spec/lib/contentful/management/space_spec.rb +0 -282
- data/spec/lib/contentful/management/ui_extension_spec.rb +8 -8
- data/spec/lib/contentful/management/upload_spec.rb +9 -9
- data/spec/lib/contentful/management/webhook_calls_spec.rb +6 -6
- data/spec/lib/contentful/management/webhook_health_spec.rb +3 -3
- data/spec/lib/contentful/management/webhook_spec.rb +14 -12
- metadata +28 -14
- data/lib/contentful/management/space_asset_methods_factory.rb +0 -13
- data/lib/contentful/management/space_association_all_published_method_factory.rb +0 -12
- data/lib/contentful/management/space_content_type_methods_factory.rb +0 -13
- data/lib/contentful/management/space_editor_interface_methods_factory.rb +0 -21
- data/lib/contentful/management/space_entry_methods_factory.rb +0 -21
- data/lib/contentful/management/space_ui_extension_methods_factory.rb +0 -15
- data/spec/fixtures/vcr_cassettes/asset/all_public.yml +0 -112
- data/spec/fixtures/vcr_cassettes/entry/all_public.yml +0 -102
@@ -10,7 +10,7 @@ module Contentful
|
|
10
10
|
let(:membership_id) { '6RdRdobdQzh8zKe1Hogiz4' }
|
11
11
|
let(:client) { Client.new(token, raise_errors: true) }
|
12
12
|
|
13
|
-
subject { client.space_memberships }
|
13
|
+
subject { client.space_memberships(space_id) }
|
14
14
|
|
15
15
|
describe 'class methods' do
|
16
16
|
describe '::create_attributes' do
|
@@ -68,12 +68,12 @@ module Contentful
|
|
68
68
|
|
69
69
|
describe '.all' do
|
70
70
|
it 'returns a Contentful::Array' do
|
71
|
-
vcr('space_memberships/all') { expect(subject.all
|
71
|
+
vcr('space_memberships/all') { expect(subject.all).to be_kind_of Contentful::Management::Array }
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'builds a Contentful::Management::SpaceMembership' do
|
75
75
|
vcr('space_memberships/all') {
|
76
|
-
memberships = subject.all
|
76
|
+
memberships = subject.all
|
77
77
|
|
78
78
|
admin_membership, normal_membership = memberships.items
|
79
79
|
|
@@ -95,7 +95,7 @@ module Contentful
|
|
95
95
|
describe '.find' do
|
96
96
|
it 'returns a Contentful::Management::SpaceMembership' do
|
97
97
|
vcr('space_memberships/find') {
|
98
|
-
membership = subject.find(
|
98
|
+
membership = subject.find(membership_id)
|
99
99
|
|
100
100
|
expect(membership).to be_a Contentful::Management::SpaceMembership
|
101
101
|
expect(membership.admin).to eq false
|
@@ -108,7 +108,6 @@ module Contentful
|
|
108
108
|
it 'creates a Contentful::Management::SpaceMembership' do
|
109
109
|
vcr('space_memberships/create') {
|
110
110
|
membership = subject.create(
|
111
|
-
space_id,
|
112
111
|
admin: false,
|
113
112
|
roles: [
|
114
113
|
{
|
@@ -132,13 +131,13 @@ module Contentful
|
|
132
131
|
describe '#destroy' do
|
133
132
|
it 'deletes the membership' do
|
134
133
|
vcr('space_memberships/delete') {
|
135
|
-
membership = subject.find(
|
134
|
+
membership = subject.find('7pcydolqtgMaSLwmXMvGqW')
|
136
135
|
|
137
136
|
expect(membership.id).to be_truthy
|
138
137
|
|
139
138
|
membership.destroy
|
140
139
|
|
141
|
-
expect { subject.find(
|
140
|
+
expect { subject.find('7pcydolqtgMaSLwmXMvGqW') }.to raise_error Contentful::Management::NotFound
|
142
141
|
}
|
143
142
|
end
|
144
143
|
end
|
@@ -22,22 +22,6 @@ module Contentful
|
|
22
22
|
it 'builds a Contentful::Management::Space object' do
|
23
23
|
vcr('space/all') { expect(subject.all.first).to be_kind_of Contentful::Management::Space }
|
24
24
|
end
|
25
|
-
describe 'content type caching' do
|
26
|
-
it 'fetches all content types when finding a space' do
|
27
|
-
vcr('space/all') do
|
28
|
-
space = subject.all
|
29
|
-
expect(client.dynamic_entry_cache).not_to be_empty
|
30
|
-
end
|
31
|
-
end
|
32
|
-
it 'doesnt fetch content types when explicitly disabled' do
|
33
|
-
vcr('space/all_disabled_cache') do
|
34
|
-
client = Client.new(token, disable_content_type_caching: true)
|
35
|
-
subject = client.spaces
|
36
|
-
space = subject.all
|
37
|
-
expect(client.dynamic_entry_cache).to be_empty
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
25
|
end
|
42
26
|
|
43
27
|
describe '.find' do
|
@@ -66,24 +50,6 @@ module Contentful
|
|
66
50
|
expect(space.default_locale).to eql 'en-US'
|
67
51
|
end
|
68
52
|
end
|
69
|
-
describe 'content type caching' do
|
70
|
-
it 'fetches all content types when finding a space' do
|
71
|
-
vcr('space/find') do
|
72
|
-
space = subject.find(space_id)
|
73
|
-
expect(client.dynamic_entry_cache).not_to be_empty
|
74
|
-
expect(client.dynamic_entry_cache.key?('5DSpuKrl04eMAGQoQckeIq'.to_sym)).to be_truthy
|
75
|
-
end
|
76
|
-
end
|
77
|
-
it 'does not fetch content types when explicitly disabled' do
|
78
|
-
vcr('space/disabled_cache') do
|
79
|
-
client = Client.new(token, disable_content_type_caching: true)
|
80
|
-
subject = client.spaces
|
81
|
-
|
82
|
-
space = subject.find('facgnwwgj5fe')
|
83
|
-
expect(client.dynamic_entry_cache).to be_empty
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
53
|
end
|
88
54
|
|
89
55
|
describe '#destroy' do
|
@@ -131,7 +97,6 @@ module Contentful
|
|
131
97
|
space = subject.create(name: 'pl space', organization_id: '1EQPR5IHrPx94UY4AViTYO', default_locale: 'pl-pl')
|
132
98
|
expect(space).to be_kind_of Contentful::Management::Space
|
133
99
|
expect(space.name).to eq 'pl space'
|
134
|
-
expect(space.locales.all.first.code).to eql 'pl-pl'
|
135
100
|
end
|
136
101
|
end
|
137
102
|
it 'creates a space within a client default locale' do
|
@@ -140,7 +105,6 @@ module Contentful
|
|
140
105
|
space = client.spaces.create(name: 'new space', organization_id: '4SsuxQCaMaemfIms52Jr8s')
|
141
106
|
expect(space).to be_kind_of Contentful::Management::Space
|
142
107
|
expect(space.name).to eq 'new space'
|
143
|
-
expect(space.locales.all.first.code).to eql 'pl-PL'
|
144
108
|
expect(space.default_locale).to eql 'pl-PL'
|
145
109
|
end
|
146
110
|
end
|
@@ -166,40 +130,6 @@ module Contentful
|
|
166
130
|
end
|
167
131
|
end
|
168
132
|
|
169
|
-
describe '#content_types' do
|
170
|
-
let(:content_type_id) { '5DSpuKrl04eMAGQoQckeIq' }
|
171
|
-
let(:content_type_name) { 'ContentTypeForSpace' }
|
172
|
-
|
173
|
-
it 'creates content type' do
|
174
|
-
vcr('space/content_type/create') do
|
175
|
-
content_type = subject.find(space_id).content_types.create(name: content_type_name)
|
176
|
-
expect(content_type).to be_kind_of Contentful::Management::ContentType
|
177
|
-
expect(content_type.name).to eq content_type_name
|
178
|
-
end
|
179
|
-
end
|
180
|
-
it '#content_types.find' do
|
181
|
-
vcr('space/content_type/find') do
|
182
|
-
content_type = subject.find(space_id).content_types.find('1AZQOWKr2I8W2ugY0KiGEU')
|
183
|
-
expect(content_type).to be_kind_of Contentful::Management::ContentType
|
184
|
-
expect(content_type.name).to eq content_type_name
|
185
|
-
end
|
186
|
-
end
|
187
|
-
it '.content_types.all' do
|
188
|
-
vcr('space/content_type/all') do
|
189
|
-
content_types = subject.find(space_id).content_types.all
|
190
|
-
expect(content_types).to be_kind_of Contentful::Management::Array
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
it '.content_types.all_published' do
|
195
|
-
space_id = 'bjwq7b86vgmm'
|
196
|
-
vcr('space/content_type/all_public') do
|
197
|
-
content_types = subject.find(space_id).content_types.all_published
|
198
|
-
expect(content_types).to be_kind_of Contentful::Management::Array
|
199
|
-
end
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
133
|
describe '#api_keys' do
|
204
134
|
let!(:space_id) { 'bjwq7b86vgmm' }
|
205
135
|
let(:api_key_id) { '6vbW35TjBTc8FyRTAuXZZe' }
|
@@ -228,79 +158,6 @@ module Contentful
|
|
228
158
|
end
|
229
159
|
end
|
230
160
|
|
231
|
-
describe '#default_locale' do
|
232
|
-
it 'can set default locales from space locales on already existing spaces' do
|
233
|
-
vcr('space/locale/find_other_locale') do
|
234
|
-
space = subject.find(space_id)
|
235
|
-
expect(space.default_locale).to eql 'de-DE'
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
describe '#locales' do
|
241
|
-
let(:locale_id) { '42irhRZ5uMrRc9SZ1PyDRk' }
|
242
|
-
|
243
|
-
it '#locales.all' do
|
244
|
-
vcr('space/locale/all') do
|
245
|
-
locales = subject.find(space_id).locales.all
|
246
|
-
expect(locales).to be_kind_of Contentful::Management::Array
|
247
|
-
end
|
248
|
-
end
|
249
|
-
it 'builds a Contentful::Management::Local object' do
|
250
|
-
vcr('space/locale/all') { expect(subject.find(space_id).locales.all.first).to be_kind_of Contentful::Management::Locale }
|
251
|
-
end
|
252
|
-
it '#locales.find' do
|
253
|
-
vcr('space/locale/find') do
|
254
|
-
locales = subject.find(space_id).locales.find(locale_id)
|
255
|
-
expect(locales).to be_kind_of Contentful::Management::Locale
|
256
|
-
expect(locales.code).to eql 'en-US'
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
it 'when locale not found' do
|
261
|
-
vcr('space/locale/find_not_found') do
|
262
|
-
locale = subject.find(space_id).locales.find('invalid_id')
|
263
|
-
expect(locale).to be_kind_of Contentful::Management::NotFound
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
it 'creates locales to space' do
|
268
|
-
vcr('space/locale/create') do
|
269
|
-
locale = subject.find(space_id).locales.create(name: 'ru-RU',
|
270
|
-
contentManagementApi: true,
|
271
|
-
publish: true,
|
272
|
-
contentDeliveryApi: true,
|
273
|
-
code: 'ru-RU')
|
274
|
-
expect(locale).to be_kind_of Contentful::Management::Locale
|
275
|
-
expect(locale.name).to eql 'ru-RU'
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
it 'returns error when locale already exists' do
|
280
|
-
vcr('space/locale/create_with_the_same_code') do
|
281
|
-
space = subject.find(space_id)
|
282
|
-
locale = space.locales.create(name: 'ru-RU',
|
283
|
-
contentManagementApi: true,
|
284
|
-
publish: true,
|
285
|
-
contentDeliveryApi: true,
|
286
|
-
code: 'ru-RU')
|
287
|
-
expect(locale).to be_kind_of Contentful::Management::UnprocessableEntity
|
288
|
-
expect(locale.response.error_message).to eql 'The resource you sent in the body is invalid.'
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
it '#update when all params are given' do
|
293
|
-
vcr('space/locale/update') do
|
294
|
-
locale = subject.find(space_id).locales.find('6vn9hLab7q0D44XgRUwpoO')
|
295
|
-
initial_version = locale.sys[:version]
|
296
|
-
locale.update(name: 'Russia', contentManagementApi: true, publish: true, contentDeliveryApi: true)
|
297
|
-
expect(locale).to be_kind_of Contentful::Management::Locale
|
298
|
-
expect(locale.name).to eql 'Russia'
|
299
|
-
expect(locale.sys[:version]).to eql initial_version + 1
|
300
|
-
end
|
301
|
-
end
|
302
|
-
end
|
303
|
-
|
304
161
|
describe '#save' do
|
305
162
|
let(:new_name) { 'SaveNewName' }
|
306
163
|
it ' new space' do
|
@@ -323,122 +180,6 @@ module Contentful
|
|
323
180
|
end
|
324
181
|
end
|
325
182
|
|
326
|
-
describe '#assets' do
|
327
|
-
it '#assets.all' do
|
328
|
-
vcr('space/asset/all') do
|
329
|
-
assets = subject.find(space_id).assets.all
|
330
|
-
expect(assets).to be_kind_of Contentful::Management::Array
|
331
|
-
end
|
332
|
-
end
|
333
|
-
it 'builds a Contentful::Management::Asset object' do
|
334
|
-
vcr('space/asset/all') { expect(subject.find(space_id).assets.all.first).to be_kind_of Contentful::Management::Asset }
|
335
|
-
end
|
336
|
-
|
337
|
-
it 'return asset for a given key' do
|
338
|
-
vcr('space/asset/find') do
|
339
|
-
result = subject.find(space_id).assets.find('6zEogZjpO8cq6YOOQigiAw')
|
340
|
-
expect(result).to be_kind_of Contentful::Management::Asset
|
341
|
-
expect(result.id).to eql '6zEogZjpO8cq6YOOQigiAw'
|
342
|
-
end
|
343
|
-
end
|
344
|
-
it '#assets.all(skip: 3, limit: 5)' do
|
345
|
-
vcr('space/asset/all_with_skip_and_limit') do
|
346
|
-
assets = subject.find('bfsvtul0c41g').assets.all(limit: 5, skip: 3)
|
347
|
-
expect(assets).to be_kind_of Contentful::Management::Array
|
348
|
-
expect(assets.limit).to eq 5
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
352
|
-
it '#assets.all_published' do
|
353
|
-
space_id = 'bjwq7b86vgmm'
|
354
|
-
vcr('space/asset/all_public') do
|
355
|
-
assets = subject.find(space_id).assets.all_published
|
356
|
-
expect(assets).to be_kind_of Contentful::Management::Array
|
357
|
-
end
|
358
|
-
end
|
359
|
-
|
360
|
-
it 'create asset for space' do
|
361
|
-
vcr('space/asset/create') do
|
362
|
-
file = Contentful::Management::File.new
|
363
|
-
file.properties[:contentType] = 'image/jpeg'
|
364
|
-
file.properties[:fileName] = 'codequest.jpg'
|
365
|
-
file.properties[:upload] = 'http://static.goldenline.pl/firm_logo/082/firm_225106_22f37f_small.jpg'
|
366
|
-
|
367
|
-
space_assets = subject.find(space_id).assets
|
368
|
-
asset = space_assets.create(title: 'CodeQuest', description: 'Logo of Codequest', file: file)
|
369
|
-
expect(asset).to be_kind_of Contentful::Management::Asset
|
370
|
-
expect(asset.title).to eql 'CodeQuest'
|
371
|
-
expect(asset.description).to eql 'Logo of Codequest'
|
372
|
-
end
|
373
|
-
end
|
374
|
-
|
375
|
-
it 'creates asset with multiple locales ' do
|
376
|
-
vcr('space/asset/create_with_multiple_locales') do
|
377
|
-
file = Contentful::Management::File.new
|
378
|
-
file.properties[:contentType] = 'image/jpeg'
|
379
|
-
file.properties[:fileName] = 'codequest.jpg'
|
380
|
-
file.properties[:upload] = 'http://static.goldenline.pl/firm_logo/082/firm_225106_22f37f_small.jpg'
|
381
|
-
space = subject.find(space_id)
|
382
|
-
asset = space.assets.new
|
383
|
-
asset.title_with_locales = {'en-US' => 'Company logo', 'pl' => 'Firmowe logo'}
|
384
|
-
asset.title = 'Logo of Codequest comapny'
|
385
|
-
asset.description_with_locales = {'en-US' => 'Company logo codequest', 'pl' => 'Logo firmy Codequest'}
|
386
|
-
asset.file_with_locales = {'en-US' => file, 'pl' => file}
|
387
|
-
asset.save
|
388
|
-
|
389
|
-
expect(asset).to be_kind_of Contentful::Management::Asset
|
390
|
-
expect(asset.title).to eq 'Logo of Codequest comapny'
|
391
|
-
expect(asset.description).to eq 'Company logo codequest'
|
392
|
-
asset.locale = 'pl'
|
393
|
-
expect(asset.title).to eq 'Firmowe logo'
|
394
|
-
expect(asset.description).to eq 'Logo firmy Codequest'
|
395
|
-
end
|
396
|
-
end
|
397
|
-
end
|
398
|
-
describe '#assets.all(limit: 2, skip: 1).next_page' do
|
399
|
-
it 'returns assets to limited number of assets' do
|
400
|
-
vcr('space/asset/with_skipped_and_limited_assets_next_page') do
|
401
|
-
space = subject.find('bfsvtul0c41g')
|
402
|
-
assets = space.assets.all(limit: 2, skip: 1).next_page
|
403
|
-
expect(assets).to be_kind_of Contentful::Management::Array
|
404
|
-
expect(assets.first).to be_kind_of Contentful::Management::Asset
|
405
|
-
expect(assets.limit).to eq 2
|
406
|
-
expect(assets.skip).to eq 3
|
407
|
-
end
|
408
|
-
end
|
409
|
-
end
|
410
|
-
|
411
|
-
describe '#entries' do
|
412
|
-
it '#entries.all' do
|
413
|
-
vcr('space/entry/all') do
|
414
|
-
entries = subject.find(space_id).entries.all
|
415
|
-
expect(entries).to be_kind_of Contentful::Management::Array
|
416
|
-
end
|
417
|
-
end
|
418
|
-
it 'builds a Contentful::Management::Entry object' do
|
419
|
-
vcr('space/entry/all') { expect(subject.find(space_id).entries.all.first).to be_kind_of Contentful::Management::Entry }
|
420
|
-
end
|
421
|
-
|
422
|
-
it '#entries.all_published' do
|
423
|
-
space_id = 'bjwq7b86vgmm'
|
424
|
-
vcr('space/entry/all_public') do
|
425
|
-
entries = subject.find(space_id).entries.all_published
|
426
|
-
expect(entries).to be_kind_of Contentful::Management::Array
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
it 'return entry for a given key' do
|
431
|
-
vcr('space/entry/find') do
|
432
|
-
result = subject.find(space_id).entries.find('4Rouux8SoUCKwkyCq2I0E0')
|
433
|
-
expect(result).to be_kind_of Contentful::Management::Entry
|
434
|
-
expect(result.id).to eql '4Rouux8SoUCKwkyCq2I0E0'
|
435
|
-
expect(result.name_with_locales['en-US']).to eq 'Tom Handy'
|
436
|
-
expect(result.class.to_s).to eq "Contentful::Management::DynamicEntry[#{ result.class.content_type.id }]"
|
437
|
-
expect(result.class.inspect).to eq "Contentful::Management::DynamicEntry[#{ result.class.content_type.id }]"
|
438
|
-
end
|
439
|
-
end
|
440
|
-
end
|
441
|
-
|
442
183
|
describe '#webhooks' do
|
443
184
|
let(:space_id) { 'bfsvtul0c41g' }
|
444
185
|
it 'return all webhooks' do
|
@@ -467,29 +208,6 @@ module Contentful
|
|
467
208
|
end
|
468
209
|
end
|
469
210
|
end
|
470
|
-
describe '#entries.all(content_type: content_type_id)' do
|
471
|
-
it 'returns entries to specified content type' do
|
472
|
-
vcr('space/entry/content_type_entires') do
|
473
|
-
space = subject.find('9lxkhjnp8gyx')
|
474
|
-
entries = space.entries.all(content_type: 'category_content_type')
|
475
|
-
expect(entries).to be_kind_of Contentful::Management::Array
|
476
|
-
expect(entries.first).to be_kind_of Contentful::Management::Entry
|
477
|
-
expect(entries.first.sys[:contentType].id).to eq 'category_content_type'
|
478
|
-
end
|
479
|
-
end
|
480
|
-
end
|
481
|
-
describe '#entries.all(limit: 2, skip: 1).next_page' do
|
482
|
-
it 'returns entries to limited number of entries' do
|
483
|
-
vcr('space/entry/with_skipped_and_limited_entires_next_page') do
|
484
|
-
space = subject.find('sueu9bzev6qn')
|
485
|
-
entries = space.entries.all(limit: 2, skip: 1).next_page
|
486
|
-
expect(entries).to be_kind_of Contentful::Management::Array
|
487
|
-
expect(entries.first).to be_kind_of Contentful::Management::Entry
|
488
|
-
expect(entries.limit).to eq 2
|
489
|
-
expect(entries.skip).to eq 3
|
490
|
-
end
|
491
|
-
end
|
492
|
-
end
|
493
211
|
describe '#reload' do
|
494
212
|
let(:space_id) { 'bfsvtul0c41g' }
|
495
213
|
it 'update the current version of the object to the version on the system' do
|
@@ -11,7 +11,7 @@ module Contentful
|
|
11
11
|
let(:extension_id) { '2ZJduY1pKEma6G8Y2ImqYU' }
|
12
12
|
let(:client) { Client.new(token, raise_errors: true) }
|
13
13
|
|
14
|
-
subject { client.ui_extensions }
|
14
|
+
subject { client.ui_extensions(space_id, 'master') }
|
15
15
|
|
16
16
|
describe 'class methods' do
|
17
17
|
describe '::valid_extension' do
|
@@ -202,12 +202,12 @@ module Contentful
|
|
202
202
|
|
203
203
|
describe '.all' do
|
204
204
|
it 'returns a Contentful::Array' do
|
205
|
-
vcr('ui_extension/all') { expect(subject.all
|
205
|
+
vcr('ui_extension/all') { expect(subject.all).to be_kind_of Contentful::Management::Array }
|
206
206
|
end
|
207
207
|
|
208
208
|
it 'builds a Contentful::Management::UIExtension' do
|
209
209
|
vcr('ui_extension/all') {
|
210
|
-
extension = subject.all
|
210
|
+
extension = subject.all.first
|
211
211
|
|
212
212
|
expect(extension).to be_kind_of Contentful::Management::UIExtension
|
213
213
|
expect(extension.name).to eq 'My awesome extension by srcDoc'
|
@@ -219,14 +219,14 @@ module Contentful
|
|
219
219
|
end
|
220
220
|
|
221
221
|
it 'class method also works' do
|
222
|
-
vcr('ui_extension/all') { expect(Contentful::Management::UIExtension.all(client, space_id)).to be_kind_of Contentful::Management::Array }
|
222
|
+
vcr('ui_extension/all') { expect(Contentful::Management::UIExtension.all(client, space_id, 'master')).to be_kind_of Contentful::Management::Array }
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
226
|
describe '.find' do
|
227
227
|
it 'returns a Contentful::Management::UIExtension' do
|
228
228
|
vcr('ui_extension/find') {
|
229
|
-
extension = subject.find(
|
229
|
+
extension = subject.find(extension_id)
|
230
230
|
|
231
231
|
expect(extension).to be_kind_of Contentful::Management::UIExtension
|
232
232
|
expect(extension.name).to eq 'My awesome extension by srcDoc'
|
@@ -241,7 +241,7 @@ module Contentful
|
|
241
241
|
describe '.create' do
|
242
242
|
it 'creates a Contentful::Management::UIExtension' do
|
243
243
|
vcr('ui_extension/create') {
|
244
|
-
extension =
|
244
|
+
extension = client.ui_extensions(playground_space_id, 'master').create(extension: {
|
245
245
|
'name' => 'test extension',
|
246
246
|
'fieldTypes' => [{"type"=>"Symbol"}, {"type"=>"Text"}],
|
247
247
|
'srcdoc' => "<!doctype html><html lang='en'><head><meta charset='UTF-8'/><title>Sample Editor Extension</title><link rel='stylesheet' href='https://contentful.github.io/ui-extensions-sdk/cf-extension.css'><script src='https://contentful.github.io/ui-extensions-sdk/cf-extension-api.js'></script></head><body><div id='content'></div><script>window.contentfulExtension.init(function (extension) {window.alert(extension);var value = extension.field.getValue();extension.field.setValue('Hello world!');extension.field.onValueChanged(function(value) {if (value !== currentValue) {extension.field.setValue('Hello world!');}});});</script></body></html>",
|
@@ -261,13 +261,13 @@ module Contentful
|
|
261
261
|
describe '#destroy' do
|
262
262
|
it 'deletes the extension' do
|
263
263
|
vcr('ui_extension/delete') {
|
264
|
-
extension =
|
264
|
+
extension = client.ui_extensions(playground_space_id, 'master').find('2rf6QdckyoECCsQeE6gIOg')
|
265
265
|
|
266
266
|
expect(extension.id).to be_truthy
|
267
267
|
|
268
268
|
extension.destroy
|
269
269
|
|
270
|
-
expect {
|
270
|
+
expect { client.ui_extensions(playground_space_id, 'master').find('2rf6QdckyoECCsQeE6gIOg') }.to raise_error Contentful::Management::NotFound
|
271
271
|
}
|
272
272
|
end
|
273
273
|
end
|