Class: Dhis2::Api::Version224::DataElement

Inherits:
Base
  • Object
show all
Includes:
BulkCreatable, Creatable, Deletable, Findable, Listable, Updatable, SaveValidator
Defined in:
lib/dhis2/api/version224/data_element.rb

Constant Summary collapse

Schema =
Dry::Validation.Schema do
  required(:name).filled
  required(:short_name).filled
  required(:aggregation_type).value(
    included_in?: ::Dhis2::Api::Version224::Constants.aggregation_types
  )
  required(:domain_type).value(
    included_in?: ::Dhis2::Api::Version224::Constants.domain_types
  )
  required(:value_type).value(
    included_in?: ::Dhis2::Api::Version224::Constants.value_types
  )
  required(:category_combo).schema do
    required(:id).filled
  end
end

Class Method Summary collapse

Methods included from SaveValidator

included

Methods included from Deletable

#delete

Methods included from Updatable

#update, #update_attributes

Methods included from BulkCreatable

included

Methods included from Creatable

included

Methods included from Findable

included

Methods included from Listable

included

Methods inherited from Base

#==, #initialize, resource_key, resource_name, #to_h

Constructor Details

This class inherits a constructor from Dhis2::Api::Base

Class Method Details

.creation_defaults(args) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/dhis2/api/version224/data_element.rb', line 32

def self.creation_defaults(args)
  {
    aggregation_type:    "SUM",
    code:                args[:short_name],
    domain_type:         "AGGREGATE",
    type:                "int",
    value_type:          "NUMBER",
    zero_is_significant: true
  }
end