lib/ecoportal/api/v1/person_details.rb in ecoportal-api-0.4.1 vs lib/ecoportal/api/v1/person_details.rb in ecoportal-api-0.4.2
- old
+ new
@@ -20,11 +20,11 @@
# Gets all the fields of the PersonDetails.
# @return [Array<SchemaFieldValue>] the array of fields of the schema.
def fields
return @fields if defined?(@fields)
- @fields = (doc["fields"] || []).map do |field|
- schema_field_value_class.new(field)
+ @fields = (doc["fields"] || []).each_with_index.map do |field, i|
+ schema_field_value_class.new(field, parent: self, key: ["fields", i])
end
end
# Gets one specific field of the PersonDetails.
# @param id [String] the `id` or the `alt_id` of the target field.