lib/ecoportal/api/v1/person.rb in ecoportal-api-0.1.3 vs lib/ecoportal/api/v1/person.rb in ecoportal-api-0.1.4

- old
+ new

@@ -37,15 +37,25 @@ end remove_instance_variable("@details") if defined?(@details) return details end - def add_details(schema_id) - self.details = person_details_class.new - self.details.schema_id = schema_id + def add_details(schema_or_id) + self.details = person_details_class.new + case schema_or_id + when person_schema_class + schema_or_id.initialize_details(self.details) + when String + self.details.schema_id = schema_id + end + self.details end private + + def person_schema_class + V1::PersonSchema + end def person_details_class V1::PersonDetails end end