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
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Contentful::Management::Environment do
|
4
|
+
let(:token) { ENV.fetch('CF_TEST_CMA_TOKEN', '<ACCESS_TOKEN>') }
|
5
|
+
let(:client) { ::Contentful::Management::Client.new(token, raise_errors: true) }
|
6
|
+
let(:space_id) { 'facgnwwgj5fe' }
|
7
|
+
let(:master) { 'master' }
|
8
|
+
let(:testing) { 'testing' }
|
9
|
+
|
10
|
+
subject { client.environments(space_id) }
|
11
|
+
|
12
|
+
describe '.all' do
|
13
|
+
it 'fetches all environments for a space' do
|
14
|
+
vcr('environment/all') {
|
15
|
+
environments = subject.all
|
16
|
+
|
17
|
+
expect(environments.size).to eq 2
|
18
|
+
expect(environments.first).to be_a ::Contentful::Management::Environment
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'class method also works' do
|
23
|
+
vcr('environment/all') {
|
24
|
+
environments = described_class.all(client, space_id)
|
25
|
+
|
26
|
+
expect(environments.size).to eq 2
|
27
|
+
expect(environments.first).to be_a ::Contentful::Management::Environment
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '.find' do
|
33
|
+
it 'fetches an environment by id' do
|
34
|
+
vcr('environment/find') {
|
35
|
+
environment = subject.find(testing)
|
36
|
+
|
37
|
+
expect(environment.id).to eq testing
|
38
|
+
expect(environment.name).to eq 'testing'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'class method also works' do
|
43
|
+
vcr('environment/find') {
|
44
|
+
environment = described_class.find(client, space_id, testing)
|
45
|
+
|
46
|
+
expect(environment.id).to eq testing
|
47
|
+
expect(environment.name).to eq 'testing'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '.create' do
|
53
|
+
it 'can create an environment' do
|
54
|
+
vcr('environment/create') {
|
55
|
+
environment = subject.create(id: 'delete_me', name: 'Delete Me')
|
56
|
+
|
57
|
+
expect(environment.id).to eq 'delete_me'
|
58
|
+
expect(environment.name).to eq 'Delete Me'
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'class method also works' do
|
63
|
+
vcr('environment/create') {
|
64
|
+
environment = described_class.create(client, space_id, id: 'delete_me', name: 'Delete Me')
|
65
|
+
|
66
|
+
expect(environment.id).to eq 'delete_me'
|
67
|
+
expect(environment.name).to eq 'Delete Me'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#destroy' do
|
73
|
+
it 'deletes an environment' do
|
74
|
+
vcr('environment/find_2') {
|
75
|
+
environment = subject.find('delete_me')
|
76
|
+
|
77
|
+
vcr('environment/destroy') {
|
78
|
+
environment.destroy
|
79
|
+
}
|
80
|
+
|
81
|
+
vcr('environment/not_found') {
|
82
|
+
expect { subject.find('delete_me') }.to raise_error ::Contentful::Management::NotFound
|
83
|
+
}
|
84
|
+
}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -11,36 +11,36 @@ module Contentful
|
|
11
11
|
|
12
12
|
let!(:client) { Client.new(token) }
|
13
13
|
|
14
|
-
subject { client.locales }
|
14
|
+
subject { client.locales(space_id, 'master') }
|
15
15
|
|
16
16
|
describe '.all' do
|
17
17
|
it 'class method also works' do
|
18
|
-
vcr('locale/all_for_space') { expect(Contentful::Management::Locale.all(client, space_id)).to be_kind_of Contentful::Management::Array }
|
18
|
+
vcr('locale/all_for_space') { expect(Contentful::Management::Locale.all(client, space_id, 'master')).to be_kind_of Contentful::Management::Array }
|
19
19
|
end
|
20
20
|
it 'returns a Contentful::Array' do
|
21
|
-
vcr('locale/all_for_space') { expect(subject.all
|
21
|
+
vcr('locale/all_for_space') { expect(subject.all).to be_kind_of Contentful::Management::Array }
|
22
22
|
end
|
23
23
|
it 'builds a Contentful::Management::Locale object' do
|
24
|
-
vcr('locale/all_for_space') { expect(subject.all
|
24
|
+
vcr('locale/all_for_space') { expect(subject.all.first).to be_kind_of Contentful::Management::Locale }
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe '.find' do
|
29
29
|
it 'class method also works' do
|
30
|
-
vcr('locale/find') { expect(Contentful::Management::Locale.find(client, space_id, locale_id)).to be_kind_of Contentful::Management::Locale }
|
30
|
+
vcr('locale/find') { expect(Contentful::Management::Locale.find(client, space_id, 'master', locale_id)).to be_kind_of Contentful::Management::Locale }
|
31
31
|
end
|
32
32
|
it 'returns a Contentful::Management::Locale' do
|
33
|
-
vcr('locale/find') { expect(subject.find(
|
33
|
+
vcr('locale/find') { expect(subject.find(locale_id)).to be_kind_of Contentful::Management::Locale }
|
34
34
|
end
|
35
35
|
it 'returns the locale for a given key' do
|
36
36
|
vcr('locale/find') do
|
37
|
-
locale = subject.find(
|
37
|
+
locale = subject.find(locale_id)
|
38
38
|
expect(locale.id).to eql locale_id
|
39
39
|
end
|
40
40
|
end
|
41
41
|
it 'returns an error when content_type does not exists' do
|
42
42
|
vcr('locale/find_for_space_not_found') do
|
43
|
-
result = subject.find(
|
43
|
+
result = subject.find('not_exist')
|
44
44
|
expect(result).to be_kind_of Contentful::Management::NotFound
|
45
45
|
end
|
46
46
|
end
|
@@ -48,7 +48,7 @@ module Contentful
|
|
48
48
|
describe '.create' do
|
49
49
|
it 'create locales for space' do
|
50
50
|
vcr('locale/create_for_space') do
|
51
|
-
locale = subject.create(
|
51
|
+
locale = subject.create(name: 'testLocalCreate', code: 'bg')
|
52
52
|
expect(locale.name).to eql 'testLocalCreate'
|
53
53
|
end
|
54
54
|
end
|
@@ -58,7 +58,7 @@ module Contentful
|
|
58
58
|
let(:space_id) { 'bfsvtul0c41g' }
|
59
59
|
it 'update the current version of the object to the version on the system' do
|
60
60
|
vcr('locale/reload') do
|
61
|
-
locale = subject.find(
|
61
|
+
locale = subject.find('0ywTmGkjR0YhmbYaSmV1CS')
|
62
62
|
locale.sys[:version] = 99
|
63
63
|
locale.reload
|
64
64
|
update_locale = locale.update(name: 'Polish PL')
|
@@ -71,13 +71,13 @@ module Contentful
|
|
71
71
|
describe '#default' do
|
72
72
|
it 'is false for non default' do
|
73
73
|
vcr('locale/find_not_default') do
|
74
|
-
locale = subject.find(
|
74
|
+
locale = subject.find(locale_id)
|
75
75
|
expect(locale.default).to be_falsey
|
76
76
|
end
|
77
77
|
end
|
78
78
|
it 'is true for default' do
|
79
79
|
vcr('locale/find_default') do
|
80
|
-
locale = subject.find(
|
80
|
+
locale = subject.find(locale_id)
|
81
81
|
expect(locale.default).to be_truthy
|
82
82
|
end
|
83
83
|
end
|
@@ -88,7 +88,7 @@ module Contentful
|
|
88
88
|
it 'is false for non optional' do
|
89
89
|
vcr('locale/find_not_optional') do
|
90
90
|
locale_id = '56eOu5hJwVNb4XfqsnQV97'
|
91
|
-
locale = subject.find(
|
91
|
+
locale = subject.find(locale_id)
|
92
92
|
expect(locale.optional).to be_falsey
|
93
93
|
end
|
94
94
|
end
|
@@ -96,7 +96,7 @@ module Contentful
|
|
96
96
|
it 'is true for optional' do
|
97
97
|
vcr('locale/find_optional') do
|
98
98
|
locale_id = '7IHOkHoMY1PpFp1VSVlCpH'
|
99
|
-
locale = subject.find(
|
99
|
+
locale = subject.find(locale_id)
|
100
100
|
expect(locale.optional).to be_truthy
|
101
101
|
end
|
102
102
|
end
|
@@ -107,7 +107,7 @@ module Contentful
|
|
107
107
|
let!(:locale_id) { '63274yOrU0s4XiJlAp1ZMQ' }
|
108
108
|
it 'can update the locale name' do
|
109
109
|
vcr('locale/update_name') do
|
110
|
-
locale = subject.find(
|
110
|
+
locale = subject.find(locale_id)
|
111
111
|
locale.update(name: 'Something')
|
112
112
|
|
113
113
|
locale.reload
|
@@ -119,7 +119,7 @@ module Contentful
|
|
119
119
|
|
120
120
|
it 'can update the locale code' do
|
121
121
|
vcr('locale/update_code') do
|
122
|
-
locale = subject.find(
|
122
|
+
locale = subject.find(locale_id)
|
123
123
|
locale.update(code: 'es')
|
124
124
|
|
125
125
|
locale.reload
|
@@ -131,7 +131,7 @@ module Contentful
|
|
131
131
|
|
132
132
|
it 'can update both' do
|
133
133
|
vcr('locale/update_both') do
|
134
|
-
locale = subject.find(
|
134
|
+
locale = subject.find(locale_id)
|
135
135
|
locale.update(name: 'Spanish', code: 'es')
|
136
136
|
|
137
137
|
locale.reload
|
@@ -146,13 +146,13 @@ module Contentful
|
|
146
146
|
let!(:locale_id) { '63274yOrU0s4XiJlAp1ZMQ' }
|
147
147
|
it 'can destroy locales' do
|
148
148
|
vcr('locale/destroy') do
|
149
|
-
locale = subject.create(
|
149
|
+
locale = subject.create(name: 'Spanish (Argentina)', code: 'es-AR')
|
150
150
|
|
151
|
-
expect(subject.find(
|
151
|
+
expect(subject.find(locale.id).code).to eq 'es-AR'
|
152
152
|
|
153
153
|
locale.destroy
|
154
154
|
|
155
|
-
error = subject.find(
|
155
|
+
error = subject.find(locale.id)
|
156
156
|
|
157
157
|
expect(error).to be_a Contentful::Management::NotFound
|
158
158
|
end
|
@@ -164,9 +164,9 @@ module Contentful
|
|
164
164
|
let!(:space_id) { 'facgnwwgj5fe' }
|
165
165
|
it 'should be able to create a locale with a fallback code' do
|
166
166
|
vcr('locale/fallback_code') do
|
167
|
-
locale = subject.create(
|
167
|
+
locale = subject.create(name: 'Foo (BarBaz)', code: 'foo-BB', fallback_code: 'en-US')
|
168
168
|
|
169
|
-
expect(subject.find(
|
169
|
+
expect(subject.find(locale.id).code).to eq 'foo-BB'
|
170
170
|
end
|
171
171
|
end
|
172
172
|
end
|
@@ -45,17 +45,17 @@ module Contentful
|
|
45
45
|
|
46
46
|
let!(:client) { Client.new(token) }
|
47
47
|
|
48
|
-
subject { client.roles }
|
48
|
+
subject { client.roles(space_id) }
|
49
49
|
|
50
50
|
describe '.all' do
|
51
51
|
it 'class method also works' do
|
52
52
|
vcr('roles/all_for_space') { expect(Contentful::Management::Role.all(client, space_id)).to be_kind_of Contentful::Management::Array }
|
53
53
|
end
|
54
54
|
it 'returns a Contentful::Array' do
|
55
|
-
vcr('roles/all_for_space') { expect(subject.all
|
55
|
+
vcr('roles/all_for_space') { expect(subject.all).to be_kind_of Contentful::Management::Array }
|
56
56
|
end
|
57
57
|
it 'builds a Contentful::Management::Locale object' do
|
58
|
-
vcr('roles/all_for_space') { expect(subject.all
|
58
|
+
vcr('roles/all_for_space') { expect(subject.all.first).to be_kind_of Contentful::Management::Role }
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -64,17 +64,17 @@ module Contentful
|
|
64
64
|
vcr('roles/find') { expect(Contentful::Management::Role.find(client, space_id, role_id)).to be_kind_of Contentful::Management::Role }
|
65
65
|
end
|
66
66
|
it 'returns a Contentful::Management::Role' do
|
67
|
-
vcr('roles/find') { expect(subject.find(
|
67
|
+
vcr('roles/find') { expect(subject.find(role_id)).to be_kind_of Contentful::Management::Role }
|
68
68
|
end
|
69
69
|
it 'returns the locale for a given key' do
|
70
70
|
vcr('roles/find') do
|
71
|
-
role = subject.find(
|
71
|
+
role = subject.find(role_id)
|
72
72
|
expect(role.id).to eq role_id
|
73
73
|
end
|
74
74
|
end
|
75
75
|
it 'returns an error when content_type does not exists' do
|
76
76
|
vcr('roles/find_for_space_not_found') do
|
77
|
-
result = subject.find(
|
77
|
+
result = subject.find('not_exist')
|
78
78
|
expect(result).to be_kind_of Contentful::Management::NotFound
|
79
79
|
end
|
80
80
|
end
|
@@ -82,7 +82,7 @@ module Contentful
|
|
82
82
|
describe '.create' do
|
83
83
|
it 'create role for space' do
|
84
84
|
vcr('roles/create_for_space') do
|
85
|
-
role = subject.create(
|
85
|
+
role = subject.create(role_attrs)
|
86
86
|
|
87
87
|
expect(role.name).to eq 'testRoleCreate'
|
88
88
|
expect(role.description).to eq 'test role'
|
@@ -94,7 +94,7 @@ module Contentful
|
|
94
94
|
describe '#update' do
|
95
95
|
it 'can update the role' do
|
96
96
|
vcr('roles/update') do
|
97
|
-
role = subject.find(
|
97
|
+
role = subject.find(role_id)
|
98
98
|
role.update(name: 'Something')
|
99
99
|
|
100
100
|
role.reload
|
@@ -108,13 +108,13 @@ module Contentful
|
|
108
108
|
it 'can destroy roles' do
|
109
109
|
vcr('roles/destroy') do
|
110
110
|
role_attrs[:name] = 'ToDelete'
|
111
|
-
role = subject.create(
|
111
|
+
role = subject.create(role_attrs)
|
112
112
|
|
113
|
-
expect(subject.find(
|
113
|
+
expect(subject.find(role.id).name).to eq 'ToDelete'
|
114
114
|
|
115
115
|
role.destroy
|
116
116
|
|
117
|
-
error = subject.find(
|
117
|
+
error = subject.find(role.id)
|
118
118
|
|
119
119
|
expect(error).to be_a Contentful::Management::NotFound
|
120
120
|
end
|
@@ -14,36 +14,36 @@ module Contentful
|
|
14
14
|
let!(:client) { Client.new(token) }
|
15
15
|
|
16
16
|
describe 'default behaviour is entry snapshots' do
|
17
|
-
subject { client.snapshots }
|
17
|
+
subject { client.snapshots(space_id, 'master') }
|
18
18
|
|
19
19
|
describe '.all' do
|
20
20
|
it 'class method also works' do
|
21
|
-
vcr('snapshot/all') { expect(Contentful::Management::Snapshot.all(client, space_id, entry_id)).to be_kind_of Contentful::Management::Array }
|
21
|
+
vcr('snapshot/all') { expect(Contentful::Management::Snapshot.all(client, space_id, 'master', entry_id)).to be_kind_of Contentful::Management::Array }
|
22
22
|
end
|
23
23
|
it 'returns a Contentful::Array' do
|
24
|
-
vcr('snapshot/all') { expect(subject.all(
|
24
|
+
vcr('snapshot/all') { expect(subject.all(entry_id)).to be_kind_of Contentful::Management::Array }
|
25
25
|
end
|
26
26
|
it 'builds a Contentful::Management::Snapshot object' do
|
27
|
-
vcr('snapshot/all') { expect(subject.all(
|
27
|
+
vcr('snapshot/all') { expect(subject.all(entry_id).first).to be_kind_of Contentful::Management::Snapshot }
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
describe '.find' do
|
32
32
|
it 'class method also works' do
|
33
|
-
vcr('snapshot/find') { expect(Contentful::Management::Snapshot.find(client, space_id, entry_id, snapshot_id)).to be_kind_of Contentful::Management::Snapshot }
|
33
|
+
vcr('snapshot/find') { expect(Contentful::Management::Snapshot.find(client, space_id, 'master', entry_id, snapshot_id)).to be_kind_of Contentful::Management::Snapshot }
|
34
34
|
end
|
35
35
|
it 'returns a Contentful::Management::Snapshot' do
|
36
|
-
vcr('snapshot/find') { expect(subject.find(
|
36
|
+
vcr('snapshot/find') { expect(subject.find(entry_id, snapshot_id)).to be_kind_of Contentful::Management::Snapshot }
|
37
37
|
end
|
38
38
|
it 'returns snapshot for a given key' do
|
39
39
|
vcr('snapshot/find') do
|
40
|
-
snapshot = subject.find(
|
40
|
+
snapshot = subject.find(entry_id, snapshot_id)
|
41
41
|
expect(snapshot.id).to eql snapshot_id
|
42
42
|
end
|
43
43
|
end
|
44
44
|
it 'returns an error when snapshot does not exist' do
|
45
45
|
vcr('snapshot/find_not_found') do
|
46
|
-
result = subject.find(
|
46
|
+
result = subject.find(entry_id, 'not_exist')
|
47
47
|
expect(result).to be_kind_of Contentful::Management::NotFound
|
48
48
|
end
|
49
49
|
end
|
@@ -58,7 +58,7 @@ module Contentful
|
|
58
58
|
describe '#update' do
|
59
59
|
it 'is not supported' do
|
60
60
|
vcr('snapshot/find') do
|
61
|
-
snapshot = subject.find(
|
61
|
+
snapshot = subject.find(entry_id, snapshot_id)
|
62
62
|
|
63
63
|
expect { snapshot.update }.to raise_error 'Not supported'
|
64
64
|
end
|
@@ -68,7 +68,7 @@ module Contentful
|
|
68
68
|
describe '#destroy' do
|
69
69
|
it 'is not supported' do
|
70
70
|
vcr('snapshot/find') do
|
71
|
-
snapshot = subject.find(
|
71
|
+
snapshot = subject.find(entry_id, snapshot_id)
|
72
72
|
|
73
73
|
expect { snapshot.destroy }.to raise_error 'Not supported'
|
74
74
|
end
|
@@ -78,7 +78,7 @@ module Contentful
|
|
78
78
|
describe 'properties' do
|
79
79
|
it '.snapshot' do
|
80
80
|
vcr('snapshot/properties') do
|
81
|
-
snapshot = subject.find(
|
81
|
+
snapshot = subject.find(entry_id, snapshot_id)
|
82
82
|
|
83
83
|
expect(snapshot.snapshot).to be_a Contentful::Management::Entry
|
84
84
|
expect(snapshot.snapshot.name['en-US']).to eq 'something else'
|
@@ -88,18 +88,18 @@ module Contentful
|
|
88
88
|
end
|
89
89
|
|
90
90
|
describe 'entry snapshots' do
|
91
|
-
subject { client.entry_snapshots }
|
91
|
+
subject { client.entry_snapshots(space_id, 'master') }
|
92
92
|
|
93
93
|
describe '.all' do
|
94
94
|
it 'class method also works' do
|
95
|
-
vcr('snapshot/all') { expect(Contentful::Management::Snapshot.all(client, space_id, entry_id)).to be_kind_of Contentful::Management::Array }
|
95
|
+
vcr('snapshot/all') { expect(Contentful::Management::Snapshot.all(client, space_id, 'master', entry_id)).to be_kind_of Contentful::Management::Array }
|
96
96
|
end
|
97
97
|
it 'returns a Contentful::Array' do
|
98
|
-
vcr('snapshot/all') { expect(subject.all(
|
98
|
+
vcr('snapshot/all') { expect(subject.all(entry_id)).to be_kind_of Contentful::Management::Array }
|
99
99
|
end
|
100
100
|
it 'builds a Contentful::Management::Snapshot object' do
|
101
101
|
vcr('snapshot/all') {
|
102
|
-
snapshot = subject.all(
|
102
|
+
snapshot = subject.all(entry_id).first
|
103
103
|
expect(snapshot).to be_kind_of Contentful::Management::Snapshot
|
104
104
|
expect(snapshot.snapshot).to be_kind_of Contentful::Management::DynamicEntry
|
105
105
|
}
|
@@ -108,20 +108,20 @@ module Contentful
|
|
108
108
|
|
109
109
|
describe '.find' do
|
110
110
|
it 'class method also works' do
|
111
|
-
vcr('snapshot/find') { expect(Contentful::Management::Snapshot.find(client, space_id, entry_id, snapshot_id)).to be_kind_of Contentful::Management::Snapshot }
|
111
|
+
vcr('snapshot/find') { expect(Contentful::Management::Snapshot.find(client, space_id, 'master', entry_id, snapshot_id)).to be_kind_of Contentful::Management::Snapshot }
|
112
112
|
end
|
113
113
|
it 'returns a Contentful::Management::Snapshot' do
|
114
|
-
vcr('snapshot/find') { expect(subject.find(
|
114
|
+
vcr('snapshot/find') { expect(subject.find(entry_id, snapshot_id)).to be_kind_of Contentful::Management::Snapshot }
|
115
115
|
end
|
116
116
|
it 'returns snapshot for a given key' do
|
117
117
|
vcr('snapshot/find') do
|
118
|
-
snapshot = subject.find(
|
118
|
+
snapshot = subject.find(entry_id, snapshot_id)
|
119
119
|
expect(snapshot.id).to eql snapshot_id
|
120
120
|
end
|
121
121
|
end
|
122
122
|
it 'returns an error when snapshot does not exist' do
|
123
123
|
vcr('snapshot/find_not_found') do
|
124
|
-
result = subject.find(
|
124
|
+
result = subject.find(entry_id, 'not_exist')
|
125
125
|
expect(result).to be_kind_of Contentful::Management::NotFound
|
126
126
|
end
|
127
127
|
end
|
@@ -129,18 +129,18 @@ module Contentful
|
|
129
129
|
end
|
130
130
|
|
131
131
|
describe 'describe content type snapshots' do
|
132
|
-
subject { client.content_type_snapshots }
|
132
|
+
subject { client.content_type_snapshots(space_id, 'master') }
|
133
133
|
|
134
134
|
describe '.all' do
|
135
135
|
it 'class method also works' do
|
136
|
-
vcr('snapshot/ct_all') { expect(Contentful::Management::Snapshot.all(client, space_id, content_type_id, 'content_types')).to be_kind_of Contentful::Management::Array }
|
136
|
+
vcr('snapshot/ct_all') { expect(Contentful::Management::Snapshot.all(client, space_id, 'master', content_type_id, 'content_types')).to be_kind_of Contentful::Management::Array }
|
137
137
|
end
|
138
138
|
it 'returns a Contentful::Array' do
|
139
|
-
vcr('snapshot/ct_all') { expect(subject.all(
|
139
|
+
vcr('snapshot/ct_all') { expect(subject.all(content_type_id)).to be_kind_of Contentful::Management::Array }
|
140
140
|
end
|
141
141
|
it 'builds a Contentful::Management::Snapshot object' do
|
142
142
|
vcr('snapshot/ct_all') {
|
143
|
-
snapshot = subject.all(
|
143
|
+
snapshot = subject.all(content_type_id).first
|
144
144
|
expect(snapshot).to be_kind_of Contentful::Management::Snapshot
|
145
145
|
expect(snapshot.snapshot).to be_kind_of Contentful::Management::ContentType
|
146
146
|
}
|
@@ -149,21 +149,21 @@ module Contentful
|
|
149
149
|
|
150
150
|
describe '.find' do
|
151
151
|
it 'class method also works' do
|
152
|
-
vcr('snapshot/ct_find') { expect(Contentful::Management::Snapshot.find(client, space_id, content_type_id, ct_snapshot_id, 'content_types')).to be_kind_of Contentful::Management::Snapshot }
|
152
|
+
vcr('snapshot/ct_find') { expect(Contentful::Management::Snapshot.find(client, space_id, 'master', content_type_id, ct_snapshot_id, 'content_types')).to be_kind_of Contentful::Management::Snapshot }
|
153
153
|
end
|
154
154
|
it 'returns a Contentful::Management::Snapshot' do
|
155
|
-
vcr('snapshot/ct_find') { expect(subject.find(
|
155
|
+
vcr('snapshot/ct_find') { expect(subject.find(content_type_id, ct_snapshot_id)).to be_kind_of Contentful::Management::Snapshot }
|
156
156
|
end
|
157
157
|
it 'returns snapshot for a given key' do
|
158
158
|
vcr('snapshot/ct_find') do
|
159
|
-
snapshot = subject.find(
|
159
|
+
snapshot = subject.find(content_type_id, ct_snapshot_id)
|
160
160
|
expect(snapshot.id).to eql ct_snapshot_id
|
161
161
|
expect(snapshot.snapshot.id).to eq content_type_id
|
162
162
|
end
|
163
163
|
end
|
164
164
|
it 'returns an error when snapshot does not exist' do
|
165
165
|
vcr('snapshot/ct_find_not_found') do
|
166
|
-
result = subject.find(
|
166
|
+
result = subject.find(content_type_id, 'not_exist')
|
167
167
|
expect(result).to be_kind_of Contentful::Management::NotFound
|
168
168
|
end
|
169
169
|
end
|