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,13 +1,13 @@
|
|
1
1
|
require_relative 'resource'
|
2
|
-
require_relative 'resource_requester'
|
3
|
-
require_relative 'client_entry_methods_factory'
|
4
|
-
require_relative 'entry_snapshot_methods_factory'
|
5
|
-
require_relative 'resource/entry_fields'
|
6
2
|
require_relative 'resource/fields'
|
7
|
-
require_relative 'resource/field_aware'
|
8
|
-
require_relative 'resource/all_published'
|
9
3
|
require_relative 'resource/archiver'
|
10
4
|
require_relative 'resource/publisher'
|
5
|
+
require_relative 'resource_requester'
|
6
|
+
require_relative 'resource/field_aware'
|
7
|
+
require_relative 'resource/entry_fields'
|
8
|
+
require_relative 'resource/environment_aware'
|
9
|
+
require_relative 'client_entry_methods_factory'
|
10
|
+
require_relative 'entry_snapshot_methods_factory'
|
11
11
|
|
12
12
|
module Contentful
|
13
13
|
module Management
|
@@ -15,13 +15,14 @@ module Contentful
|
|
15
15
|
# @see _ https://www.contentful.com/developers/documentation/content-management-api/#resources-entries
|
16
16
|
class Entry
|
17
17
|
include Contentful::Management::Resource
|
18
|
-
include Contentful::Management::Resource::SystemProperties
|
19
|
-
include Contentful::Management::Resource::Refresher
|
20
18
|
extend Contentful::Management::Resource::EntryFields
|
21
|
-
|
19
|
+
include Contentful::Management::Resource::SystemProperties
|
20
|
+
|
22
21
|
include Contentful::Management::Resource::Fields
|
23
22
|
include Contentful::Management::Resource::Archiver
|
24
23
|
include Contentful::Management::Resource::Publisher
|
24
|
+
include Contentful::Management::Resource::Refresher
|
25
|
+
include Contentful::Management::Resource::EnvironmentAware
|
25
26
|
|
26
27
|
attr_accessor :content_type
|
27
28
|
|
@@ -153,6 +154,7 @@ module Contentful
|
|
153
154
|
new_instance = Contentful::Management::Entry.create(
|
154
155
|
client,
|
155
156
|
content_type.space.id,
|
157
|
+
environment_id,
|
156
158
|
content_type: content_type,
|
157
159
|
fields: instance_variable_get(:@fields)
|
158
160
|
)
|
@@ -248,7 +250,7 @@ module Contentful
|
|
248
250
|
sys[:contentType]['sys']['id']
|
249
251
|
end
|
250
252
|
space_id = space.is_a?(::Contentful::Management::Resource) ? space.id : space['sys']['id']
|
251
|
-
@content_type ||= ::Contentful::Management::ContentType.find(client, space_id, content_type_id)
|
253
|
+
@content_type ||= ::Contentful::Management::ContentType.find(client, space_id, environment_id, content_type_id)
|
252
254
|
end
|
253
255
|
end
|
254
256
|
end
|
@@ -12,11 +12,11 @@ module Contentful
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def all(_params = {})
|
15
|
-
associated_class.all(entry.client, entry.sys[:space].id, entry.id)
|
15
|
+
associated_class.all(entry.client, entry.sys[:space].id, entry.environment_id, entry.id)
|
16
16
|
end
|
17
17
|
|
18
18
|
def find(id)
|
19
|
-
associated_class.find(entry.client, entry.sys[:space].id, entry.id, id)
|
19
|
+
associated_class.find(entry.client, entry.sys[:space].id, entry.environment_id, entry.id, id)
|
20
20
|
end
|
21
21
|
|
22
22
|
def associated_class
|
@@ -0,0 +1,138 @@
|
|
1
|
+
require_relative 'environment_asset_methods_factory'
|
2
|
+
require_relative 'environment_entry_methods_factory'
|
3
|
+
require_relative 'environment_locale_methods_factory'
|
4
|
+
require_relative 'environment_content_type_methods_factory'
|
5
|
+
require_relative 'environment_ui_extension_methods_factory'
|
6
|
+
require_relative 'environment_editor_interface_methods_factory'
|
7
|
+
|
8
|
+
module Contentful
|
9
|
+
module Management
|
10
|
+
# Resource class for Environment.
|
11
|
+
# @see _ https://www.contentful.com/developers/documentation/content-management-api/#resources-environments
|
12
|
+
class Environment
|
13
|
+
include Contentful::Management::Resource
|
14
|
+
include Contentful::Management::Resource::Refresher
|
15
|
+
include Contentful::Management::Resource::SystemProperties
|
16
|
+
|
17
|
+
property :name, :string
|
18
|
+
|
19
|
+
# @private
|
20
|
+
def self.build_endpoint(endpoint_options)
|
21
|
+
space_id = endpoint_options.fetch(:space_id)
|
22
|
+
environment_id = endpoint_options.fetch(:resource_id, endpoint_options.fetch(:environment_id, nil))
|
23
|
+
|
24
|
+
endpoint = "spaces/#{space_id}/environments"
|
25
|
+
endpoint = "#{endpoint}/#{environment_id}" if environment_id
|
26
|
+
endpoint
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates an environment.
|
30
|
+
#
|
31
|
+
# @param [Contentful::Management::Client] client
|
32
|
+
# @param [String] space_id
|
33
|
+
# @param [Hash] attributes
|
34
|
+
# @see _ README for full attribute list for each resource.
|
35
|
+
#
|
36
|
+
# @return [Contentful::Management::Environment]
|
37
|
+
def self.create(client, space_id, attributes = {})
|
38
|
+
super(client, space_id, nil, attributes)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Finds an environment by ID.
|
42
|
+
#
|
43
|
+
# @param [Contentful::Management::Client] client
|
44
|
+
# @param [String] space_id
|
45
|
+
# @param [String] environment_id
|
46
|
+
#
|
47
|
+
# @return [Contentful::Management::Environment]
|
48
|
+
def self.find(client, space_id, environment_id)
|
49
|
+
super(client, space_id, nil, environment_id)
|
50
|
+
end
|
51
|
+
|
52
|
+
# @private
|
53
|
+
def self.create_attributes(_client, attributes)
|
54
|
+
return {} if attributes.nil? || attributes.empty?
|
55
|
+
|
56
|
+
{
|
57
|
+
'name' => attributes.fetch(:name, attributes.fetch('name', nil))
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Allows manipulation of entries in context of the current environment
|
62
|
+
# Allows listing all entries for the current environment, creating new and finding one by ID.
|
63
|
+
# @see _ README for details.
|
64
|
+
#
|
65
|
+
# @return [Contentful::Management::EnvironmentEntryMethodsFactory]
|
66
|
+
def entries
|
67
|
+
EnvironmentEntryMethodsFactory.new(self)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Allows manipulation of assets in context of the current environment
|
71
|
+
# Allows listing all assets for the current environment, creating new and finding one by ID.
|
72
|
+
# @see _ README for details.
|
73
|
+
#
|
74
|
+
# @return [Contentful::Management::EnvironmentAssetMethodsFactory]
|
75
|
+
def assets
|
76
|
+
EnvironmentAssetMethodsFactory.new(self)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Allows manipulation of content types in context of the current environment
|
80
|
+
# Allows listing all content types for the current environment, creating new and finding one by ID.
|
81
|
+
# @see _ README for details.
|
82
|
+
#
|
83
|
+
# @return [Contentful::Management::EnvironmentContentTypeMethodsFactory]
|
84
|
+
def content_types
|
85
|
+
EnvironmentContentTypeMethodsFactory.new(self)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Allows manipulation of locales in context of the current environment
|
89
|
+
# Allows listing all locales for the current environment, creating new and finding one by ID.
|
90
|
+
# @see _ README for details.
|
91
|
+
#
|
92
|
+
# @return [Contentful::Management::EnvironmentLocaleMethodsFactory]
|
93
|
+
def locales
|
94
|
+
EnvironmentLocaleMethodsFactory.new(self)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Allows manipulation of UI extensions in context of the current environment
|
98
|
+
# Allows listing all UI extensions for the current environment, creating new and finding one by ID.
|
99
|
+
# @see _ README for details.
|
100
|
+
#
|
101
|
+
# @return [Contentful::Management::EnvironmentUIExtensionMethodsFactory]
|
102
|
+
def ui_extensions
|
103
|
+
EnvironmentUIExtensionMethodsFactory.new(self)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Allows manipulation of editor interfaces in context of the current environment
|
107
|
+
# Allows listing of editor interfaces for the current environment.
|
108
|
+
# @see _ README for details.
|
109
|
+
#
|
110
|
+
# @return [Contentful::Management::EnvironmentEditorInterfaceMethodsFactory]
|
111
|
+
def editor_interfaces
|
112
|
+
EnvironmentEditorInterfaceMethodsFactory.new(self)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Gets the environment ID
|
116
|
+
def environment_id
|
117
|
+
id
|
118
|
+
end
|
119
|
+
|
120
|
+
# Retrieves Default Locale for current Environment and leaves it cached
|
121
|
+
#
|
122
|
+
# @return [String]
|
123
|
+
def default_locale
|
124
|
+
self.found_locale ||= find_locale
|
125
|
+
end
|
126
|
+
|
127
|
+
# Finds Default Locale Code for current Space
|
128
|
+
# This request makes an API call to the Locale endpoint
|
129
|
+
#
|
130
|
+
# @return [String]
|
131
|
+
def find_locale
|
132
|
+
locale = locales.all.detect(&:default)
|
133
|
+
return locale.code unless locale.nil?
|
134
|
+
@default_locale
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative 'environment_association_methods_factory'
|
2
|
+
|
3
|
+
module Contentful
|
4
|
+
module Management
|
5
|
+
# Wrapper for Asset API for usage from within Environment
|
6
|
+
# @private
|
7
|
+
class EnvironmentAssetMethodsFactory
|
8
|
+
include Contentful::Management::EnvironmentAssociationMethodsFactory
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative 'resource_requester'
|
2
|
+
|
3
|
+
module Contentful
|
4
|
+
module Management
|
5
|
+
# Wrapper for Environment Association Methods
|
6
|
+
# @private
|
7
|
+
module EnvironmentAssociationMethodsFactory
|
8
|
+
attr_reader :environment
|
9
|
+
|
10
|
+
def initialize(environment)
|
11
|
+
@environment = environment
|
12
|
+
end
|
13
|
+
|
14
|
+
def all(_params = {})
|
15
|
+
associated_class.all(environment.client, environment.sys[:space].id, environment.id)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(id)
|
19
|
+
associated_class.all(environment.client, environment.sys[:space].id, environment.id, id)
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(attributes = {})
|
23
|
+
associated_class.create(environment.client, environment.sys[:space].id, environment.id, attributes)
|
24
|
+
end
|
25
|
+
|
26
|
+
def new
|
27
|
+
object = associated_class.new
|
28
|
+
object.sys[:space] = environment.space
|
29
|
+
object.sys[:environment] = environment
|
30
|
+
object.client = environment.client
|
31
|
+
object
|
32
|
+
end
|
33
|
+
|
34
|
+
def associated_class
|
35
|
+
class_name = /\A(.+)Environment(.+)MethodsFactory\z/.match(self.class.name).captures.join
|
36
|
+
class_name.split('::').reduce(Object) do |mod, actual_class_name|
|
37
|
+
mod.const_get(actual_class_name)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative 'environment_association_methods_factory'
|
2
|
+
|
3
|
+
module Contentful
|
4
|
+
module Management
|
5
|
+
# Wrapper for Content Type API for usage from within Environment
|
6
|
+
# @private
|
7
|
+
class EnvironmentContentTypeMethodsFactory
|
8
|
+
include Contentful::Management::EnvironmentAssociationMethodsFactory
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative 'environment_association_methods_factory'
|
2
|
+
|
3
|
+
module Contentful
|
4
|
+
module Management
|
5
|
+
# Wrapper for Editor Interface API for usage from within Environment
|
6
|
+
# @private
|
7
|
+
class EnvironmentEditorInterfaceMethodsFactory
|
8
|
+
include Contentful::Management::EnvironmentAssociationMethodsFactory
|
9
|
+
|
10
|
+
def default(content_type_id)
|
11
|
+
associated_class.default(environment.client, environment.space.id, environment.id, content_type_id)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative 'environment_association_methods_factory'
|
2
|
+
|
3
|
+
module Contentful
|
4
|
+
module Management
|
5
|
+
# Wrapper for Entry API for usage from within Environment
|
6
|
+
# @private
|
7
|
+
class EnvironmentEntryMethodsFactory
|
8
|
+
include Contentful::Management::EnvironmentAssociationMethodsFactory
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative 'environment_association_methods_factory'
|
2
|
+
|
3
|
+
module Contentful
|
4
|
+
module Management
|
5
|
+
# Wrapper for Locale API for usage from within Environment
|
6
|
+
# @private
|
7
|
+
class EnvironmentLocaleMethodsFactory
|
8
|
+
include Contentful::Management::EnvironmentAssociationMethodsFactory
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative 'environment_association_methods_factory'
|
2
|
+
|
3
|
+
module Contentful
|
4
|
+
module Management
|
5
|
+
# Wrapper for UI Extensions API for usage from within Environment
|
6
|
+
# @private
|
7
|
+
class EnvironmentUIExtensionMethodsFactory
|
8
|
+
include Contentful::Management::EnvironmentAssociationMethodsFactory
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -7,15 +7,15 @@ module Contentful
|
|
7
7
|
include Contentful::Management::Resource
|
8
8
|
|
9
9
|
property :id, :string
|
10
|
+
property :items, Field
|
10
11
|
property :name, :string
|
11
12
|
property :type, :string
|
13
|
+
property :omitted, :boolean
|
12
14
|
property :linkType, :string
|
13
|
-
property :items, Field
|
14
15
|
property :required, :boolean
|
16
|
+
property :disabled, :boolean
|
15
17
|
property :localized, :boolean
|
16
18
|
property :validations, Validation
|
17
|
-
property :disabled, :boolean
|
18
|
-
property :omitted, :boolean
|
19
19
|
|
20
20
|
# Takes a field object of content type
|
21
21
|
# Merges existing properties, items and validations of field with new one
|
@@ -6,10 +6,10 @@ module Contentful
|
|
6
6
|
class File
|
7
7
|
include Contentful::Management::Resource
|
8
8
|
|
9
|
-
property :fileName, :string
|
10
|
-
property :contentType, :string
|
11
9
|
property :details
|
12
10
|
property :url, :string
|
11
|
+
property :fileName, :string
|
12
|
+
property :contentType, :string
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -9,13 +9,27 @@ module Contentful
|
|
9
9
|
include Contentful::Management::Resource::SystemProperties
|
10
10
|
|
11
11
|
# Queries contentful for the Resource the Link is referring to
|
12
|
-
# @param [
|
13
|
-
|
14
|
-
|
15
|
-
client.
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
# @param [String] space_id
|
13
|
+
# @param [String] environment_id
|
14
|
+
def resolve(space_id = nil, environment_id = nil)
|
15
|
+
return client.spaces.find(id) if link_type == 'Space'
|
16
|
+
|
17
|
+
method = Contentful::Management::Support.snakify(link_type).to_sym
|
18
|
+
|
19
|
+
if space_id && environment_id.nil?
|
20
|
+
return client.public_send(
|
21
|
+
method,
|
22
|
+
space_id
|
23
|
+
).find(id)
|
24
|
+
elsif space_id && environment_id
|
25
|
+
return client.public_send(
|
26
|
+
method,
|
27
|
+
space_id,
|
28
|
+
environment_id
|
29
|
+
).find(id)
|
30
|
+
end
|
31
|
+
|
32
|
+
client.public_send(method).find(id)
|
19
33
|
end
|
20
34
|
end
|
21
35
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'resource'
|
2
|
+
require_relative 'resource/environment_aware'
|
2
3
|
|
3
4
|
module Contentful
|
4
5
|
module Management
|
@@ -7,15 +8,16 @@ module Contentful
|
|
7
8
|
include Contentful::Management::Resource
|
8
9
|
include Contentful::Management::Resource::SystemProperties
|
9
10
|
include Contentful::Management::Resource::Refresher
|
11
|
+
include Contentful::Management::Resource::EnvironmentAware
|
10
12
|
|
11
13
|
property :code, :string
|
12
14
|
property :name, :string
|
13
|
-
property :contentManagementApi, :boolean
|
14
|
-
property :contentDeliveryApi, :boolean
|
15
15
|
property :publish, :boolean
|
16
16
|
property :default, :boolean
|
17
17
|
property :optional, :boolean
|
18
18
|
property :fallbackCode, :string
|
19
|
+
property :contentDeliveryApi, :boolean
|
20
|
+
property :contentManagementApi, :boolean
|
19
21
|
|
20
22
|
# @private
|
21
23
|
def self.create_attributes(_client, attributes)
|
@@ -6,8 +6,8 @@ module Contentful
|
|
6
6
|
# @see _ https://www.contentful.com/developers/docs/references/content-management-api/#/reference/organizations
|
7
7
|
class Organization
|
8
8
|
include Contentful::Management::Resource
|
9
|
-
include Contentful::Management::Resource::SystemProperties
|
10
9
|
include Contentful::Management::Resource::Refresher
|
10
|
+
include Contentful::Management::Resource::SystemProperties
|
11
11
|
|
12
12
|
property :name
|
13
13
|
|
@@ -6,13 +6,13 @@ module Contentful
|
|
6
6
|
# @see _ https://www.contentful.com/developers/docs/references/content-management-api/#/reference/personal-access-tokens
|
7
7
|
class PersonalAccessToken
|
8
8
|
include Contentful::Management::Resource
|
9
|
-
include Contentful::Management::Resource::SystemProperties
|
10
9
|
include Contentful::Management::Resource::Refresher
|
10
|
+
include Contentful::Management::Resource::SystemProperties
|
11
11
|
|
12
12
|
property :name, :string
|
13
|
-
property :revokedAt, :date
|
14
13
|
property :scopes, :array
|
15
14
|
property :token, :string
|
15
|
+
property :revokedAt, :date
|
16
16
|
|
17
17
|
# @private
|
18
18
|
def self.build_endpoint(endpoint_options)
|