lib/eco/api/common/people/person_entry.rb in eco-helpers-2.0.16 vs lib/eco/api/common/people/person_entry.rb in eco-helpers-2.0.17
- old
+ new
@@ -208,11 +208,10 @@
# Meaning that if an account property is not present in the entry, this will not be set on the target person.
# @param person [Ecoportal::API::Internal::Person] the person we want to set the account values to.
# @param exclude [String, Array<String>] account properties that should not be set/changed to the person.
def set_account(person, exclude: nil)
person.account = {} if !person.account
- person.account.permissions_preset = nil unless person.account.permissions_preset = "custom"
scoped_attrs = @emap.account_attrs - into_a(exclude)
@final_entry.slice(*scoped_attrs).each do |attr, value|
set_part(person.account, attr, value)
end
end
@@ -288,10 +287,13 @@
# 1. here we tranform internal into external **values**.
# 2. when running the serializers, it overrides existing keys.
# @param internal_entry [Hash] entry with **internal** names and values, but **external** types.
# @return [Hash] entry with **internal** names and **external** values and types.
def _mapped_serializing(internal_entry)
- internal_entry.merge(_serialize_values(internal_entry, :internal))
+ mapped_hash = internal_entry.merge(_serialize_values(internal_entry, :internal))
+ model_attrs = @person_parser.all_model_attrs - ["send_invites"]
+ aux_hash = mapped_hash.slice(*model_attrs)
+ merge_missing_attrs(aux_hash, mapped_hash)
end
# Parsing helper that just **parses the values** that have a parser/serializer defined.
# @note this entry will still miss the type parsing (i.e. to `Array` if `multiple`)
# @param mapped_entry [Hash] the entry with the _internal attribute_ names but the _external values_.