# Change Log All notable changes to this project will be documented in this file. ## [0.8.34] - 2022-09-xx ### Added ### Changed ### Fixed ## [0.8.33] - 2022-09-23 ### Changed - `Ecoportal::API::Common::Content::DoubleModel#embeds_many`: added new_class name collision prevention ### Fixed - `Ecoportal::API::Common::ClassHelpers.new_class`: should accept `name` parameter to be a class itself ## [0.8.32] - 2022-09-19 ### Added - `Ecoportal::API::V2::Pages::PageCreateResponse` to wrap the response on creation ### Changed - `Ecoportal::API::V2::Pages#create` to rather return a `PageCreateResponse` ### Fixed - `Ecoportal::API::V2::Pages#create` to make sure new page with no changes can be created. ## [0.8.31] - 2022-09-15 ### Added - `Ecoportal::API::Common::Content::ClassHelpers.uid` to generate a random uid ### Changed - added **inheritable attributes** to - `Ecoportal::API::Common::Content::ArrayModel` (:order_matteres, :uniq) - `Ecoportal::API::Common::Content::CollectionModel` (klass, :order_matters, :order_key, :items_key, :new_item) - `Ecoportal::API::Common::Content::DoubleModel` (:key) - moved `SecureRandom` dependency to `Ecoportal::API::Common::Content::ClassHelpers` ### Fixed - `Ecoportal::API::V2::Page::Component::SelectionOption#numeric!` fix conversion - `Ecoportal::API::Common::Content::ClassHelpers`, `new_class` - **Added** parameter `namespace` (default: the class `inherits` parameter): it's purpose is to define the namespace where the new class will sit - **Fixed** also the namespace where the new class constant will sit (it was using always the source class `self`) - **Improved** `name` parameter to have a default value that is randomized. This is useful when we just want to do something like `SomeClass.new_class`, where the name of the new class doesn't really matter. - **Fixed** lost reference of class resolvers when using `embeds_many` - `Ecoportal::API::Common::Content::ClassHelpers`, `resolve_class` accepts now a `Hash` with `key` referrer class, and `value` any of the previously accepted ones (i.e. `Symbol` or `String`). To this purpose, `source_class` parameter has been added. - This has been natively wrapped in `Ecoportal::API::Common::Content::DoubleModel.embeds_many`, as it naturally shares the `class_resolver` with a third party class that loses the reference. ## [0.8.30] - 2022-07-11 ### Added - `Ecoportal::API::V2::Page::MoultCounter` - Available on `Ecoportal::API::V2::Pages::PageStage` - `Ecoportal::API::V2::Page::Component#Law` added support for `LawField` content - where `Ecoportal::API::V2::Page::Component#LawField` has many of - `Ecoportal::API::V2::Component` added parameter `any_length:` for - `#ref` and `#indexable_label` (aiming to enhance data exportability) ### Changed - Reviewed `to_s` method on multiple components, to ensure smooth export ### Fixed - `Ecoportal::API::V2::Pages::PageStage#uid` - Should check if `mould_conter` exists - Should return `id` if `mould_counter` does not exist - **Exports** - `Ecoportal::API::V2::Pages::Component::PeopleField#to_s`: fix type conversion - `Ecoportal::API::V2::Pages::Component::DateField#to_s`: make time to work to the local timezone where the client script runs ## [0.8.29] - 2022-07-07 ### Added - `Ecoportal::API::V2::Page::Component::ActionField#permitted_person_schema_ids` - Integration for the new feature - `Ecoportal::API::V2::Pages::PageStage#uid` new method for directly rendering the uid ### Changed - `Ecoportal::API::V2::Page::Component::PeopleField#configure_permits` - Allow for `can_view` to prevent unnecessary errors ### Fixed - `Ecoportal::API::V2::Page::PermissionFlags#configure` fixed typo ## [0.8.28] - 2022-05-31 ### Added - `Ecoportal::API::V2::Page::Component::File` added `label` - `Ecoportal::API::V2::Page::Component::Image` added `upload_id` and `file_file_name` ## [0.8.27] - 2022-04-25 ### Added - `Ecoportal::API::Common::Content::CollectionModel#clear` - It calls `#delete!` on each item from an `Array` copy - `Ecoportal::API::V2::Page::Components#add` - Now it allows to use a `Hash` _doc_ model to create the `Component` - `Ecoportal::API::V2::Page::Component::SelectionField` **added** some methods: - `#numeric?`, `#text?` to check the `data_type` of the _selection options_ - `#switch_type!` to switch the `data_type` between `txt` and `num` - `#deselect` to mark as `false` the property `selected` of some _selection option_ - `#name` counterpart of `#value` - `#values` and `#names` they return always an `Array` (no matter if the field is **not** `multiple`) - `#options_by_value` which returns a `Hash` with all the options by their `value` - `#options_by_name` which returns a `Hash` with all the options by their `name` - `Ecoportal::API::V2::Page::Component` **added** some methods: - `#forces`, `#bindings` and `#bindings?` to check if a _Component_ has bindings in what forces and what those bindings are. - `Ecoportal::API::V2::Page::Force#bind` to add a _binding_ - `Ecoportal::API::V2::Page::Force::Binding` **added** a couple of methods: - `#force` to refer to the _Force_ object of a binding - `#reference` to retrieve the _component_ or _section_ the binding refers to - `Ecoportal::API::V2::Page::Force::Bindings` **added** some methods: - `#force` to refer to the _Force_ object of the bindings - `#by_name` and `#by_reference` to obtain a `Hash` with all the _bindings_ - `#reference?` to check if a _section_ or _component_ have a binding to the _force_ - `#get_by_reference` to retrieve an `Array` with all the _bindings_ to one _section_ or _component_ - `Ecoportal::API::V2::Page::Forces#bindings_by_reference` - For (script) **optimization** purposes. It gets all the _bindings_ as a `Hash` of _reference_ to `Array` - `Ecoportal::API::V2::Page::Section` **added** some methods: - `#shared?` to know if the _section_ is shared by multiple stages - `#bindings` to obtain the _bindings_ of the _section_ in any _force_ - `#forces` all the _forces_ that this _section_ has a _binding_ to - `#bindings?` whether or not the _section_ has any force _binding_ - `Ecoportal::API::V2::Page::Sections` **added** some methods: - `#any_shared?` whether or not there are shared sections - `#move` to **move** the _section_ to some specific position ### Changed - `ecoportal-api` dependency upgrade - `Ecoportal::API::V2::Page::PermissionFlags#configure` - Added option to pass a `Hash` with pairs `Symbol`, `Boolean` - `flags.configure {subscribed: true}` - `Ecoportal::API::Common::Content::ModelHelpers#same_string?` - Added parameter `mild:` to compare the strings with only alphabetic characters - `Ecoportal::API::V2::Page::Component::SelectionField` **added** some methods: - `#selected` **added** parameters to modify the _returned_ value - `by_name:` and `by_value:` to return a `Hash` - `value:` and `name:` which combines respectively with the above, to cast them in the `Hash` - `Ecoportal::API::V2::Page::Sections#get_by_heading` - added `mild:` option to allow more flexibility on searches ### Fixed - `Ecoportall::API::Common::Content::DoubleModel#dirty?` - It was checking that `#as_update` equaled `{}`. Now it also checks on `null` too. - `Ecoportal::API::V2::Page::Component::SelectionOption#numeric!` - It was using `to_i` which would return `0` when the source `value` was not numeric. - Now it uses `Float(value)`, provided that it can throw an exception - `Ecoportal::API::V2::Pages::Stages#get` - The _page_ `id` and `stage_id` were used exchanged in the message - `Ecoportal::API::V2::Page::Forces` fixed the `weight` (position) scoping - It was not positioning correctly - `Ecoportal::API::V2::Page::Sections` fixed the `weight` (position) scoping - It was not positioning correctly ## [0.8.26] - 2022-03-25 ### Added `Ecoportal::API::V2::Page::Stage#add_permit` `Ecoportal::API::V2::Page::Permit.new_doc` ## [0.8.25] - 2022-02-04 ### Added - `Ecoportal::API::V2::Page::Component::ReferenceField#add` to add new references ### Changed - `Ecoportal::API::Common::Content::HashDiffPatch#patch_data` - Added support for model objects with no `patch_ver` (so diffs are calculated as well) ## [0.8.24] - 2022-01-05 ### Fixed - `Ecoportal::API::V2::Page#stages?` do not generate an object to this purpose - `Ecoportal::API::V2::Registers#search` fix typo in print feedback ## [0.8.23] - 2021-12-24 ### Added - `Ecoportal::API::V2::Registers#search` added more feedback on what is going on ## [0.8.22] - 2021-12-23 ### Fixed - `Ecoportal::API::V2::Page::Section#add_component` was not using correctly `before` and `after` - It was not correctly translating them into the existing component ## [0.8.21] - 2021-12-15 ### Added - To children of `Ecoportal::API::V2::Page::Component` added method `#to_s` (for exporting) - `Ecoportal::API::V2::Page::Component::ReferenceField` - added `#references` (the lookup results) - added `#reference_ids` (the `ids` of the referenced oozes) ### Changed - Re-exposed `Ecoportal::API::V2::Stages#ordered` ### Fixed - `Ecoportal::API::V2::Page::Component::ImagesField#images` typo in `klass` ## [0.8.20] - 2021-12-09 ### Changed - `Ecoportal::API::V2::Pages::PageStage#permits` removed - The reason is that it should be changed using the `Stage#permits` instead - Upgraded `ecoportal-api` gem dependency ### Fixed - `Ecoportal::API::V2::Page::Stage#sections` typo ## [0.8.19] - 2021-09-29 ### Changed - Moved validation of components multi-section from `PageStage` to `Page` - Removed validation from `PageStage#as_update` - This means that the validation will not run natively, but in the client lib ### Fixed - `Ecoportal::V2::Page::Stage#section?` fixed typo - `Ecoportal::V2::Page::Stage` - `#attached?` added missing code - `#component?` fixed typo ## [0.8.18] - 2021-09-29 ### Fixed - typo in `PageStage#validate` ## [0.8.17] - 2021-09-29 ### Fixed - Typo in `Section#attached?` ## [0.8.15] - 2021-09-29 ### Fixed - Typo in `Section#component?` ## [0.8.14] - 2021-09-28 ### Added - `Ecoportal::API::Common::Content::CollectionModel` - `#_doc_pos` for clarity - `#include?` to check if an element is present in the collection - `Ecoportal::API::V2::Page::Stage#section?` check if section belongs to stage - `Ecoportal::API::V2::Page::Sections` - `#get_by_id` - `#unattached` sections that are not attached to any stage - `Ecoportal::API::V2::Page::Section` - `#add_component` **added** parameter `before`: to cover case where you want to add it at the beginning - `#component?` **widened** parameter type - `#stages` stages where this section is attached - `attached?` whether or not the section is attached - `Ecoportal::API::V2::Page::Component` - `#attached?` whether or not the field is attached to some section - `#multi_section?` if the field is attached to more than one section :/ - **added** support for `forces` - `Ecoportal::API::V2::Page::Force` - `Ecoportal::API::V2::Page::Forces` - `Ecoportal::API::V2::Page::Force::Binding` - `Ecoportal::API::V2::Page::Force::Bindings` - **added** shortcut to `#ooze` throughout all the model - **validations** in some methods - `Ecoportal::API::V2::Page::Stage#add_section`: section should be in `ooze.sections` - `Ecoportal::API::V2::Page::Section#add_component`: component should be in `ooze.components` - `Ecoportal::API::V2::Page::Force::Bindings#add`: - section to be in `ooze.sections` - component to be in `ooze.components` - `Ecoportal::API::V2::Pages::PageStage#as_update` on page instances, it checks that - Fields do not belong to more than one section - Fields belong at least to one section - Sections belong to at least one stage ### Fixed - `Ecoportal::API::Common::Content::ArrayModel#insert_one` was not inserting when not found. Should insert at least at the end. ## [0.8.13] - 2021-09-03 ### Fixed - `Ecoportal::API::V2::Page::Sections` - `weight` fixing should only happen on entire page, **not** on stage sections that could change the order of section shared with other stages - `#scope_weight` was not excluding the section when using `weight` of the last one - Several classes with `embeds_many` were performing the `ordering` of those elements in the wrong way - `Ecoportall::API::Common::Content::DoubleModel` - `#replace_original_doc` had a couple of typos - `#replace_doc` should only remove the variable referring to the current object and only if `new_doc` is `nil` - `Ecoportal::API::Common::Content::CollectionModel` on insertion and deletion it was removing instance variable objects. - There was no need for this approach, as the only necessary thing is to just keep those variable instances up to date in the correct unique access point to do so. - Aside note: the reason why this was initially designed this way is because there were some difficulties to identify the existing elements in the subjacent model. Once `#passkey` as added, this difficulty could be overcome. - `Ecoportal::API::Common::Content::ArrayModel` on initialize, default `doc` should be an `Array` ## [0.8.12] - 2021-08-30 ### Added - `Ecoportal::API::V2::Pages::PageStage#current_stage` ### Fixed - `Ecoportal::API::Common::Content::DocHelpers#get_body` typo and wrong parameters on call. - `Ecoportal::API::V2::Pages#update` should always return `Result` object. - `Ecoportal::API::V2::Registers#search` was not using `cursor_id` to iterate. ## [0.8.11] - 2021-08-27 ### Added - `Ecoportal::API::V2::Page#stages?` - `Ecoportal::API::V2::Pages::PageStage#current_stage_id` - `Ecoportal::API::V2::Registers#search` added option keyed parameter `:only_first` - which will make the method return the first `Ecoportal::API::V2::Registers::SearchResults` - This has been **added** with the aim of knowing how many results out of how many entries. ### Changed - `Ecoportal::API::V2::Pages::PageStage#update` won't update unless there's something to update. ### Fixed ## [0.8.10] - 2021-08-22 ### Added - `Ecoportal::API::Common::Content::CollectionModel#[]` now supports position as well - `Ecoportal::API::V2::Page::Component::FilesField#add_file`: support for adding files - `Ecoportal::API::V2::Page::Component::PeopleField#viewable_fields`: support for managing `viewable_fields` ### Changed ### Fixed - `Ecoportal::API::V2::Page::Component::FilesField`: was not requiring `File` - `Ecoportal::API::V2::Page::Component::NumberField#value`: it was missing :/ - `Ecoportal::API::Common::Content::HashDiffPatch` did not support nested objects in Arrays, where the nested object wouldn't have a `patch_ver`. This **fix** allows for it - `Ecoportal::API::Common::Content::DoubleModel.passforced` to define `methods` that should always be present. This allows to define `patch_ver` as a forced `key` in models that have it - The enforcement (`self.class.enforce!`) happens on `initialize` - `passenforced` subjacent model `forced_model_keys` is inheritable - `Ecoportal::API::Common::Content::CollectionModel`: - Method `upsert!` was not working fine the parameters `pos`, `before` and `after` - Method `delete!` did not support position ## [0.8.9] - 2021-08-16 ### Added - `Ecoportal::API::Common::Content::ModelHelpers` - Starting with `#same_string?`, this lib aims to offer a full set of helper comparers. - `Ecoportal::API::V2::Page::Components#get_by_id` - In future changes, method `[]` might be overriding the method of the parent class `CollectionModel`. - `Ecoportal::API::V2::Page::PermissionFlags` to offer support to `can_permission`, `subscribed`, etc. - `Ecoportal::API::V2::Page::Section#add_component` super handy helper to add fields to sections. - `Ecoportal::API::V2::Page::Component::PeopleField#delete` to remove people using their ids. - `Ecoportal::API::V2::Page::Component::GeoField` **added** suport for `#coordinates` - With embedded object `Ecoportal::API::V2::Page::Component::GeoCoordinates` - `#configure` method, to all the `Component` types (but `ChartField` s) - This method allows to quickly set field properties. - `Ecoportal::API::V2::Page::Sections#between`, aiming to obtain sections between two other ones ### Changed - `Ecoportal::API::V2::Page::Section` real support for `split` sections (right vs left) - This is actually a **FIX** - `Ecoportal::API::V2::Page::Component::DateField#create_event` - Now it switches to _allow future dates_ - `Ecoportal::API::V2::Page::Component::SelectionField#add_option`, the `name` parameter is now optional - This change aims to make it consistent with the back-end. - To its actual `Boolean` type some properties - All `Component` types ### Fixed - `Ecoportal::API::Common::Content::HashDiffPatch` did not support `Hash` values without `id` or `patch_ver` - This fix should allow them to flow to the update - `Ecoportal::API::V2::Page::Component::ChartField` did not have `doc` for `mode` based configuration - `Ecoportal::API::Common::Content::ArrayModel#insert_one` - When `pos`, `before` & `after` were `nil` it was failing to attach the element. - `Ecoportal::API::V2::Page::Sections#add` was not adding in the correct order - `Ecoportal::API::V2::Page::Section.new_doc` was unnecessarily giving `9999` as default weight ## [0.8.8] - 2021-08-03 ### Added - `Ecoportal::API::V2::Page::Component::ChartField::Benchmark` - Support to convert selection options between numeric and text type. - Add `Permit` object to `Page` and `Stage` ### Changed - Removed `Stages.ordered_stages`: detected bug with Enumerable iteration ## [0.8.7] - 2021-05-25 ### Changed - Upgrade `ecoportal-api` gem ### Fixed - Requiring `api/common` from 2 different ends ## [0.8.6] - 2021-02-23 ### Added - `Ecoportal::API::V2::Page::Component::SelectionField` added methods `#numeric!` `#text!` ## [0.8.5] - 2021-02-22 ### Changed - upgrade ## [0.8.4] - 2021-02-22 ### Changed - roll back `ecoportal-api` dependency ## [0.8.3] - 2021-02-22 ### Changed - updated `rspec` for expected patch data on `delete` operation. ### Fixed - More specific namespace path for `Internal::People` namespace ## [0.8.2] - 2021-02-21 ### Changed - some necessary changes for the new gem to be active ## [0.8.1] - 2021-02-21 ### Changed - renamed parameters (backwards incompatible change): - `Ecoportal::API::V2::Pages::Stages` methods `#get` and `#update` - updated `Ecoportal::API::V2::Pages#` accordingly ## MOVED TO GEM `ecoportal-api-v2` ## ## [0.7.5] - 2021-02-21 ### Added - `Ecoportal::API::Common::ClassHelpers` added inheritable attribute values - `Ecoportal::API::V2::Pages::PageStage` added missing properties - `Ecoportal::API::V2::Page::Stages#ordered_stages` method to obtain stages in order - `Ecoportal::API::V2::Registers#search` method search pages in the register, which includes new classes: - `Ecoportal::API::V2::Registers::PageResult` - `Ecoportal::API::V2::Registers::StagesResult` - `Ecoportal::API::V2::Registers::StageResult` - `Ecoportal::API::V2::Pages#get` added parameter `stage_id:` to be able to directly obtain the stage ### Changed - Moved some classes to the new namespace `Ecoportal::API::V2::Registers` - `Ecoportal::API::V2::Registers::Register` - `Ecoportal::API::V2::Registers::Template` ### Fixed - `Ecoportal::API::Common::Content::HashDiffPatch`: `deleted` operation wording and `data.patch_ver` - `Ecoportal::API::V2::Page::Component.new_doc` should delegate to child classes that have their own implementation - `Ecoportal::API::V2::Page::Component::ImagesField.new_doc` should include `layout` - `Ecoportal::API::V2::Page::Component::SignatureField.new_doc` should include `color` ## [0.7.4] - 2021-02-12 ### Added - `Ecoportal::API::V2::Page::Component::GaugeStop#color=` enabled setting colours using a `symbol` - `:blue`, `:blue_greyed`, `:blue_light` - `:turquoise`, `:jade`, `:green`, `:pistachio`, `:avocado` - `:yellow`, `:orange`, `:pumpkin`, `:red`, `:magenta`, `:fuchsia`, `:purple`, `:violet` - `Ecoportal::API::V2::Page::Component::GaugeStop#color_sym` to get the color as `symbol` name - added support for chart fields: - `Ecoportal::API::V2::Page::Component::ChartField` with the different `mode` types - `Ecoportal::API::V2::Page::Component::ChartFrField` (LTIFR) ### Changed - `Ecoportal::API::Page::Component::DateField` Date objects + Timezones - `#value` should be shown in local time - `#value=` should be set by local time - `Ecoportal::API::Common::Content::DoubleModel.embeds_multiple` renamed to `embeds_many` - `Ecoportal::API::Common::Content::DoubleModel.embeds_one` removed parameter `:multiple` - Fields under `Ecoportal::API::Page::Component` that `embeds_many` should generate new elements in a standard way - added `Ecoportal::API::Common::Content::CollectionModel#items_class` method ### Fixed - solved `pretty_print` name collision renaming to `Ecoportal::API::Common::Content::DoubleModel#print_pretty` ## [0.7.3] - 2021-02-01 ### Added - `Ecoportal::API::Common::Content::CollectionModel#delete!` finally scoped how delete should work :) - `Ecoportal::API::V2.new` better feedback on key error. - `Ecoportal::API::V2::Page::Component::SignatureField` added property `signed_by_name` - `Ecoportal::API::V2::Page::Component#required` this field property is currently supported - `Ecoportal::API::V2::Page::Component::DateField` more supported properties: * `show_time`, `today_button`, `past_only`, `create_event`, `remind_me_in`, `renews`, `renews_every`, `renews_unit`, `renews_until` - `Ecoportal::API::V2::Page::Component::ChecklistField` * added more methods: `add_item`, `ordered_items` - `Ecoportal::API::V2::Page::Component::GaugeField` * more supported properties: `max`, `active_color` and `stops` - for `stops` added class `Ecoportal::API::V2::Page::Component::GaugeStop` * added more methods: `add_stop`, `ordered_stops` - `Ecoportal::API::V2::Page::Component::ReferenceField` more supported properties: * `register_id`, `hide_create`, `hide_attach`, `hide_metadata`, `hide_dashboards`, `display_fields`, `display_fields_in_lookup` - `Ecoportal::API::V2::Page::Component::ActionField` * more supported properties:`create_actions`, `required_number_of_completed_actions`, `permits_and_rules_integration`, `add_subscribed`, `add_subscribed_to_tasks` * added more methods: `add_task`, `ordered_tasks` - `Ecoportal::API::V2::Page::Component::Action` modified, provided that some properties are `read_only` - `Ecoportal::API::V2::Page::Component::PeopleField` more supported properties: * `is_me_button`, `attach_mode`, `person_schema_id`, `viewable_fields`, `singular`, `requires_number`, `cached_people`, `attached_people_permissions_enabled`, `apply_attached_people_permissions_to`, `attached_people_permissions_editable`, `attached_people_permissions_flags` - `Ecoportal::API::V2::Page::Component::PlainTextField` more supported properties: * `multiline`, `max_length`, `exact_index` - `Ecoportal::API::V2::Page::Component::SelectionField` more supported properties: * `flat` - `Ecoportal::API::V2::Page::Component::TagField` more supported properties: * `single_select`, `use_defaults`, `tag_tree_id`, `button_text` - `Ecoportal::API::V2::Page::Section` more supported properties: * `minimized` ### Changed - upgraded `ecoportal-api` dependency ### Fixed - `Ecoportal::API::Common::Content::CollectionModel#upsert!` was not actually moving the element to the new position when it already existed ## [0.7.2] - 2020-10-07 ### Added - automatic key builder - helper: `Ecoportal::API::V2::v2key` method - `user_key:` and `org_key:` as constructor methods for `Ecoportal::API::V2` ## [0.7.1] - 2020-10-07 ### Changed - updated dependencies ## [0.7.0] - 2020-09-10 ### Changed - updated dependencies ## [0.6.1] - 2020-07-11 ### Added - `Ecoportal::API::Common::Content::DoubleModel#pretty_print` ## [0.6.0] - 2020-07-11 ### Changed - upgraded `ecoportal-api` gem ## [0.5.9] - 2020-07-02 ### Added - helper `Ecoportal::API::Common::Content::StringDigest#indexable_label`: to see the part of a label that gets indexed - this `CHANGELOG.md` file