lib/eco/api/common/people/person_factory.rb in eco-helpers-2.0.25 vs lib/eco/api/common/people/person_factory.rb in eco-helpers-2.0.26
- old
+ new
@@ -8,11 +8,11 @@
# @attr_reader schema_attrs [Array<String>] _inernal names_ of the schema fields/attributes
class PersonFactory
attr_reader :schema, :schema_attrs
- def initialize(person: {}, schema: {}, account: {}, modifier: Common::People::PersonModifier.new)
+ def initialize(person: nil, schema: {}, account: {}, modifier: Common::People::PersonModifier.new)
@modifier = Common::People::PersonModifier.new(modifier)
@person = person
@account = account
@schema = schema
@schema_attrs = @schema&.fields&.map { |fld| fld.alt_id }
@@ -75,10 +75,12 @@
when Ecoportal::API::V1::Person
JSON.parse(person.doc.to_json)
when Hash
JSON.parse(person.to_json)
else
- {}
+ {
+ "subordinates" => 0
+ }
end
end
def details_hash(details)
case details