Module: RealPush::API::BaseDestroy

Extended by:
ActiveSupport::Concern
Defined in:
lib/realpush/api/base_destroy.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/realpush/api/base_destroy.rb', line 6

def self.included(base)
  base.class_eval do
    def destroy(id)
      content = execute :delete, url("#{self.class.params[:base_path]}/#{id}.json")
      content.status == 204
    rescue RealPush::HTTPError => e
      {
          status: :ERROR,
          message: e.message
      }
    end
  end
end