lib/dhis2/api/bulk_creatable.rb in dhis2-3.0.3 vs lib/dhis2/api/bulk_creatable.rb in dhis2-3.0.4
- old
+ new
@@ -7,15 +7,17 @@
base.extend(ClassMethods)
end
module ClassMethods
- BulkCreationStatusClass = ::Dhis2::Api::ImportSummary
+ def bulk_creation_status_class
+ ::Dhis2::Api::ImportSummary
+ end
# args is a hash like: { data_element_groups: [{ name: "foo" }, { name: "bar" }] }
def bulk_create(client, args, raw_input = false)
response = client.post(path: "metadata", payload: args, raw_input: raw_input)
- self::BulkCreationStatusClass.new(response).tap do |summary|
+ bulk_creation_status_class.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