Sha256: 215c22bb8bc7226904b92e825405c9093fdb0f25e9684f41546b50808c26999d
Contents?: true
Size: 1.18 KB
Versions: 5
Compression:
Stored size: 1.18 KB
Contents
module Dhis2 module Api class DataElement < Base class << self def create(client, elements) elements = [elements].flatten category_combo = client.category_combos.find_by(name: "default") data_element = { data_elements: elements.map do |element| { name: element[:name], short_name: element[:short_name], code: element[:code] || element[:short_name], domain_type: element[:domain_type] || "AGGREGATE", value_type: element[:value_type] || "NUMBER", aggregation_type: element[:aggregation_type] || "SUM", type: element[:type] || "int", # for backward compatbility aggregation_operator: element[:aggregation_type] || "SUM", # for backward compatbility category_combo: { id: category_combo.id, name: category_combo.name } } end } response = client.post("metadata", data_element) Dhis2::Status.new(response) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems