Module: ZendeskAPI::Destroy

Defined Under Namespace

Modules: ClassMethod

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



185
186
187
# File 'lib/zendesk_api/actions.rb', line 185

def self.included(klass)
  klass.extend(ClassMethod)
end

Instance Method Details

#destroy(&block) ⇒ Object

Destroys, returning false on error.



207
208
209
210
211
# File 'lib/zendesk_api/actions.rb', line 207

def destroy(&block)
  destroy!(&block)
rescue ZendeskAPI::Error::ClientError
  false
end

#destroy!Boolean

If this resource hasn’t already been deleted, then do so.

Returns:

  • (Boolean)

    Successful?



196
197
198
199
200
201
202
203
204
# File 'lib/zendesk_api/actions.rb', line 196

def destroy!
  return false if destroyed? || new_record?

  @client.connection.delete(url || path) do |req|
    yield req if block_given?
  end

  @destroyed = true
end

#destroyed?Boolean

Has this object been deleted?

Returns:

  • (Boolean)


190
191
192
# File 'lib/zendesk_api/actions.rb', line 190

def destroyed?
  @destroyed ||= false
end