Sha256: af389191d12899a90c9ab5d514f28c48aae156c31a8e07d81abee8995795301c

Contents?: true

Size: 547 Bytes

Versions: 29

Compression:

Stored size: 547 Bytes

Contents

module NCore
  module DeleteSingle
    extend ActiveSupport::Concern

    module ClassMethods
      def delete(params={})
        obj = new
        obj.delete!(params)
      end
    end

    def delete(params={})
      params = parse_request_params(params).reverse_merge credentials: api_creds
      parsed, @api_creds = request(:delete, resource_path, params)
      load(parsed)
      errors.empty? ? self : false
    end

    def delete!(params={})
      delete(params) || raise(self.class.module_parent::RecordInvalid, self)
    end

  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
ncore-3.3.4 lib/ncore/methods/delete_single.rb
ncore-3.3.3 lib/ncore/methods/delete_single.rb
ncore-3.3.2 lib/ncore/methods/delete_single.rb
ncore-3.3.1 lib/ncore/methods/delete_single.rb
ncore-3.3.0 lib/ncore/methods/delete_single.rb
ncore-3.2.1 lib/ncore/methods/delete_single.rb
ncore-3.2.0 lib/ncore/methods/delete_single.rb
ncore-3.1.0 lib/ncore/methods/delete_single.rb
ncore-3.0.0 lib/ncore/methods/delete_single.rb