Class: Dhis2::Api::Version227::DataElement

Inherits:
Base
  • Object
show all
Includes:
BulkCreatable, Creatable, Deletable, Findable, Listable, Shared::SaveValidator, Updatable
Defined in:
lib/dhis2/api/version227/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::Version227::Constants.aggregation_types
  )
  required(:domain_type).value(
    included_in?: ::Dhis2::Api::Version227::Constants.domain_types
  )
  required(:value_type).value(
    included_in?: ::Dhis2::Api::Version227::Constants.value_types
  )
end

Class Method Summary collapse

Methods included from Shared::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



29
30
31
32
33
34
35
36
37
38
# File 'lib/dhis2/api/version227/data_element.rb', line 29

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