Module: ZendeskAPI::Destroy::ClassMethod

Defined in:
lib/zendesk_api/actions.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) destroy(client, attributes = {})



169
170
171
172
173
# File 'lib/zendesk_api/actions.rb', line 169

def destroy(client, attributes = {})
  destroy!(client, attributes)
rescue ZendeskAPI::Error::ClientError
  false
end

- (Object) destroy!(client, opts = {})

Deletes a resource given the id passed in.

Parameters:

  • client (Client)

    The Client object to be used

  • opts (Hash) (defaults to: {})

    The optional parameters to pass. Defaults to {}



158
159
160
161
162
163
164
165
166
167
# File 'lib/zendesk_api/actions.rb', line 158

def destroy!(client, opts = {})
  @client = client # so we can use client.logger in rescue
  association = opts.delete(:association) || Association.new(:class => self)

  client.connection.delete(association.generate_path(opts)) do |req|
    req.params = opts
  end

  true
end