Class: ZendeskAPI::App
- Inherits:
-
Resource
- Object
- Data
- DataResource
- Resource
- ZendeskAPI::App
- Defined in:
- lib/zendesk_api/resources.rb
Defined Under Namespace
Instance Attribute Summary
Attributes inherited from DataResource
Attributes inherited from Data
#association, #attributes, #errors, #response
Class Method Summary collapse
- .create!(client, attributes = {}, &block) ⇒ Object
- .installations(client, *args, &block) ⇒ Object
- .uploads(client, *args, &block) ⇒ Object
Instance Method Summary collapse
-
#attributes_for_save ⇒ Object
Don’t nest attributes.
- #handle_response(response) ⇒ Object
-
#initialize(client, attributes = {}) ⇒ App
constructor
A new instance of App.
Methods included from Destroy
#destroy, #destroy!, #destroyed?, included
Methods included from Update
Methods included from Save
#clear_associations, #save, #save!, #save_associations
Methods included from Create
Methods included from Read
Methods included from Sideloading
Methods included from Verbs
Methods inherited from Data
#==, #id, inherited, #loaded_associations, #method_missing, namespace, new_from_response, #new_record?, #path, resource_name, resource_path, singular_resource_name, subclasses, #to_json, #to_s
Methods included from Associations
Constructor Details
#initialize(client, attributes = {}) ⇒ App
Returns a new instance of App.
868 869 870 871 872 |
# File 'lib/zendesk_api/resources.rb', line 868 def initialize(client, attributes = {}) attributes[:upload_id] ||= nil super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ZendeskAPI::Data
Class Method Details
.create!(client, attributes = {}, &block) ⇒ Object
874 875 876 877 878 879 880 |
# File 'lib/zendesk_api/resources.rb', line 874 def self.create!(client, attributes = {}, &block) if file_path = attributes.delete(:upload) attributes[:upload_id] = client.apps.uploads.create!(:file => file_path).id end super end |
.installations(client, *args, &block) ⇒ Object
922 923 924 |
# File 'lib/zendesk_api/resources.rb', line 922 def self.installations(client, *args, &block) ZendeskAPI::Collection.new(client, AppInstallation, *args, &block) end |
.uploads(client, *args, &block) ⇒ Object
918 919 920 |
# File 'lib/zendesk_api/resources.rb', line 918 def self.uploads(client, *args, &block) ZendeskAPI::Collection.new(client, Upload, *args, &block) end |
Instance Method Details
#attributes_for_save ⇒ Object
Don’t nest attributes
930 931 932 |
# File 'lib/zendesk_api/resources.rb', line 930 def attributes_for_save attributes.changes end |
#handle_response(response) ⇒ Object
934 935 936 |
# File 'lib/zendesk_api/resources.rb', line 934 def handle_response(response) @attributes.replace(response.body) if response.body end |