lib/ps_utilities/pre_built_post.rb
# prepare data to update student database extensions
# @param data [Hash] - with the format: {u_students_extension: {field1: data1, field2: data2}}
# @return [Hash] - with data like below:
# { "name"=>"u_students_extension",
#   "recordFound"=>false,
#   "_field"=> [
#     {"name"=>"preferredname", "type"=>"String", "value"=>"Joe"},
#     {"name"=>"student_email", "type"=>"String", "value"=>"joe@las.ch"},
#   ]
# }
prepare data to update student database extensions
prepare data to update student database extensions
def u_students_extension(data)
      db_extensions = { "name"=>"u_students_extension", "recordFound"=>false,
                        "_field"=> [] }
      data.each do |key, value|
        db_extensions["_field"] << {"name"=>"#{key}", "type"=>"String", "value"=>"#{value}"}
      end
      db_extensions
    end
def u_students_extension ( data ) db_extensions = { "name" => "u_students_extension" , "recordFound" => false , "_field" => [ ] } data . each do | key , value | db_extensions [ "_field" ] << { "name" => "#{key}" , "type" => "String" , "value" => "#{value}" } end db_extensions end
prepare data to update student database extensions
prepare data to update student database extensions
None
Hash
data
with the format: {u_students_extension: {field1: data1, field2: data2}}
with the format : { u_students_extension : { field1 : data1 field2 : data2 }}