Module: ZendeskAPI::Destroy
- Included in:
- DeleteResource, OauthToken, OrganizationMembership, OrganizationSubscription, Resource, Session, SuspendedTicket, Tag, Topic::TopicComment, Upload
- Defined in:
- lib/zendesk_api/actions.rb
Defined Under Namespace
Modules: ClassMethod
Class Method Summary collapse
Instance Method Summary collapse
-
#destroy(&block) ⇒ Object
Destroys, returning false on error.
-
#destroy! ⇒ Boolean
If this resource hasn’t already been deleted, then do so.
-
#destroyed? ⇒ Boolean
Has this object been deleted?.
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.
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?
190 191 192 |
# File 'lib/zendesk_api/actions.rb', line 190 def destroyed? @destroyed ||= false end |