Sha256: 841e1562403475ef1a33851f642b093ffde13ccc600285c2d6f30c4cdb98ed16

Contents?: true

Size: 721 Bytes

Versions: 19

Compression:

Stored size: 721 Bytes

Contents

module NCore
  module UpdateBulk
    extend ActiveSupport::Concern

    module ClassMethods
      def bulk_update!(ids, params={})
        raise(module_parent::RecordNotFound, "ids must not be empty") if ids.blank?
        params = parse_request_params(params, json_root: json_root)
        params[:ids] = ids
        parsed, creds = request(:put, resource_path, params)
        if parsed[:errors].any?
          raise module_parent::BulkActionError, parsed[:errors]
        else
          parsed[:metadata]
        end
      end

      def bulk_update(ids, params={})
        bulk_update!(ids, params)
      rescue module_parent::RecordNotFound, module_parent::BulkActionError
        false
      end
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ncore-3.6.2 lib/ncore/methods/update_bulk.rb
ncore-3.6.1 lib/ncore/methods/update_bulk.rb
ncore-3.6.0 lib/ncore/methods/update_bulk.rb
ncore-3.5.2 lib/ncore/methods/update_bulk.rb
ncore-3.5.1 lib/ncore/methods/update_bulk.rb
ncore-3.5.0 lib/ncore/methods/update_bulk.rb
ncore-3.4.4 lib/ncore/methods/update_bulk.rb
ncore-3.4.3 lib/ncore/methods/update_bulk.rb
ncore-3.4.2 lib/ncore/methods/update_bulk.rb
ncore-3.4.1 lib/ncore/methods/update_bulk.rb
ncore-3.4.0 lib/ncore/methods/update_bulk.rb
ncore-3.3.4 lib/ncore/methods/update_bulk.rb
ncore-3.3.3 lib/ncore/methods/update_bulk.rb
ncore-3.3.2 lib/ncore/methods/update_bulk.rb
ncore-3.3.1 lib/ncore/methods/update_bulk.rb
ncore-3.3.0 lib/ncore/methods/update_bulk.rb
ncore-3.2.1 lib/ncore/methods/update_bulk.rb
ncore-3.2.0 lib/ncore/methods/update_bulk.rb
ncore-3.1.0 lib/ncore/methods/update_bulk.rb