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
@@ -291,7 +291,7 @@ module Contentful
|
|
291
291
|
|
292
292
|
it 'effectively requests via proxy' do
|
293
293
|
vcr(:proxy_request) {
|
294
|
-
expect(subject).to receive(:proxy_send).
|
294
|
+
expect(subject).to receive(:proxy_send).once.and_call_original
|
295
295
|
subject.spaces.find('zh42n1tmsaiq')
|
296
296
|
}
|
297
297
|
end
|
@@ -10,49 +10,49 @@ module Contentful
|
|
10
10
|
let!(:client) { Client.new(token) }
|
11
11
|
let(:content_type_id) { '5DSpuKrl04eMAGQoQckeIq' }
|
12
12
|
|
13
|
-
subject { client.content_types }
|
13
|
+
subject { client.content_types(space_id, 'master') }
|
14
14
|
|
15
15
|
describe '.all' do
|
16
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 }
|
17
|
+
vcr('content_type/all') { expect(Contentful::Management::ContentType.all(client, space_id, 'master')).to be_kind_of Contentful::Management::Array }
|
18
18
|
end
|
19
19
|
it 'returns a Contentful::Array' do
|
20
|
-
vcr('content_type/all') { expect(subject.all
|
20
|
+
vcr('content_type/all') { expect(subject.all).to be_kind_of Contentful::Management::Array }
|
21
21
|
end
|
22
22
|
it 'builds a Contentful::Management::ContentType object' do
|
23
|
-
vcr('content_type/all') { expect(subject.all
|
23
|
+
vcr('content_type/all') { expect(subject.all.first).to be_kind_of Contentful::Management::ContentType }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
describe '.all_published' do
|
28
28
|
let!(:space_id) { 'bjwq7b86vgmm' }
|
29
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 }
|
30
|
+
vcr('content_type/all_public') { expect(Contentful::Management::ContentType.all_published(client, space_id, 'master')).to be_kind_of Contentful::Management::Array }
|
31
31
|
end
|
32
32
|
it 'returns a Contentful::Array' do
|
33
|
-
vcr('content_type/all_public') { expect(subject.all_published
|
33
|
+
vcr('content_type/all_public') { expect(subject.all_published).to be_kind_of Contentful::Management::Array }
|
34
34
|
end
|
35
35
|
it 'builds a Contentful::Management::ContentType object' do
|
36
|
-
vcr('content_type/all_public') { expect(subject.all_published
|
36
|
+
vcr('content_type/all_public') { expect(subject.all_published.first).to be_kind_of Contentful::Management::ContentType }
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe '.find' do
|
41
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 }
|
42
|
+
vcr('content_type/find') { expect(Contentful::Management::ContentType.find(client, space_id, 'master', content_type_id)).to be_kind_of Contentful::Management::ContentType }
|
43
43
|
end
|
44
44
|
it 'returns a Contentful::Management::ContentType' do
|
45
|
-
vcr('content_type/find') { expect(subject.find(
|
45
|
+
vcr('content_type/find') { expect(subject.find(content_type_id)).to be_kind_of Contentful::Management::ContentType }
|
46
46
|
end
|
47
47
|
it 'returns the content_type for a given key' do
|
48
48
|
vcr('content_type/find') do
|
49
|
-
content_type = subject.find(
|
49
|
+
content_type = subject.find(content_type_id)
|
50
50
|
expect(content_type.id).to eql content_type_id
|
51
51
|
end
|
52
52
|
end
|
53
53
|
it 'returns an error when content_type does not found' do
|
54
54
|
vcr('content_type/find_not_found') do
|
55
|
-
result = subject.find(
|
55
|
+
result = subject.find('not_exist')
|
56
56
|
expect(result).to be_kind_of Contentful::Management::NotFound
|
57
57
|
end
|
58
58
|
end
|
@@ -61,7 +61,7 @@ module Contentful
|
|
61
61
|
describe '#destroy' do
|
62
62
|
it 'returns Contentful::BadRequest error when content type is activated' do
|
63
63
|
vcr('content_type/destroy_activated') do
|
64
|
-
result = subject.find(
|
64
|
+
result = subject.find('66jvD8UhNKmWGk24KKq0EW').destroy
|
65
65
|
expect(result).to be_kind_of Contentful::Management::BadRequest
|
66
66
|
message = [
|
67
67
|
"HTTP status code: 400 Bad Request",
|
@@ -73,7 +73,7 @@ module Contentful
|
|
73
73
|
|
74
74
|
it 'returns true when content type is not activated' do
|
75
75
|
vcr('content_type/destroy') do
|
76
|
-
result = subject.find(
|
76
|
+
result = subject.find('66jvD8UhNKmWGk24KKq0EW').destroy
|
77
77
|
expect(result).to eql true
|
78
78
|
end
|
79
79
|
end
|
@@ -83,13 +83,13 @@ module Contentful
|
|
83
83
|
let(:active_content) { '4EnwylPOikyMGUIy8uQgQY' }
|
84
84
|
it 'returns Contentful::Management::ContentType' do
|
85
85
|
vcr('content_type/activate') do
|
86
|
-
result = subject.find(
|
86
|
+
result = subject.find(active_content).activate
|
87
87
|
expect(result).to be_kind_of Contentful::Management::ContentType
|
88
88
|
end
|
89
89
|
end
|
90
90
|
it 'increases object version' do
|
91
91
|
vcr('content_type/activate') do
|
92
|
-
content_type = subject.find(
|
92
|
+
content_type = subject.find(active_content)
|
93
93
|
initial_version = content_type.sys[:version]
|
94
94
|
content_type.activate
|
95
95
|
expect(content_type.sys[:version]).to eql initial_version + 1
|
@@ -97,7 +97,7 @@ module Contentful
|
|
97
97
|
end
|
98
98
|
it 'returns error when not valid version' do
|
99
99
|
vcr('content_type/activate_with_invalid_version') do
|
100
|
-
content_type = subject.find(
|
100
|
+
content_type = subject.find(active_content)
|
101
101
|
content_type.sys[:version] = -1
|
102
102
|
result = content_type.activate
|
103
103
|
expect(result).to be_kind_of Contentful::Management::Conflict
|
@@ -109,14 +109,14 @@ module Contentful
|
|
109
109
|
let(:deactivate_content) { '4EnwylPOikyMGUIy8uQgQY' }
|
110
110
|
it 'returns Contentful::Management::ContentType' do
|
111
111
|
vcr('content_type/deactivate') do
|
112
|
-
content_type = subject.find(
|
112
|
+
content_type = subject.find(deactivate_content)
|
113
113
|
result = content_type.deactivate
|
114
114
|
expect(result).to be_kind_of Contentful::Management::ContentType
|
115
115
|
end
|
116
116
|
end
|
117
117
|
it 'increases object version' do
|
118
118
|
vcr('content_type/deactivate_with_version_change') do
|
119
|
-
content_type = subject.find(
|
119
|
+
content_type = subject.find(deactivate_content)
|
120
120
|
initial_version = content_type.sys[:version]
|
121
121
|
content_type.activate
|
122
122
|
expect(content_type.sys[:version]).to eql initial_version + 1
|
@@ -124,13 +124,13 @@ module Contentful
|
|
124
124
|
end
|
125
125
|
it 'returns error when has entries' do
|
126
126
|
vcr('content_type/deactivate_with_entries') do
|
127
|
-
result = subject.find(
|
127
|
+
result = subject.find('5DSpuKrl04eMAGQoQckeIq').deactivate
|
128
128
|
expect(result).to be_kind_of Contentful::Management::BadRequest
|
129
129
|
end
|
130
130
|
end
|
131
131
|
it 'returns error message when already deactivated' do
|
132
132
|
vcr('content_type/deactivate_already_deactivated') do
|
133
|
-
content_type = subject.find(
|
133
|
+
content_type = subject.find(deactivate_content)
|
134
134
|
content_type.sys[:version] = -1
|
135
135
|
result = content_type.deactivate
|
136
136
|
message = [
|
@@ -145,14 +145,14 @@ module Contentful
|
|
145
145
|
describe '#active?' do
|
146
146
|
it 'returns true if content_type is active' do
|
147
147
|
vcr('content_type/activated_true') do
|
148
|
-
content_type = subject.find(
|
148
|
+
content_type = subject.find('4EnwylPOikyMGUIy8uQgQY')
|
149
149
|
content_type.activate
|
150
150
|
expect(content_type.active?).to be_truthy
|
151
151
|
end
|
152
152
|
end
|
153
153
|
it 'returns false if content_type is not active' do
|
154
154
|
vcr('content_type/activated_false') do
|
155
|
-
content_type = subject.find(
|
155
|
+
content_type = subject.find('4EnwylPOikyMGUIy8uQgQY')
|
156
156
|
content_type.deactivate
|
157
157
|
expect(content_type.active?).to be_falsey
|
158
158
|
end
|
@@ -166,7 +166,6 @@ module Contentful
|
|
166
166
|
it 'creates a content_type within a space without id and without fields' do
|
167
167
|
vcr('content_type/create') do
|
168
168
|
content_type = subject.create(
|
169
|
-
space_id,
|
170
169
|
name: content_type_name,
|
171
170
|
description: content_type_description
|
172
171
|
)
|
@@ -180,7 +179,6 @@ module Contentful
|
|
180
179
|
vcr('content_type/create_content_type_with_id') do
|
181
180
|
content_type_id = 'custom_id'
|
182
181
|
content_type = subject.create(
|
183
|
-
space_id,
|
184
182
|
name: content_type_name,
|
185
183
|
id: content_type_id
|
186
184
|
)
|
@@ -199,7 +197,6 @@ module Contentful
|
|
199
197
|
field.type = field_type
|
200
198
|
field.link_type = 'Entry' if field_type == 'Link'
|
201
199
|
content_type = subject.create(
|
202
|
-
space_id,
|
203
200
|
name: "#{ field_type }",
|
204
201
|
description: "Content type with #{ field_type } field",
|
205
202
|
fields: [field]
|
@@ -231,13 +228,13 @@ module Contentful
|
|
231
228
|
name_field.name = 'name'
|
232
229
|
name_field.type = 'Symbol'
|
233
230
|
|
234
|
-
content_type =
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
231
|
+
content_type = client.content_types(space.id, 'master').create(
|
232
|
+
id: 'omitted_ct',
|
233
|
+
name: 'Omitted CT',
|
234
|
+
fields: [omitted_field, name_field],
|
235
|
+
display_field: 'name'
|
236
|
+
)
|
239
237
|
|
240
|
-
content_type.save
|
241
238
|
content_type.activate
|
242
239
|
|
243
240
|
content_type.reload
|
@@ -259,7 +256,7 @@ module Contentful
|
|
259
256
|
let(:content_type_id) { 'qw3F2rn3FeoOiceqAiCSC' }
|
260
257
|
it 'updates content_type name and description' do
|
261
258
|
vcr('content_type/update') do
|
262
|
-
content_type = subject.find(
|
259
|
+
content_type = subject.find(content_type_id)
|
263
260
|
content_type.update(name: content_type_name, description: content_type_description)
|
264
261
|
expect(content_type.name).to eq content_type_name
|
265
262
|
expect(content_type.description).to eq content_type_description
|
@@ -268,7 +265,7 @@ module Contentful
|
|
268
265
|
|
269
266
|
it 'updates content_type with fields (leave fields untouched)' do
|
270
267
|
vcr('content_type/update_with_fields') do
|
271
|
-
content_type = subject.find(
|
268
|
+
content_type = subject.find(content_type_id)
|
272
269
|
content_type.update(name: content_type_name)
|
273
270
|
expect(content_type.name).to eq content_type_name
|
274
271
|
expect(content_type.fields.size).to eq 2
|
@@ -281,7 +278,7 @@ module Contentful
|
|
281
278
|
field.id = 'blog_author'
|
282
279
|
field.name = 'Author of blog'
|
283
280
|
field.type = 'Text'
|
284
|
-
content_type = subject.find(
|
281
|
+
content_type = subject.find(content_type_id)
|
285
282
|
content_type.update(fields: content_type.fields + [field])
|
286
283
|
expect(content_type.fields.size).to eq 5
|
287
284
|
end
|
@@ -290,7 +287,7 @@ module Contentful
|
|
290
287
|
it 'updates content_type updating existing field' do
|
291
288
|
vcr('content_type/update_change_field_name') do
|
292
289
|
new_field_name = 'blog_author'
|
293
|
-
content_type = subject.find(
|
290
|
+
content_type = subject.find(content_type_id)
|
294
291
|
field = content_type.fields.first
|
295
292
|
field.name = new_field_name
|
296
293
|
content_type.update(fields: content_type.fields)
|
@@ -301,7 +298,7 @@ module Contentful
|
|
301
298
|
|
302
299
|
it 'updates content_type deleting existing field' do
|
303
300
|
vcr('content_type/update_remove_field') do
|
304
|
-
content_type = subject.find(
|
301
|
+
content_type = subject.find(content_type_id)
|
305
302
|
field = content_type.fields.first
|
306
303
|
content_type.update(fields: [field])
|
307
304
|
expect(content_type.fields.size).to eq 1
|
@@ -311,7 +308,9 @@ module Contentful
|
|
311
308
|
it 'update with multiple locales' do
|
312
309
|
vcr('content_type/entry/update_only_with_localized_fields') do
|
313
310
|
space = client.spaces.find('v2umtz8ths9v')
|
314
|
-
|
311
|
+
client.content_types(space.id, 'master').all # warmup cache
|
312
|
+
|
313
|
+
entry = client.entries(space.id, 'master').find('2dEkgsQRnSW2QuW4AMaa86')
|
315
314
|
entry.name_with_locales = {'en-US' => 'Contentful EN up', 'de-DE' => 'Contentful DE up', 'pl-PL' => 'Contentful PL up'}
|
316
315
|
entry.description_with_locales = {'en-US' => 'Description EN up', 'de-DE' => 'Description DE up', 'pl-PL' => 'Description PL up'}
|
317
316
|
entry.save
|
@@ -324,7 +323,7 @@ module Contentful
|
|
324
323
|
describe '#save' do
|
325
324
|
it 'updated content type' do
|
326
325
|
vcr('content_type/save_updated') do
|
327
|
-
content_type = subject.find(
|
326
|
+
content_type = subject.find(content_type_id)
|
328
327
|
content_type.name = 'NewName'
|
329
328
|
content_type.save
|
330
329
|
expect(content_type).to be_kind_of Contentful::Management::ContentType
|
@@ -334,7 +333,7 @@ module Contentful
|
|
334
333
|
|
335
334
|
it 'with new field' do
|
336
335
|
vcr('content_type/save_with_added_field') do
|
337
|
-
content_type = subject.find(
|
336
|
+
content_type = subject.find('2tDzYAg5MM6sIkwsOmM0Kc')
|
338
337
|
field = Contentful::Management::Field.new
|
339
338
|
field.id = 'blog_title'
|
340
339
|
field.name = 'Blog Title'
|
@@ -350,14 +349,15 @@ module Contentful
|
|
350
349
|
it 'saves new object' do
|
351
350
|
vcr('content_type/save_new') do
|
352
351
|
space = client.spaces.find(space_id)
|
353
|
-
content_type = space.content_types.new
|
354
|
-
content_type.name = 'Post title'
|
355
352
|
field = Contentful::Management::Field.new
|
356
353
|
field.id = 'my_text_field'
|
357
354
|
field.name = 'My Text Field'
|
358
355
|
field.type = 'Text'
|
359
|
-
|
360
|
-
content_type.
|
356
|
+
|
357
|
+
content_type = client.content_types(space.id, 'master').create(
|
358
|
+
name: 'Post title',
|
359
|
+
fields: [field]
|
360
|
+
)
|
361
361
|
expect(content_type).to be_kind_of Contentful::Management::ContentType
|
362
362
|
expect(content_type.name).to eq 'Post title'
|
363
363
|
expect(content_type.fields.size).to eq 1
|
@@ -370,14 +370,14 @@ module Contentful
|
|
370
370
|
let(:field_type) { 'Text' }
|
371
371
|
it 'creates new field' do
|
372
372
|
vcr('content_type/fields/create') do
|
373
|
-
content_type = subject.find(
|
373
|
+
content_type = subject.find(content_type_id)
|
374
374
|
content_type.fields.create(id: field_id, name: 'Eye color', type: field_type)
|
375
375
|
expect(content_type.fields.size).to eq 12
|
376
376
|
end
|
377
377
|
end
|
378
378
|
it 'creates new Link field with additional parameters' do
|
379
379
|
vcr('content_type/fields/create_with_params') do
|
380
|
-
content_type = subject.find(
|
380
|
+
content_type = subject.find('qw3F2rn3FeoOiceqAiCSC')
|
381
381
|
content_type.fields.create(id: 'blog_avatar', name: 'Blog avatar',
|
382
382
|
type: 'Link',
|
383
383
|
link_type: 'Asset',
|
@@ -394,7 +394,7 @@ module Contentful
|
|
394
394
|
end
|
395
395
|
it 'creates new Array field with additional parameters' do
|
396
396
|
vcr('content_type/fields/create_array_with_params') do
|
397
|
-
content_type = subject.find(
|
397
|
+
content_type = subject.find('6xzrdCr33OMAeIYUgs6UKi')
|
398
398
|
items = Contentful::Management::Field.new
|
399
399
|
items.type = 'Link'
|
400
400
|
items.link_type = 'Entry'
|
@@ -408,7 +408,7 @@ module Contentful
|
|
408
408
|
end
|
409
409
|
it 'updates existing field if matched id' do
|
410
410
|
vcr('content_type/fields/update_field') do
|
411
|
-
content_type = subject.find(
|
411
|
+
content_type = subject.find('5DSpuKrl04eMAGQoQckeIq')
|
412
412
|
updated_name = 'Eyes color'
|
413
413
|
content_type.fields.create(id: field_id, name: updated_name, type: field_type)
|
414
414
|
expect(content_type.fields.size).to eq 12
|
@@ -421,7 +421,7 @@ module Contentful
|
|
421
421
|
describe '#fields.add' do
|
422
422
|
it 'creates new field' do
|
423
423
|
vcr('content_type/fields/add') do
|
424
|
-
content_type = subject.find(
|
424
|
+
content_type = subject.find(content_type_id)
|
425
425
|
field = Contentful::Management::Field.new
|
426
426
|
field.id = 'symbol'
|
427
427
|
field.name = 'Symbol'
|
@@ -437,7 +437,7 @@ module Contentful
|
|
437
437
|
describe '#fields.destroy' do
|
438
438
|
it 'deletes field by id' do
|
439
439
|
vcr('content_type/fields/destroy') do
|
440
|
-
content_type = subject.find(
|
440
|
+
content_type = subject.find(content_type_id)
|
441
441
|
content_type.fields.destroy('blog_title')
|
442
442
|
expect(content_type.fields.size).to eq 10
|
443
443
|
end
|
@@ -447,7 +447,7 @@ module Contentful
|
|
447
447
|
describe '#entries.create' do
|
448
448
|
it 'with Text field' do
|
449
449
|
vcr('content_type/entry/create') do
|
450
|
-
content_type = subject.find(
|
450
|
+
content_type = subject.find(content_type_id)
|
451
451
|
entry = content_type.entries.create(name: 'Piotrek')
|
452
452
|
expect(entry).to be_kind_of Contentful::Management::Entry
|
453
453
|
expect(entry.fields[:name]).to eq 'Piotrek'
|
@@ -456,8 +456,8 @@ module Contentful
|
|
456
456
|
|
457
457
|
it 'with entry' do
|
458
458
|
vcr('content_type/entry/create_with_entries') do
|
459
|
-
entry_en = client.entries
|
460
|
-
content_type = subject.find(
|
459
|
+
entry_en = client.entries(space_id, 'master').find('Qa8TW5nPWgiU4MA6AGYgq')
|
460
|
+
content_type = subject.find('6xzrdCr33OMAeIYUgs6UKi')
|
461
461
|
entry = content_type.entries.create(blog_name: 'Piotrek',
|
462
462
|
blog_entry: entry_en,
|
463
463
|
blog_entries: [entry_en, entry_en, entry_en])
|
@@ -473,7 +473,7 @@ module Contentful
|
|
473
473
|
context 'for multiple locales' do
|
474
474
|
it 'for Text field' do
|
475
475
|
vcr('content_type/entry/create_with_multiple_locales') do
|
476
|
-
content_type = subject.find(
|
476
|
+
content_type = subject.find('4EnwylPOikyMGUIy8uQgQY')
|
477
477
|
entry = content_type.entries.new
|
478
478
|
entry.post_title_with_locales = {'en-US' => 'Company logo', 'pl' => 'Firmowe logo'}
|
479
479
|
entry.post_body_with_locales = {'en-US' => 'Story about Contentful...', 'pl' => 'Historia o Contentful...'}
|
@@ -489,7 +489,7 @@ module Contentful
|
|
489
489
|
end
|
490
490
|
it 'with camel case api id' do
|
491
491
|
vcr('content_type/entry/create_with_camel_case_id_to_multiple_locales') do
|
492
|
-
content_type = subject.find(
|
492
|
+
content_type = subject.find('4esHTHIVgc0uWkiwGwOsa6')
|
493
493
|
entry = content_type.entries.new
|
494
494
|
entry.car_mark_with_locales = {'en-US' => 'Mercedes Benz', 'pl' => 'Mercedes'}
|
495
495
|
entry.car_city_plate_with_locales = {'en-US' => 'en', 'pl' => 'bia'}
|
@@ -509,12 +509,11 @@ module Contentful
|
|
509
509
|
it 'with entries' do
|
510
510
|
vcr('content_type/entry/create_with_entries_for_multiple_locales') do
|
511
511
|
space = client.spaces.find(space_id)
|
512
|
-
space.content_types # filling cache
|
513
512
|
|
514
|
-
entry_en =
|
515
|
-
entry_pl =
|
513
|
+
entry_en = client.entries(space.id, 'master').find('664EPJ6zHqAeMO6O0mGggU')
|
514
|
+
entry_pl = client.entries(space.id, 'master').find('664EPJ6zHqAeMO6O0mGggU')
|
516
515
|
|
517
|
-
content_type =
|
516
|
+
content_type = client.content_types(space.id, 'master').find('6xzrdCr33OMAeIYUgs6UKi')
|
518
517
|
entry = content_type.entries.new
|
519
518
|
entry.blog_name_with_locales = {'en-US' => 'Contentful en', 'pl' => 'Contentful pl'}
|
520
519
|
entry.blog_entries_with_locales = {'en-US' => [entry_en, entry_en], 'pl' => [entry_pl, entry_pl]}
|
@@ -527,12 +526,11 @@ module Contentful
|
|
527
526
|
it 'with assets' do
|
528
527
|
vcr('content_type/entry/create_with_entries_for_multiple_locales') do
|
529
528
|
space = client.spaces.find(space_id)
|
530
|
-
space.content_types # filling cache
|
531
529
|
|
532
|
-
entry_en =
|
533
|
-
entry_pl =
|
530
|
+
entry_en = client.entries(space.id, 'master').find('664EPJ6zHqAeMO6O0mGggU')
|
531
|
+
entry_pl = client.entries(space.id, 'master').find('664EPJ6zHqAeMO6O0mGggU')
|
534
532
|
|
535
|
-
content_type =
|
533
|
+
content_type = client.content_types(space.id, 'master').find('6xzrdCr33OMAeIYUgs6UKi')
|
536
534
|
entry = content_type.entries.new
|
537
535
|
entry.blog_name_with_locales = {'en-US' => 'Contentful en', 'pl' => 'Contentful pl'}
|
538
536
|
entry.blog_entries_with_locales = {'en-US' => [entry_en, entry_en], 'pl' => [entry_pl, entry_pl]}
|
@@ -545,7 +543,7 @@ module Contentful
|
|
545
543
|
context 'only to unlocalized fields' do
|
546
544
|
it 'return entry with valid parameters' do
|
547
545
|
vcr('content_type/entry/create_only_with_localized_fields') do
|
548
|
-
content_type =
|
546
|
+
content_type = described_class.find(client, 'v2umtz8ths9v', 'master', 'category_content_type')
|
549
547
|
entry = content_type.entries.new
|
550
548
|
entry.name_with_locales = {'en-US' => 'Contentful EN', 'de-DE' => 'Contentful DE', 'pl-PL' => 'Contentful PL'}
|
551
549
|
entry.description_with_locales = {'en-US' => 'Description EN', 'de-DE' => 'Description DE', 'pl-PL' => 'Description PL'}
|
@@ -559,7 +557,7 @@ module Contentful
|
|
559
557
|
context 'only to unlocalized fields' do
|
560
558
|
it 'return entry with valid parameters' do
|
561
559
|
vcr('content_type/entry/create_to_single_locale_only_with_localized_fields') do
|
562
|
-
content_type =
|
560
|
+
content_type = described_class.find(client, 'v2umtz8ths9v', 'master', 'category_content_type')
|
563
561
|
entry = content_type.entries.new
|
564
562
|
entry.name = 'Some testing EN name'
|
565
563
|
entry.description = ' some testing EN description '
|
@@ -579,7 +577,7 @@ module Contentful
|
|
579
577
|
it 'returns entries' do
|
580
578
|
vcr('content_type/entry/all') do
|
581
579
|
space = client.spaces.find(space_id)
|
582
|
-
content_type =
|
580
|
+
content_type = client.content_types(space.id, 'master').find('category_content_type')
|
583
581
|
entries = content_type.entries.all
|
584
582
|
expect(entries).to be_kind_of Contentful::Management::Array
|
585
583
|
expect(entries.size).to eq 2
|
@@ -593,7 +591,7 @@ module Contentful
|
|
593
591
|
let(:space_id) { 'bfsvtul0c41g' }
|
594
592
|
it 'update the current version of the object to the version on the system' do
|
595
593
|
vcr('content_type/reload') do
|
596
|
-
content_type =
|
594
|
+
content_type = described_class.find(client, space_id, 'master', 'category_content_type')
|
597
595
|
content_type.sys[:version] = 999
|
598
596
|
update_ct = content_type.update(name: 'Updated content type name')
|
599
597
|
expect(update_ct).to be_kind_of Contentful::Management::Conflict
|
@@ -608,7 +606,7 @@ module Contentful
|
|
608
606
|
|
609
607
|
describe '#validations' do
|
610
608
|
let(:space) { client.spaces.find('v2umtz8ths9v') }
|
611
|
-
let(:content_type) {
|
609
|
+
let(:content_type) { client.content_types(space.id, 'master').find('category_content_type') }
|
612
610
|
|
613
611
|
it "adds 'in validation' to a new field" do
|
614
612
|
vcr('content_type/validation/in') do
|
@@ -654,7 +652,7 @@ module Contentful
|
|
654
652
|
context 'range' do
|
655
653
|
it 'adds `range` validation to field' do
|
656
654
|
vcr('content_type/validation/range') do
|
657
|
-
content_type =
|
655
|
+
content_type = client.content_types(space.id, 'master').find('1JrDv4JJsYuY4KGEEgAsQU')
|
658
656
|
|
659
657
|
validation_range = Contentful::Management::Validation.new
|
660
658
|
validation_range.range = {min: 30, max: 100}
|
@@ -666,7 +664,7 @@ module Contentful
|
|
666
664
|
end
|
667
665
|
it 'change `range` validation to existing field' do
|
668
666
|
vcr('content_type/validation/range_update') do
|
669
|
-
content_type =
|
667
|
+
content_type = client.content_types(space.id, 'master').find('1JrDv4JJsYuY4KGEEgAsQU')
|
670
668
|
|
671
669
|
validation_range = Contentful::Management::Validation.new
|
672
670
|
validation_range.range = {min: 50, max: 200}
|
@@ -679,7 +677,7 @@ module Contentful
|
|
679
677
|
context 'present' do
|
680
678
|
it 'adds `present` validation to field' do
|
681
679
|
vcr('content_type/validation/present') do
|
682
|
-
content_type =
|
680
|
+
content_type = client.content_types(space.id, 'master').find('1JrDv4JJsYuY4KGEEgAsQU')
|
683
681
|
validation_present = Contentful::Management::Validation.new
|
684
682
|
validation_present.present = true
|
685
683
|
content_type.fields.create(id: 'present', name: 'Present', type: 'Text', validations: [validation_present])
|
@@ -691,7 +689,7 @@ module Contentful
|
|
691
689
|
context 'regexp' do
|
692
690
|
it 'adds `regexp` validation to field' do
|
693
691
|
vcr('content_type/validation/regexp') do
|
694
|
-
content_type =
|
692
|
+
content_type = client.content_types(space.id, 'master').find('1JrDv4JJsYuY4KGEEgAsQU')
|
695
693
|
validation_regexp = Contentful::Management::Validation.new
|
696
694
|
validation_regexp.regexp = {pattern: '^such', flags: 'im'}
|
697
695
|
content_type.fields.create(id: 'text', name: 'Text', type: 'Text', validations: [validation_regexp])
|
@@ -704,7 +702,7 @@ module Contentful
|
|
704
702
|
context 'linkContentType' do
|
705
703
|
it 'adds `linkContentType` validation to field' do
|
706
704
|
vcr('content_type/validation/link_content_type') do
|
707
|
-
content_type =
|
705
|
+
content_type = client.content_types(space.id, 'master').find('1JrDv4JJsYuY4KGEEgAsQU')
|
708
706
|
validation_link_content_type = Contentful::Management::Validation.new
|
709
707
|
validation_link_content_type.link_content_type = ['post_content_type']
|
710
708
|
content_type.fields.create(id: 'entries', validations: [validation_link_content_type])
|
@@ -716,7 +714,7 @@ module Contentful
|
|
716
714
|
context 'linkMimetypeGroup' do
|
717
715
|
it 'adds `linkMimetypeGroup` validation to field' do
|
718
716
|
vcr('content_type/validation/link_mimetype_group') do
|
719
|
-
content_type =
|
717
|
+
content_type = client.content_types(space.id, 'master').find('1JrDv4JJsYuY4KGEEgAsQU')
|
720
718
|
validation_link_mimetype_group = Contentful::Management::Validation.new
|
721
719
|
validation_link_mimetype_group.link_mimetype_group = 'image'
|
722
720
|
content_type.fields.create(id: 'entries', validations: [validation_link_mimetype_group])
|
@@ -728,7 +726,7 @@ module Contentful
|
|
728
726
|
context 'linkField' do
|
729
727
|
it 'adds `linkField` validation to field' do
|
730
728
|
vcr('content_type/validation/link_field') do
|
731
|
-
content_type =
|
729
|
+
content_type = client.content_types(space.id, 'master').find('1JrDv4JJsYuY4KGEEgAsQU')
|
732
730
|
validation_link_mimetype_group = Contentful::Management::Validation.new
|
733
731
|
validation_link_mimetype_group.link_field = true
|
734
732
|
content_type.fields.create(id: 'link_field', validations: [validation_link_mimetype_group])
|
@@ -741,7 +739,7 @@ module Contentful
|
|
741
739
|
let(:space) { client.spaces.find('iig6ari2cj2t') }
|
742
740
|
it 'adds `unique` validation to field' do
|
743
741
|
vcr('content_type/validation/unique') do
|
744
|
-
content_type =
|
742
|
+
content_type = client.content_types(space.id, 'master').find('1JrDv4JJsYuY4KGEEgAsQU')
|
745
743
|
validation_unique = Contentful::Management::Validation.new
|
746
744
|
validation_unique.unique = true
|
747
745
|
content_type.fields.create(id: 'symbol', name: 'Slug', type: 'Symbol', validations: [validation_unique])
|
@@ -754,7 +752,7 @@ module Contentful
|
|
754
752
|
context 'add multiple validations' do
|
755
753
|
it 'create field with multiple validations' do
|
756
754
|
vcr('content_type/validation/multiple_add') do
|
757
|
-
content_type =
|
755
|
+
content_type = client.content_types(space.id, 'master').find('1JrDv4JJsYuY4KGEEgAsQU')
|
758
756
|
validation_in = Contentful::Management::Validation.new
|
759
757
|
validation_in.in = %w( foo bar baz)
|
760
758
|
validation_regexp = Contentful::Management::Validation.new
|
@@ -784,7 +782,8 @@ module Contentful
|
|
784
782
|
field.type = 'Array'
|
785
783
|
field.items = items
|
786
784
|
|
787
|
-
content_type =
|
785
|
+
content_type = client.content_types(space.id, 'master').new
|
786
|
+
content_type.space = space
|
788
787
|
content_type.name = 'Testing Content Types'
|
789
788
|
content_type.fields = [field]
|
790
789
|
content_type.save
|
@@ -813,7 +812,8 @@ module Contentful
|
|
813
812
|
field.name = 'name'
|
814
813
|
field.type = 'Symbol'
|
815
814
|
|
816
|
-
content_type =
|
815
|
+
content_type = client.content_types(space.id, 'master').new
|
816
|
+
content_type.space = space
|
817
817
|
content_type.id = 'isssue_79_ct'
|
818
818
|
content_type.name = 'Issue 79 CT'
|
819
819
|
content_type.fields = [field]
|