lib/ecoportal/api/v1/person.rb in ecoportal-api-0.1.1 vs lib/ecoportal/api/v1/person.rb in ecoportal-api-0.1.2

- old
+ new

@@ -26,18 +26,23 @@ def details=(value) case value when NilClass doc["details"] = nil - when V1::PersonDetails - doc["details"] = JSON.parse(value.to_json) + when person_details_class + doc["details"] = value.as_json when Hash doc["details"] = value.slice("schema_id", "fields") else raise "Invalid set on details: Need nil, PersonDetails or Hash; got #{value.class}" end - remove_instance_variable("@details") + 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 end private def person_details_class