Class: ZendeskAPI::Resource
- Inherits:
-
DataResource
- Object
- Data
- DataResource
- ZendeskAPI::Resource
- Extended by:
- Read
- Includes:
- Create, Destroy, Update
- Defined in:
- lib/zendesk_api/resource.rb
Overview
Represents a resource that can CRUD (create, read, update, delete).
Direct Known Subclasses
Activity, Bookmark, Category, Forum, ForumSubscription, Group, GroupMembership, MobileDevice, OAuthClient, Organization, OrganizationField, Request, Rule, SingularResource, Ticket, Ticket::Tag, TicketField, Topic, TopicSubscription, User, User::Identity, UserField
Instance Attribute Summary (collapse)
-
- (ZendeskAPI::Association) association
inherited
from Data
The association.
-
- (Hash) attributes
(also: #to_param)
inherited
from Data
readonly
The resource's attributes.
-
- (Object) error
inherited
from DataResource
Returns the value of attribute error.
-
- (Object) error_message
inherited
from DataResource
Returns the value of attribute error_message.
-
- (Array) errors
inherited
from Data
The last received errors.
-
- (Object) response
inherited
from Data
Place to dump the last response.
Class Method Summary (collapse)
-
+ (Object) find(client, options = {})
extended
from Read
Finds, returning nil if it fails.
-
+ (Object) find!(client, options = {})
extended
from Read
Finds a resource by an id and any options passed in.
Instance Method Summary (collapse)
-
- (Object) clear_associations
included
from Save
Removes all cached associations.
- - (Object) destroy included from Destroy
-
- (Boolean) destroy!
included
from Destroy
If this resource hasn't already been deleted, then do so.
-
- (Boolean) destroyed?
included
from Destroy
Has this object been deleted?.
-
- (Object) save(options = {})
included
from Save
Saves, returning false if it fails and attaching the errors.
-
- (Boolean) save!(options = {})
included
from Save
If this resource hasn't been deleted, then create or save it.
-
- (Object) save_associations
included
from Save
Saves associations Takes into account inlining, collections, and id setting on the parent resource.
Constructor Details
This class inherits a constructor from ZendeskAPI::Data
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ZendeskAPI::Data
Instance Attribute Details
- (ZendeskAPI::Association) association Originally defined in class Data
The association
- (Hash) attributes (readonly) Also known as: to_param Originally defined in class Data
The resource's attributes
- (Object) error Originally defined in class DataResource
Returns the value of attribute error
- (Object) error_message Originally defined in class DataResource
Returns the value of attribute error_message
- (Array) errors Originally defined in class Data
The last received errors
- (Object) response Originally defined in class Data
Place to dump the last response
Class Method Details
+ (Object) find(client, options = {}) Originally defined in module Read
Finds, returning nil if it fails
+ (Object) find!(client, options = {}) Originally defined in module Read
Finds a resource by an id and any options passed in. A custom path to search at can be passed into opts. It defaults to the Data.resource_name of the class.
Instance Method Details
- (Object) clear_associations Originally defined in module Save
Removes all cached associations
- (Object) destroy Originally defined in module Destroy
- (Boolean) destroy! Originally defined in module Destroy
If this resource hasn't already been deleted, then do so.
- (Boolean) destroyed? Originally defined in module Destroy
Has this object been deleted?
- (Object) save(options = {}) Originally defined in module Save
Saves, returning false if it fails and attaching the errors
- (Boolean) save!(options = {}) Originally defined in module Save
If this resource hasn't been deleted, then create or save it. Executes a POST if it is a Data#new_record?, otherwise a PUT. Merges returned attributes on success.
- (Object) save_associations Originally defined in module Save
Saves associations Takes into account inlining, collections, and id setting on the parent resource.