Module: Dhis2::Api::Shared::DataValueSet::ClassMethods
- Defined in:
- lib/dhis2/api/shared/data_value_set.rb
Instance Method Summary collapse
- #bulk_create(client, args, raw_input = false) ⇒ Object
- #list(client, options = {}, raw = false) ⇒ Object
Instance Method Details
#bulk_create(client, args, raw_input = false) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/dhis2/api/shared/data_value_set.rb', line 27 def bulk_create(client, args, raw_input = false) response = client.post(path: resource_name, payload: args, raw_input: raw_input) ::Dhis2::Api::ImportSummary.new(response).tap do |summary| unless summary.bulk_success? exception = Dhis2::BulkCreationError.new("Didnt create bulk of data properly.\n Response: #{response.to_json}") exception.import_summary = summary raise exception end end end |
#list(client, options = {}, raw = false) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dhis2/api/shared/data_value_set.rb', line 12 def list(client, = {}, raw = false) response = super(client, , raw) if raw response["dataValues"] else if response["data_values"] response["data_values"].map do |elt| OpenStruct.new(elt) end else [] end end end |