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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a112a23e2e96dbdc7494254e44553f0ff240a287cb2c1f36bc445778e5a06e1b
|
4
|
+
data.tar.gz: 87f4f922bd21f2b33967b64f6d090c2bed1772cec8280b7c836c5f169c4f244c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e1ea76e93a1bb0600d3163066ae498909a17ccceac9edf26317af85a8e48e30d9afa501e9251087b6d4ad87cb0261d82f5b5c26f26a33cfe059e20465c1b1d8
|
7
|
+
data.tar.gz: 127443c3e4474e961cb8a974e1f6fbc500cf073c2024a0979f8bf3853ab667c8199ac9622ffa9334f065dbc6b70f5db716ec7e0caf73097d1d96cb598f5d2b6f
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,54 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
+
## 2.0.0
|
6
|
+
### Added
|
7
|
+
* Added support for Environments
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
**BREAKING CHANGES**:
|
12
|
+
* In order to provide a better top-level client API, `space_id` and `environment_id`, are now sent on the resource proxy call, rather than on the call itself. This allows for better reusability of proxies, which in the end provide a better developer experience.
|
13
|
+
Resources that are not environment-aware, still have the parameter arrangement changed, so proxies are also reusable, but do not include `environment_id`.
|
14
|
+
The `spaces`, `users`, `organizations` and `personal_access_tokens` proxies still do not require any parameters as they are top level resources.
|
15
|
+
|
16
|
+
Before (this code will assume that the old code was also environment aware, so that the impact is more visible):
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
# Fetching all entries
|
20
|
+
client.entries.all(space_id, environment_id)
|
21
|
+
|
22
|
+
# Fetching a single entry
|
23
|
+
client.entries.find(space_id, environment_id, entry_id)
|
24
|
+
|
25
|
+
# If you wanted to find another entry, you'd have to repeat `space_id` and `environment_id`
|
26
|
+
client.entries.find(space_id, environment_id, another_entry_id)
|
27
|
+
```
|
28
|
+
|
29
|
+
Now:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# Fetching all entries
|
33
|
+
client.entries(space_id, environment_id).all
|
34
|
+
|
35
|
+
# Fetching a single entry
|
36
|
+
entries_proxy = client.entries(space_id, environment_id)
|
37
|
+
entries_proxy.find(entry_id)
|
38
|
+
|
39
|
+
# If you wanted to find another entry, you just reuse the resource proxy
|
40
|
+
entries_proxy.find(another_entry_id)
|
41
|
+
```
|
42
|
+
|
43
|
+
The proxies, apart from the parameter re-shuffling, have kept the same interface.
|
44
|
+
|
45
|
+
* Spaces do no longer have proxies for `entries`, `assets`, `content_types`, `ui_extensions`, `locales` and `editor_interfaces`. These can now be found under `environments`.
|
46
|
+
* Space objects now have `environments` as a proxy accessor.
|
47
|
+
* Content Type Caching is now done when requesting Content Types, or when a property is missing on an Entry. Also `dynamic_entries` has been updated to receive a hash of `space_id => environment_id` pairs.
|
48
|
+
|
49
|
+
### Removed
|
50
|
+
|
51
|
+
* `all_published` methods for Entries and Assets have been removed.
|
52
|
+
|
5
53
|
## 1.10.1
|
6
54
|
### Fixed
|
7
55
|
* Fixed an error when calling next page on `Contentful::Array` that came from requests without query parameters. [#143](https://github.com/contentful/contentful-management.rb/issues/143)
|
data/README.md
CHANGED
@@ -87,24 +87,72 @@ blog_space.name = 'New Blog Space'
|
|
87
87
|
blog_space.save
|
88
88
|
```
|
89
89
|
|
90
|
-
###
|
90
|
+
### Environments
|
91
|
+
|
92
|
+
Retrieving all environments:
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
environments = client.environments('space_id').all
|
96
|
+
```
|
91
97
|
|
92
|
-
|
98
|
+
Or if you already have a fetched space:
|
93
99
|
|
94
100
|
```ruby
|
95
|
-
|
101
|
+
environments = space.environments.all
|
96
102
|
```
|
97
103
|
|
98
|
-
Retrieving
|
104
|
+
Retrieving one environment by ID:
|
99
105
|
|
100
106
|
```ruby
|
101
|
-
|
107
|
+
environment = client.environments('space_id').find('master')
|
108
|
+
```
|
109
|
+
|
110
|
+
Destroying a environment:
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
environment.destroy
|
114
|
+
```
|
115
|
+
|
116
|
+
Creating a environment:
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
environment = client.environments('space_id').new
|
120
|
+
environment.id = 'dev'
|
121
|
+
environment.name = 'Development'
|
122
|
+
environment.save
|
123
|
+
```
|
124
|
+
|
125
|
+
or
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
environment = client.environments(space_id).create(id: 'dev', name: 'Development')
|
129
|
+
```
|
130
|
+
|
131
|
+
Updating a environment:
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
environment.update(name: 'New Blog environment')
|
135
|
+
```
|
136
|
+
|
137
|
+
or
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
environment.name = 'Dev'
|
141
|
+
environment.save
|
142
|
+
```
|
143
|
+
|
144
|
+
### Assets
|
145
|
+
|
146
|
+
Retrieving all assets from the environment:
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
blog_post_assets = environment.assets.all
|
102
150
|
```
|
103
151
|
|
104
152
|
Retrieving an asset by id:
|
105
153
|
|
106
154
|
```ruby
|
107
|
-
blog_post_asset =
|
155
|
+
blog_post_asset = environment.assets.find('asset_id')
|
108
156
|
```
|
109
157
|
|
110
158
|
Creating a file:
|
@@ -119,13 +167,13 @@ image_file.properties[:upload] = 'http://www.example.com/example.jpg'
|
|
119
167
|
Creating an asset:
|
120
168
|
|
121
169
|
```ruby
|
122
|
-
my_image_asset =
|
170
|
+
my_image_asset = environment.assets.create(title: 'My Image', description: 'My Image Description', file: image_file)
|
123
171
|
```
|
124
172
|
|
125
173
|
or an asset with multiple locales
|
126
174
|
|
127
175
|
```ruby
|
128
|
-
my_image_localized_asset =
|
176
|
+
my_image_localized_asset = environment.assets.new
|
129
177
|
my_image_localized_asset.title_with_locales= {'en-US' => 'title', 'pl' => 'pl title'}
|
130
178
|
my_image_localized_asset.description_with_locales= {'en-US' => 'description', 'pl' => 'pl description'}
|
131
179
|
en_file = Contentful::Management::File.new
|
@@ -204,21 +252,21 @@ my_image_asset.published?
|
|
204
252
|
Creating an upload from a file path:
|
205
253
|
|
206
254
|
```ruby
|
207
|
-
upload = client.uploads
|
255
|
+
upload = client.uploads('space_id').create('/path/to/file.md')
|
208
256
|
```
|
209
257
|
|
210
258
|
Alternatively, create it from an `::IO` object:
|
211
259
|
|
212
260
|
```ruby
|
213
261
|
File.open('/path/to/file.md', 'rb') do |file|
|
214
|
-
upload = client.uploads
|
262
|
+
upload = client.uploads('space_id').create(file)
|
215
263
|
end
|
216
264
|
```
|
217
265
|
|
218
266
|
Finding an upload:
|
219
267
|
|
220
268
|
```ruby
|
221
|
-
upload = client.uploads
|
269
|
+
upload = client.uploads('space_id').find('upload_id')
|
222
270
|
```
|
223
271
|
|
224
272
|
Deleting an upload:
|
@@ -231,7 +279,7 @@ Associating an upload with an asset:
|
|
231
279
|
|
232
280
|
```ruby
|
233
281
|
# We find or create an upload:
|
234
|
-
upload = client.uploads
|
282
|
+
upload = client.uploads('space_id').find('upload_id')
|
235
283
|
|
236
284
|
# We create a File object with the associated upload:
|
237
285
|
file = Contentful::Management::File.new
|
@@ -240,28 +288,22 @@ file.properties[:fileName] = 'file.md'
|
|
240
288
|
file.properties[:uploadFrom] = upload.to_link_json # We create the Link from the upload.
|
241
289
|
|
242
290
|
# We create an asset with the associated file:
|
243
|
-
asset = client.assets
|
291
|
+
asset = client.assets('space_id', 'environment_id').create(title: 'My Upload', file: file)
|
244
292
|
asset.process_file # We process the file, to generate an URL for our upload.
|
245
293
|
```
|
246
294
|
|
247
295
|
### Entries
|
248
296
|
|
249
|
-
Retrieving all entries from the
|
250
|
-
|
251
|
-
```ruby
|
252
|
-
entries = blog_space.entries.all
|
253
|
-
```
|
254
|
-
|
255
|
-
Retrieving all published entries from the space: **DEPRECATED**
|
297
|
+
Retrieving all entries from the environment:
|
256
298
|
|
257
299
|
```ruby
|
258
|
-
entries =
|
300
|
+
entries = environment.entries.all
|
259
301
|
```
|
260
302
|
|
261
|
-
Retrieving all entries from the
|
303
|
+
Retrieving all entries from the environment with given content type:
|
262
304
|
|
263
305
|
```ruby
|
264
|
-
entries =
|
306
|
+
entries = environment.entries.all(content_type: content_type.id)
|
265
307
|
```
|
266
308
|
|
267
309
|
or
|
@@ -273,7 +315,7 @@ entries = content_type.entries.all
|
|
273
315
|
Retrieving an entry by ID:
|
274
316
|
|
275
317
|
```ruby
|
276
|
-
entry =
|
318
|
+
entry = environment.entries.find('entry_id')
|
277
319
|
```
|
278
320
|
|
279
321
|
Creating a location:
|
@@ -355,26 +397,26 @@ my_entry.published?
|
|
355
397
|
> make an extra request to fetch the content type and fill the missing fields.
|
356
398
|
> To allow for content type caching:
|
357
399
|
> * Enable [content type cache](#content-type-cache) at client instantiation time
|
358
|
-
> * Query entries through `
|
400
|
+
> * Query entries through `environment.entries.find` instead of `Entry.find(environment_id, entry_id)`
|
359
401
|
|
360
402
|
### Content Types
|
361
403
|
|
362
|
-
Retrieving all content types from a
|
404
|
+
Retrieving all content types from a environment:
|
363
405
|
|
364
406
|
```ruby
|
365
|
-
blog_post_content_types =
|
407
|
+
blog_post_content_types = environment.content_types.all
|
366
408
|
```
|
367
409
|
|
368
|
-
Retrieving all published content types from a
|
410
|
+
Retrieving all published content types from a environment:
|
369
411
|
|
370
412
|
```ruby
|
371
|
-
blog_post_content_types =
|
413
|
+
blog_post_content_types = environment.content_types.all_published
|
372
414
|
```
|
373
415
|
|
374
|
-
Retrieving one content type by ID from a
|
416
|
+
Retrieving one content type by ID from a environment:
|
375
417
|
|
376
418
|
```ruby
|
377
|
-
blog_post_content_type =
|
419
|
+
blog_post_content_type = environment.content_types.find(id)
|
378
420
|
```
|
379
421
|
|
380
422
|
Creating a field for a content type:
|
@@ -416,13 +458,13 @@ blog_post_content_type.fields.destroy(title_field_id)
|
|
416
458
|
Creating a content type:
|
417
459
|
|
418
460
|
```ruby
|
419
|
-
|
461
|
+
environment.content_types.create(name: 'Post', fields: [title_field, body_field])
|
420
462
|
```
|
421
463
|
|
422
464
|
or
|
423
465
|
|
424
466
|
```ruby
|
425
|
-
blog_post_content_type =
|
467
|
+
blog_post_content_type = environment.content_types.new
|
426
468
|
blog_post_content_type.name = 'Post'
|
427
469
|
blog_post_content_type.fields = [title_field, body_field]
|
428
470
|
blog_post_content_type.save
|
@@ -537,22 +579,22 @@ content_type.fields.create(id: 'entry', validations: [validation_link_field])
|
|
537
579
|
|
538
580
|
### Locales
|
539
581
|
|
540
|
-
Retrieving all locales from the
|
582
|
+
Retrieving all locales from the environment:
|
541
583
|
|
542
584
|
```ruby
|
543
|
-
blog_post_locales =
|
585
|
+
blog_post_locales = environment.locales.all
|
544
586
|
```
|
545
587
|
|
546
|
-
Retrieving one locale by ID from the
|
588
|
+
Retrieving one locale by ID from the environment:
|
547
589
|
|
548
590
|
```ruby
|
549
|
-
blog_post_locale =
|
591
|
+
blog_post_locale = environment.locales.find(locale_id)
|
550
592
|
```
|
551
593
|
|
552
594
|
Creating a locale:
|
553
595
|
|
554
596
|
```ruby
|
555
|
-
|
597
|
+
environment.locales.create(name: 'German', code: 'de-DE')
|
556
598
|
```
|
557
599
|
|
558
600
|
Updating a locale:
|
@@ -764,21 +806,21 @@ user = client.users.me
|
|
764
806
|
|
765
807
|
### UI Extensions
|
766
808
|
|
767
|
-
Retrieving all UI extensions from the
|
809
|
+
Retrieving all UI extensions from the environment:
|
768
810
|
|
769
811
|
```ruby
|
770
|
-
extensions =
|
812
|
+
extensions = environment.ui_extensions.all
|
771
813
|
```
|
772
|
-
Retrieving one UI extension by ID from the
|
814
|
+
Retrieving one UI extension by ID from the environment:
|
773
815
|
|
774
816
|
```ruby
|
775
|
-
blog_post_extension =
|
817
|
+
blog_post_extension = environment.ui_extensions.find(extension_id)
|
776
818
|
```
|
777
819
|
|
778
820
|
Creating a UI extension:
|
779
821
|
|
780
822
|
```ruby
|
781
|
-
|
823
|
+
environment.ui_extensions.create(
|
782
824
|
extension: {
|
783
825
|
'name' => 'My extension',
|
784
826
|
'src' => 'https://www.example.com',
|
@@ -851,7 +893,7 @@ You can call the EditorInterface API from any level within the content model hie
|
|
851
893
|
pass the IDs of the levels below it.
|
852
894
|
|
853
895
|
> Hierarchy is as follows:
|
854
|
-
> `No Object ->
|
896
|
+
> `No Object -> Environment -> ContentType -> EditorInterface`
|
855
897
|
|
856
898
|
### Entry Snapshots
|
857
899
|
|
@@ -884,9 +926,9 @@ snapshot = content_type.snapshots.find('some_snapshot_id')
|
|
884
926
|
### Pagination
|
885
927
|
|
886
928
|
```ruby
|
887
|
-
|
888
|
-
|
889
|
-
|
929
|
+
environment.entries.all(limit: 5).next_page
|
930
|
+
environment.assets.all(limit: 5).next_page
|
931
|
+
environment.entries.all(limit: 5).next_page
|
890
932
|
```
|
891
933
|
|
892
934
|
### Logging
|
@@ -918,14 +960,14 @@ client = Contentful::Management::Client.new('access_token', raise_errors: true)
|
|
918
960
|
|
919
961
|
### Content Type Cache
|
920
962
|
|
921
|
-
This allows for fetching content types for your
|
963
|
+
This allows for fetching content types for your environment at client instantiation time, which prevents extra requests per entry.
|
922
964
|
To enable this, in your client instantiation do:
|
923
965
|
|
924
966
|
```ruby
|
925
|
-
client = Contentful::Management::Client.new(token, dynamic_entries:
|
967
|
+
client = Contentful::Management::Client.new(token, dynamic_entries: {'my_space_id' => 'my_environment_id'})
|
926
968
|
```
|
927
969
|
|
928
|
-
You can enable the cache for as many
|
970
|
+
You can enable the cache for as many environments as you want. If no environment is added, content types will be fetched upon environment find.
|
929
971
|
|
930
972
|
To completely disable this feature, upon client instantiation do:
|
931
973
|
|
@@ -6,13 +6,13 @@ module Contentful
|
|
6
6
|
# @see _ https://www.contentful.com/developers/docs/references/content-management-api/#/reference/api-keys
|
7
7
|
class ApiKey
|
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
|
+
property :policies
|
13
14
|
property :description
|
14
15
|
property :accessToken
|
15
|
-
property :policies
|
16
16
|
|
17
17
|
# @private
|
18
18
|
def self.create_attributes(_client, attributes)
|
@@ -21,6 +21,29 @@ module Contentful
|
|
21
21
|
'description' => attributes.fetch(:description, nil)
|
22
22
|
}
|
23
23
|
end
|
24
|
+
|
25
|
+
# Creates an API Key.
|
26
|
+
#
|
27
|
+
# @param [Contentful::Management::Client] client
|
28
|
+
# @param [String] space_id
|
29
|
+
# @param [Hash] attributes
|
30
|
+
# @see _ README for full attribute list for each resource.
|
31
|
+
#
|
32
|
+
# @return [Contentful::Management::ApiKey]
|
33
|
+
def self.create(client, space_id, attributes = {})
|
34
|
+
super(client, space_id, nil, attributes)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Finds an API Key by ID.
|
38
|
+
#
|
39
|
+
# @param [Contentful::Management::Client] client
|
40
|
+
# @param [String] space_id
|
41
|
+
# @param [String] api_key_id
|
42
|
+
#
|
43
|
+
# @return [Contentful::Management::ApiKey]
|
44
|
+
def self.find(client, space_id, api_key_id)
|
45
|
+
super(client, space_id, nil, api_key_id)
|
46
|
+
end
|
24
47
|
end
|
25
48
|
end
|
26
49
|
end
|
@@ -11,13 +11,13 @@ module Contentful
|
|
11
11
|
DEFAULT_LIMIT = 100
|
12
12
|
|
13
13
|
include Contentful::Management::Resource
|
14
|
-
include Contentful::Management::Resource::SystemProperties
|
15
14
|
include Contentful::Management::Resource::ArrayLike
|
15
|
+
include Contentful::Management::Resource::SystemProperties
|
16
16
|
|
17
|
+
property :items
|
18
|
+
property :skip, :integer
|
17
19
|
property :total, :integer
|
18
20
|
property :limit, :integer
|
19
|
-
property :skip, :integer
|
20
|
-
property :items
|
21
21
|
|
22
22
|
# Simplifies pagination
|
23
23
|
def next_page
|