# Change Log All notable changes to this project will be documented in this file. ## [0.9.6] - 2024-02-03 ### Added ### Changed - upgraded some gems ### Fixed - Compatibility with `ruby 3` - replaced `Proc.new` (with no block) by `block` in methods ## [0.9.5] - 2023-09-05 ### Fixed - `Ecoportal::API::V1::Person#as_update` missing parameter on `super` call. ## [0.9.4] - 2023-04-17 ### Changed - Softened max version of **gem** dependencies - Upgraded required ruby version ### Fixed - `Ecoportal::API::Common::BaseModel` should make a copy of `doc` on `initialize` - This was affecting `reset!` as `doc` was being changed ## [0.9.3] - 2023-03-16 ### Added - `Ecoportal::API::V1::SchemaFieldValue#clear` helper to clear the value ## [0.9.1] - 2023-03-09 ### Added - `Ecoportal::API::V1::Person#contractor_organization_id` support for contractor management - `Ecoportal::API::Common::BaseModel` **added** `doc` helper methods: - `replace_doc!` and `#replace_original_doc!` - `Ecoportal::API::Internal::Person` **added** methods - **breaking change**, they default to compare with `original_doc`, while they did it with `initial_doc`) - `#new?` => to know if this person is being created now (it doesn't exist on **server side**). - `#account_added?` => to know if this person is getting the account added. - `#account_removed?` => to know if this person is getting their account removed. - `Ecoportal::API::Common::Client#host` expose - `Ecoportal::API::Internal::Permissions` added abilities - `contractor_management` ### Fixed - `Ecoportal::API::V1::PersonDetails.key?` should index first. ### Changed - `Ecoportal::API::V1::Person::VALID_TAG_REGEX` allow dot `.` in tags. ## [0.8.5] - 2022-02-28 ### Added - `Ecoportal::API::V1::PersonDetails#[]` to raise a specific error type to allow handling - `Ecoportal::API::V1::PersonDetails.key?` to allow to check if a field exists - `Ecoportal::API::Internal::Account#force_send_invites` support for back-end new method ### Fixed - `Ecoportal::API::V1::People#get` fixed typo - `Ecoportal::API::Common::BaseModel` `#original_doc` and `#initial_doc` maybe empty for the parent object ### Changed - `Ecoportal::API::V1::People#each` limited the `GET` retries to `5` - `Ecoportal::API::Internal::Account#default_tag=` - Controls input type to be `String` or `nil` - Inherent `upcase` ## [0.8.4] - 2021-11-05 ### Added - `Ecoportal::API::Internal::Permissions` added abilities - `visitor_management`, `cross_register_reporting` and `broadcast_notifications` - Some yardocs too - Some callbacks are done in a non-obvious way and the returned object type was not documented - For this reason, some yardocs have been added to some of the parts that have been worked on. ### Fixed - `Ecoportal::API::V1::People#create_job` - **Removed** call to `BatchOperation#process_response` - The method was is already called by `job_result` - As a consequence there was a double up of `callbacks` - **Fixed** line in wrong position - `Ecoportal::API::V1::People#batch` - `Ecoportal::API::Common::ElasticApmIntegration#unexpected_server_error?` - No code or code lesser than 100 is a server error as well ### Changed - `Ecoportal::API::Common::Client`: changed - Logging the **response** of batches or batch jobs can be handy when debugging the back-end - **removed** method `#without_response_logging` - This change entailed to remove dependencies in `Ecoportal::API::V1::People` - Specifically in methods `#batch`, `#job_result` and `#create_job` - `@response_logging_enabled` to be set in initialization stage (added parameter for `.new`) ## [0.8.3] - 2021-05-24 ### Added - `Ecoportal::API::Errors` namespace - `Ecoportal::API::Errors::Base` base error class. - `Ecoportal::API::Errors::TimeOut` error when an api request fails with time out. - This serves the purpose to allow a client script to re-start the process where it stopped by capturing this specific Error - `Ecoportal::API::Common::BaseModel::UnlinkedModel` added more description to track down the source of the error. - `Ecoportal::API::Common::BaseModel#reset!` added parameter `key`, which should try to recover `doc[key]` from `original_doc[key]` - Thanks to this, you are supposed to be able to do things like: - `person.account = nil && person.reset!("account")` - `person.name = nil && person.reset!("name")` - `Ecoportal::API::V1::People#job` methods to provide more information on failure. - Specific changes due to eP **release `1.5.9.70`** (_Policy Group Abilities_) - `Ecoportal::API::Internal::Account#permissions_merged` - `Ecoportal::API::Internal::Permissions#person_abilities` (new ability) - `Ecoportal::API::Internal::Account#user_id` ### Fixed - `Ecoportal::API::Internal::Account`: consistency in setting arrays (`uniq!` & `compact`) - `#policy_group_ids=`, `#login_provider_ids=`, `#starred_ids=` - `Ecoportal::API::Common::HashDiff.diff` was including empty `{}` objects - This change sacrifices the case `account: {}` (which will be also removed from `as_update`), but it should be fine. ### Changed - `Ecoportal::API::V1::People#job` to raise specific error on time out `API::Errors::TimeOut` - Specific changes due to eP **release `1.5.9.70`** (_Policy Group Abilities_) - `Ecoportal::API::Internal::Account` **removed** methods: `#permissions_preset`, `#preset` and `#preset=` - `Ecoportal::API::Internal::Person#account=` added support for `user_id` which should remain unchanged when existing - **remove** from `as_update` **read-only** data - `Ecoportal::API::Common::HashDiff.diff` added parameter `:ignore` (`Array`) - `Ecoportal::API::Common::BaseModel#as_update` added parameter `:ignore` - `Ecoportal::API::V1::Person#as_update` added method, which ignores `subordinates` - `Ecoportal::API::Internal::Person#as_update` added method, which ignores `user_id`, `permissions_merged` and `prefilter` - `Ecoportal::API::Internal::Account#as_update` added method, which ignores `user_id`, `permissions_merged` and `prefilter` - `Ecoportal::API::Common::Client` native support for `elastic-apm` - Via new module `Ecoportal::API::Common::ElasticApmIntegration` with method `log_unexpected_server_error`, which will only log an `UnexpectedServerError` to _ElasticAPM_ if 1. There's a correct configuration: environmental variables `ELASTIC_APM_KEY` and `ELASTIC_APM_ACCOUNT_ID` are defined 2. The `Response` from the server gave `code` in the range `5xx` (which are those under server responsibility) - `Ecoportal::API::Common::Client` added retry logics when `response.status == 5xx` ## [0.8.2] - 2021-02-24 ### Added ### Fixed - `Ecoportal::API::V1::Person#filter_tags=` should ignore `nil` values ### Changed - removed all the namespace under `Ecoportal::API::V2` as that is managed by `ecoportal-api-oozes` gem - url: https://rubygems.org/gems/ecoportal-api-oozes - `Ecoportal::API::V1::People.get` should return a `Person` object - observe that it was returning the `WrappedResponse` (an `Enumerable` helper that works better when getting multiple people). ## [0.7.5] - 2021-02-12 ### Added ### Fixed - `pretty_print` method was colliding with `pp` module: - renamed to `Ecoportal::API::Common::BaseModel#print_pretty` - renamed to `Ecoportal::API::Common::BatchReponse#print_pretty` - renamed to `Ecoportal::API::Common::Reponse#print_pretty` - renamed to `Ecoportal::API::Common::WrappedResponse#print_pretty` ### Changed - forgot to change `Ecoportal::API::VERSION` during last release ## [0.7.4] - 2021-01-2 ### Added ### Fixed - changed `compact` to `compact!`: - `Ecoportal::API::V1::Person#filter_tags=` - `Ecoportal::API::Internal::Account#policy_group_ids=` - `Ecoportal::API::Internal::Account#login_provider_ids=` - `Ecoportal::API::Internal::Account#starred_ids=` ### Changed ## [0.7.3] - 2020-11-30 ### Added ### Fixed - `Ecoportal::API::V1::Person#email=`: was not showing the incorrect value in the error message - added `compact` to remove `null` values on: - `Ecoportal::API::V1::Person#filter_tags=` - `Ecoportal::API::Internal::Account#policy_group_ids=` - `Ecoportal::API::Internal::Account#login_provider_ids=` - `Ecoportal::API::Internal::Account#starred_ids=` ### Changed ## [0.7.2] - 2020-10-19 ### Added - `Ecoportal::API::V1::Person#email=`: - do a minimum validation (no blanks in the email) - set in lower case (as this is how it's in the server) ### Fixed - `Ecoportal::API::V1::People#each`: when `silent` it shouldn't print a blank line - fixed so they return empty array `[]` when `nil`: - `Ecoportal::API::V1::Person#filter_tags` - `Ecoportal::API::Internal::Account#policy_group_ids` - `Ecoportal::API::Internal::Account#login_provider_ids` - `Ecoportal::API::Internal::Account#starred_ids` ### Changed - made it so some methods the `Array` with `uniq` values: - `Ecoportal::API::V1::Person#filter_tags=` - `Ecoportal::API::Internal::Account#policy_group_ids=` - made it so it only updates the keys defined in the `Hash` passed to the setter: - `Ecoportal::API::Internal::Account#permissions_custom=` - `Ecoportal::API::Internal::Account#preferences=` ## [0.7.1] - 2020-09-30 ### Added - `Ecoportal::API::Internal::Permissions`: **update for new ability `tasks` of ecoPortal release `1.5.3`** - `Ecoportal::API::V1::People#each`: added keyword argument `silent:` to display download progress ### Fixed - `Ecoportal::API::V1::People#each`: when no block provided, it was creating an `Enumarator` without preserving the parameters (i.e. `:q` or `per_page` were lost) ## [0.7.0] - 2020-09-11 ### Added - added hook, **private** method `body_data` for child classes to define behaviour on `response.body` to - `Ecoportal::API::V1::People` - `Ecoportal::API::Common::BatchOperation` ### Changed - `Ecoportal::API::Internal::Permissions`: **update for new abilities of ecoPortal release `1.5.2`** - decoupled abilities: `person_core` into `person_core_create`, `person_core_edit` ### Fixed ## [0.6.0] - 2020-07-14 ### Added - `Ecoportal::API::Common::BaseModel#initial_doc`: `#consolidate!` modifies `original_doc` - this helper allows to know what was the initial document the object was created with - `Ecoportal::API::Common::BaseModel#as_update`: added parameter (default: `:last` => compare with `original_doc`) - calling it with `:total` will compare the current `doc` with the `initial_doc` ### Changed - `Ecoportal::API::Internal::Permissions`: **update for new abilities of ecoPortal release `1.5.0`** - added abilities: `person_core`, `person_account`, `person_details` - removed ability: `people` - renamed `print` to `pretty_print` to avoid overriding `$stdout.print`, on: - `Ecoportal::API::Common::BaseModel` - `Ecoportal::API::Common::BatchReponse` - `Ecoportal::API::Common::Response` - `Ecoportal::API::Common::WrappedResponse` ### Fixed - `Ecoportal::API::Internal::Preferences`: **kiosk** settings should default to `false` (`nil`) ## [0.5.8] - 2020-06-23 ### Added ### Changed ### Fixed - `Ecoportal::API::V1::Person#filter_tags=`: `original_doc["filter_tags"]` is `nil` when creating a person - `Ecoportal::API::Internal::Account#policy_group_ids=`: `original_doc["account"]` is `nil` when creating a person ## [0.5.7] - 2020-06-22 ### Added - `Ecoportal::API::V1::PersonSchema`: added `enable_tags` & `tags` properties - `Ecoportal::API::Internal::Preferences`: added missing fields for **kiosk** ### Changed - `Ecoportal::API::V1::People::JOB_TIMEOUT`: from 1 minute to 3 minutes - `Ecoportal::API::V1::Person#filter_tags=`: will preserve the original order of the matching tags * this change is to prevent `as_update` to generate false update positives - `Ecoportal::API::Internal::Account#policy_group_ids=`: will preserve the original order of the matching ids * this change is to prevent `as_update` to generate false update positives ### Fixed - `Ecoportal::API::Internal::Preferences`: access `doc` using string keys (not with `symbol` keys) ## [0.5.6] - 2020-06-08 ### Added - this `CHANGELOG.md` file - person model: `freemium` core property ### Changed ### Fixed