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
@@ -1,5 +1,5 @@
|
|
1
|
-
require_relative 'client_association_methods_factory'
|
2
1
|
require_relative 'editor_interface'
|
2
|
+
require_relative 'client_association_methods_factory'
|
3
3
|
|
4
4
|
module Contentful
|
5
5
|
module Management
|
@@ -8,20 +8,26 @@ module Contentful
|
|
8
8
|
class ClientEditorInterfaceMethodsFactory
|
9
9
|
attr_reader :client
|
10
10
|
|
11
|
-
def initialize(client)
|
11
|
+
def initialize(client, space_id, environment_id, content_type_id)
|
12
12
|
@client = client
|
13
13
|
@resource_requester = ResourceRequester.new(client, associated_class)
|
14
|
+
@space_id = space_id
|
15
|
+
@environment_id = environment_id
|
16
|
+
@content_type_id = content_type_id
|
14
17
|
end
|
15
18
|
|
16
19
|
# Gets the Default Editor Interface
|
17
20
|
#
|
18
|
-
# @param [String] space_id
|
19
|
-
# @param [String] content_type_id
|
20
21
|
# @see _ For complete option list: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
|
21
22
|
#
|
22
23
|
# @return [Contentful::Management::EditorInterface]
|
23
|
-
def default
|
24
|
-
@resource_requester.all(
|
24
|
+
def default
|
25
|
+
@resource_requester.all(
|
26
|
+
space_id: @space_id,
|
27
|
+
environment_id: @environment_id,
|
28
|
+
content_type_id: @content_type_id,
|
29
|
+
editor_id: 'default'
|
30
|
+
)
|
25
31
|
end
|
26
32
|
|
27
33
|
private
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative 'client_association_methods_factory'
|
2
|
-
require_relative 'client_association_all_published_method_factory'
|
3
2
|
|
4
3
|
module Contentful
|
5
4
|
module Management
|
@@ -7,10 +6,9 @@ module Contentful
|
|
7
6
|
# @private
|
8
7
|
class ClientEntryMethodsFactory
|
9
8
|
include Contentful::Management::ClientAssociationMethodsFactory
|
10
|
-
include Contentful::Management::ClientAssociationAllPublishedMethodsFactory
|
11
9
|
|
12
10
|
def create(content_type, attributes)
|
13
|
-
associated_class.create(client,
|
11
|
+
associated_class.create(client, @space_id, @environment_id, attributes.merge(content_type: content_type))
|
14
12
|
end
|
15
13
|
|
16
14
|
def new(*)
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require_relative 'environment'
|
2
|
+
require_relative 'resource_requester'
|
3
|
+
|
4
|
+
module Contentful
|
5
|
+
module Management
|
6
|
+
# Wrapper for Environment API for usage from within Client
|
7
|
+
# @private
|
8
|
+
class ClientEnvironmentMethodsFactory
|
9
|
+
attr_reader :client
|
10
|
+
|
11
|
+
def initialize(client, space_id)
|
12
|
+
@client = client
|
13
|
+
@space_id = space_id
|
14
|
+
@resource_requester = ResourceRequester.new(client, associated_class)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Gets a collection of environments.
|
18
|
+
#
|
19
|
+
# @return [Contentful::Management::Array<Contentful::Management::Environment>]
|
20
|
+
def all
|
21
|
+
@resource_requester.all(
|
22
|
+
space_id: @space_id
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Gets a specific environment.
|
27
|
+
#
|
28
|
+
# @param [String] environment_id
|
29
|
+
#
|
30
|
+
# @return [Contentful::Management::Environment]
|
31
|
+
def find(environment_id)
|
32
|
+
@resource_requester.find(
|
33
|
+
space_id: @space_id,
|
34
|
+
environment_id: environment_id
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Create an environment.
|
39
|
+
#
|
40
|
+
# @param [Hash] attributes
|
41
|
+
# @option attributes [String] :name
|
42
|
+
#
|
43
|
+
# @return [Contentful::Management::Environment]
|
44
|
+
def create(attributes)
|
45
|
+
associated_class.create(client, @space_id, attributes)
|
46
|
+
end
|
47
|
+
|
48
|
+
def new
|
49
|
+
object = associated_class.new
|
50
|
+
object.client = client
|
51
|
+
object
|
52
|
+
end
|
53
|
+
|
54
|
+
def associated_class
|
55
|
+
::Contentful::Management::Environment
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -12,15 +12,15 @@ module Contentful
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def all(params = {})
|
15
|
-
super(
|
15
|
+
super(params)
|
16
16
|
end
|
17
17
|
|
18
18
|
def find(personal_access_token_id)
|
19
|
-
super(
|
19
|
+
super(personal_access_token_id)
|
20
20
|
end
|
21
21
|
|
22
22
|
def create(attributes)
|
23
|
-
super(
|
23
|
+
super(attributes)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -10,6 +10,14 @@ module Contentful
|
|
10
10
|
def new(*)
|
11
11
|
fail 'Not supported'
|
12
12
|
end
|
13
|
+
|
14
|
+
def find(resource_id)
|
15
|
+
associated_class.find(client, @space_id, resource_id)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create(attributes)
|
19
|
+
associated_class.create(client, @space_id, attributes)
|
20
|
+
end
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
@@ -7,8 +7,8 @@ module Contentful
|
|
7
7
|
class ClientSnapshotMethodsFactory
|
8
8
|
include Contentful::Management::ClientAssociationMethodsFactory
|
9
9
|
|
10
|
-
def initialize(client, resource_type)
|
11
|
-
super(client)
|
10
|
+
def initialize(client, space_id, environment_id, resource_type)
|
11
|
+
super(client, space_id, environment_id)
|
12
12
|
@resource_type = resource_type
|
13
13
|
end
|
14
14
|
|
@@ -16,21 +16,23 @@ module Contentful
|
|
16
16
|
fail 'Not supported'
|
17
17
|
end
|
18
18
|
|
19
|
-
def all(
|
19
|
+
def all(resource_id, params = {})
|
20
20
|
@resource_requester.all(
|
21
21
|
{
|
22
22
|
resource_type: @resource_type,
|
23
|
-
space_id: space_id,
|
23
|
+
space_id: @space_id,
|
24
|
+
environment_id: @environment_id,
|
24
25
|
resource_id: resource_id
|
25
26
|
},
|
26
27
|
params
|
27
28
|
)
|
28
29
|
end
|
29
30
|
|
30
|
-
def find(
|
31
|
+
def find(resource_id, snapshot_id)
|
31
32
|
@resource_requester.find(
|
32
33
|
resource_type: @resource_type,
|
33
|
-
space_id: space_id,
|
34
|
+
space_id: @space_id,
|
35
|
+
environment_id: @environment_id,
|
34
36
|
resource_id: resource_id,
|
35
37
|
snapshot_id: snapshot_id
|
36
38
|
)
|
@@ -16,9 +16,7 @@ module Contentful
|
|
16
16
|
#
|
17
17
|
# @return [Contentful::Management::Array<Contentful::Management::Space>]
|
18
18
|
def all
|
19
|
-
|
20
|
-
client.update_dynamic_entry_cache_for_spaces!(spaces)
|
21
|
-
spaces
|
19
|
+
@resource_requester.all
|
22
20
|
end
|
23
21
|
|
24
22
|
# Gets a specific space.
|
@@ -27,9 +25,7 @@ module Contentful
|
|
27
25
|
#
|
28
26
|
# @return [Contentful::Management::Space]
|
29
27
|
def find(space_id)
|
30
|
-
|
31
|
-
client.update_dynamic_entry_cache_for_space!(space) if space.is_a? Space
|
32
|
-
space
|
28
|
+
@resource_requester.find(space_id: space_id)
|
33
29
|
end
|
34
30
|
|
35
31
|
# Create a space.
|
@@ -14,6 +14,14 @@ module Contentful
|
|
14
14
|
def all(*)
|
15
15
|
fail 'Not supported'
|
16
16
|
end
|
17
|
+
|
18
|
+
def find(resource_id)
|
19
|
+
associated_class.find(client, @space_id, resource_id)
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(attributes)
|
23
|
+
associated_class.create(client, @space_id, attributes)
|
24
|
+
end
|
17
25
|
end
|
18
26
|
end
|
19
27
|
end
|
@@ -7,17 +7,22 @@ module Contentful
|
|
7
7
|
class ClientWebhookCallMethodsFactory
|
8
8
|
include Contentful::Management::ClientAssociationMethodsFactory
|
9
9
|
|
10
|
-
def
|
10
|
+
def initialize(client, space_id, webhook_id)
|
11
|
+
super(client, space_id)
|
12
|
+
@webhook_id = webhook_id
|
13
|
+
end
|
14
|
+
|
15
|
+
def all(_params = {})
|
11
16
|
@resource_requester.find(
|
12
|
-
space_id: space_id,
|
13
|
-
webhook_id: webhook_id
|
17
|
+
space_id: @space_id,
|
18
|
+
webhook_id: @webhook_id
|
14
19
|
)
|
15
20
|
end
|
16
21
|
|
17
|
-
def find(
|
22
|
+
def find(call_id)
|
18
23
|
@resource_requester.find(
|
19
|
-
space_id: space_id,
|
20
|
-
webhook_id: webhook_id,
|
24
|
+
space_id: @space_id,
|
25
|
+
webhook_id: @webhook_id,
|
21
26
|
call_id: call_id
|
22
27
|
)
|
23
28
|
end
|
@@ -10,6 +10,14 @@ module Contentful
|
|
10
10
|
def new(*)
|
11
11
|
fail 'Not supported'
|
12
12
|
end
|
13
|
+
|
14
|
+
def find(resource_id)
|
15
|
+
associated_class.find(client, @space_id, resource_id)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create(attributes)
|
19
|
+
associated_class.create(client, @space_id, attributes)
|
20
|
+
end
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
@@ -1,12 +1,13 @@
|
|
1
|
-
require_relative 'resource'
|
2
1
|
require_relative 'field'
|
2
|
+
require_relative 'support'
|
3
|
+
require_relative 'resource'
|
3
4
|
require_relative 'validation'
|
5
|
+
require_relative 'resource/publisher'
|
6
|
+
require_relative 'resource/all_published'
|
7
|
+
require_relative 'resource/environment_aware'
|
4
8
|
require_relative 'content_type_entry_methods_factory'
|
5
|
-
require_relative 'content_type_editor_interface_methods_factory'
|
6
9
|
require_relative 'content_type_snapshot_methods_factory'
|
7
|
-
require_relative '
|
8
|
-
require_relative 'resource/all_published'
|
9
|
-
require_relative 'resource/publisher'
|
10
|
+
require_relative 'content_type_editor_interface_methods_factory'
|
10
11
|
|
11
12
|
module Contentful
|
12
13
|
module Management
|
@@ -28,10 +29,11 @@ module Contentful
|
|
28
29
|
].freeze
|
29
30
|
|
30
31
|
include Contentful::Management::Resource
|
31
|
-
include Contentful::Management::Resource::SystemProperties
|
32
32
|
include Contentful::Management::Resource::Refresher
|
33
33
|
include Contentful::Management::Resource::Publisher
|
34
34
|
extend Contentful::Management::Resource::AllPublished
|
35
|
+
include Contentful::Management::Resource::EnvironmentAware
|
36
|
+
include Contentful::Management::Resource::SystemProperties
|
35
37
|
|
36
38
|
property :name, :string
|
37
39
|
property :description, :string
|
@@ -79,7 +81,7 @@ module Contentful
|
|
79
81
|
if id
|
80
82
|
update(@properties)
|
81
83
|
else
|
82
|
-
new_instance = self.class.create(client, space.id, @properties)
|
84
|
+
new_instance = self.class.create(client, space.id, environment_id, @properties)
|
83
85
|
refresh_data(new_instance)
|
84
86
|
end
|
85
87
|
end
|
@@ -10,12 +10,16 @@ module Contentful
|
|
10
10
|
|
11
11
|
# @private
|
12
12
|
def initialize(content_type)
|
13
|
-
@
|
14
|
-
|
13
|
+
@editor_interfaces_client = ClientEditorInterfaceMethodsFactory.new(
|
14
|
+
content_type.client,
|
15
|
+
content_type.space.id,
|
16
|
+
content_type.environment_id,
|
17
|
+
content_type.id
|
18
|
+
)
|
15
19
|
end
|
16
20
|
|
17
21
|
def default
|
18
|
-
editor_interfaces_client.default
|
22
|
+
editor_interfaces_client.default
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
@@ -23,7 +23,7 @@ module Contentful
|
|
23
23
|
#
|
24
24
|
# @return [Contentful::Management::Array<Contentful::Management::Entry>]
|
25
25
|
def all(params = {})
|
26
|
-
Entry.all(content_type.client, content_type.space.id, params.merge(content_type: content_type.id))
|
26
|
+
Entry.all(content_type.client, content_type.space.id, content_type.environment_id, params.merge(content_type: content_type.id))
|
27
27
|
end
|
28
28
|
|
29
29
|
# Creates an entry for a content type.
|
@@ -33,7 +33,7 @@ module Contentful
|
|
33
33
|
# @return [Contentful::Management::Entry]
|
34
34
|
def create(attributes)
|
35
35
|
attributes[:content_type] = content_type
|
36
|
-
Entry.create(content_type.client, content_type.space.id, attributes)
|
36
|
+
Entry.create(content_type.client, content_type.space.id, content_type.environment_id, attributes)
|
37
37
|
end
|
38
38
|
|
39
39
|
# Instantiates an empty entry for a content type.
|
@@ -18,7 +18,14 @@ module Contentful
|
|
18
18
|
#
|
19
19
|
# @return [Contentful::Management::Array<Contentful::Management::Snapshot>]
|
20
20
|
def all(params = {})
|
21
|
-
Snapshot.all(
|
21
|
+
Snapshot.all(
|
22
|
+
content_type.client,
|
23
|
+
content_type.space.id,
|
24
|
+
content_type.environment_id,
|
25
|
+
content_type.id,
|
26
|
+
'content_types',
|
27
|
+
params
|
28
|
+
)
|
22
29
|
end
|
23
30
|
|
24
31
|
# Gets a snapshot by ID for a specific content type.
|
@@ -28,7 +35,14 @@ module Contentful
|
|
28
35
|
#
|
29
36
|
# @return [Contentful::Management::Array<Contentful::Management::Snapshot>]
|
30
37
|
def find(snapshot_id)
|
31
|
-
Snapshot.find(
|
38
|
+
Snapshot.find(
|
39
|
+
content_type.client,
|
40
|
+
content_type.space.id,
|
41
|
+
content_type.environment_id,
|
42
|
+
content_type.id,
|
43
|
+
snapshot_id,
|
44
|
+
'content_types'
|
45
|
+
)
|
32
46
|
end
|
33
47
|
end
|
34
48
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require_relative 'resource'
|
2
|
+
require_relative 'resource/environment_aware'
|
2
3
|
|
3
4
|
module Contentful
|
4
5
|
module Management
|
5
6
|
# Resource class for Editor Interface.
|
6
7
|
class EditorInterface
|
7
8
|
include Contentful::Management::Resource
|
8
|
-
include Contentful::Management::Resource::SystemProperties
|
9
9
|
include Contentful::Management::Resource::Refresher
|
10
|
+
include Contentful::Management::Resource::SystemProperties
|
11
|
+
include Contentful::Management::Resource::EnvironmentAware
|
10
12
|
|
11
13
|
property :controls, :array
|
12
14
|
|
@@ -17,8 +19,8 @@ module Contentful
|
|
17
19
|
# @param [String] content_type_id
|
18
20
|
#
|
19
21
|
# @return [Contentful::Management::EditorInterface]
|
20
|
-
def self.default(client, space_id, content_type_id)
|
21
|
-
ClientEditorInterfaceMethodsFactory.new(client
|
22
|
+
def self.default(client, space_id, environment_id, content_type_id)
|
23
|
+
ClientEditorInterfaceMethodsFactory.new(client, space_id, environment_id, content_type_id).default
|
22
24
|
end
|
23
25
|
|
24
26
|
# Finds an EditorInterface.
|
@@ -43,9 +45,10 @@ module Contentful
|
|
43
45
|
# @private
|
44
46
|
def self.build_endpoint(endpoint_options)
|
45
47
|
space_id = endpoint_options.fetch(:space_id)
|
48
|
+
environment_id = endpoint_options.fetch(:environment_id)
|
46
49
|
content_type_id = endpoint_options.fetch(:content_type_id)
|
47
50
|
|
48
|
-
"spaces/#{space_id}/content_types/#{content_type_id}/editor_interface"
|
51
|
+
"spaces/#{space_id}/environments/#{environment_id}/content_types/#{content_type_id}/editor_interface"
|
49
52
|
end
|
50
53
|
|
51
54
|
# Updates an Editor Interface
|
@@ -57,7 +60,12 @@ module Contentful
|
|
57
60
|
def update(attributes)
|
58
61
|
ResourceRequester.new(client, self.class).update(
|
59
62
|
self,
|
60
|
-
{
|
63
|
+
{
|
64
|
+
space_id: space.id,
|
65
|
+
environment_id: environment_id,
|
66
|
+
content_type_id: content_type.id,
|
67
|
+
editor_id: id
|
68
|
+
},
|
61
69
|
{ 'controls' => attributes.fetch(:controls) },
|
62
70
|
version: sys[:version]
|
63
71
|
)
|
@@ -73,7 +81,7 @@ module Contentful
|
|
73
81
|
protected
|
74
82
|
|
75
83
|
def refresh_find
|
76
|
-
self.class.default(client, space.id, content_type.id)
|
84
|
+
self.class.default(client, space.id, environment_id, content_type.id)
|
77
85
|
end
|
78
86
|
|
79
87
|
def query_attributes(attributes)
|