Sha256: e669d323ad8f5845f26301bfdc60879e31705023f9b032557a7285b0edef8994

Contents?: true

Size: 658 Bytes

Versions: 3

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

module Dhis2
  module Api
    class CategoryCombo < Base
      class << self
        def defaut
          find_by(name: "default")
        end

        def create(client, combos)
          combos = [combos].flatten
          category_combo = {
            categoryCombos: combos.map do |combo|
              {
                name:                combo[:name],
                data_dimension_type: combo[:aggregation_type] || "DISAGGREGATION"
              }
            end
          }

          response = client.post("metadata", category_combo)
          Dhis2::Status.new(response)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dhis2-2.3.8 lib/dhis2/api/category_combo.rb
dhis2-2.3.7 lib/dhis2/api/category_combo.rb
dhis2-2.3.6 lib/dhis2/api/category_combo.rb