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 = {}) ⇒ Object
- .installations(client) ⇒ Object
- .uploads(client) ⇒ 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 inherited from DataResource
Methods included from Verbs
Methods inherited from Data
#==, #account_data, #id, inherited, #inspect, #loaded_associations, #method_missing, namespace, new_from_response, #new_record?, #path, #refresh_custom_fields_metadata, resource_name, resource_path, #respond_to_missing?, singular_resource_name, subclasses, #to_json, #to_s
Methods included from Associations
Constructor Details
#initialize(client, attributes = {}) ⇒ App
Returns a new instance of App.
1073 1074 1075 1076 1077 |
# File 'lib/zendesk_api/resources.rb', line 1073 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 = {}) ⇒ Object
1079 1080 1081 1082 1083 1084 1085 |
# File 'lib/zendesk_api/resources.rb', line 1079 def self.create!(client, attributes = {}, &) if (file_path = attributes.delete(:upload)) attributes[:upload_id] = client.apps.uploads.create!(file: file_path).id end super end |
.installations(client) ⇒ Object
1127 1128 1129 |
# File 'lib/zendesk_api/resources.rb', line 1127 def self.installations(client, ...) ZendeskAPI::Collection.new(client, AppInstallation, ...) end |
.uploads(client) ⇒ Object
1123 1124 1125 |
# File 'lib/zendesk_api/resources.rb', line 1123 def self.uploads(client, ...) ZendeskAPI::Collection.new(client, Upload, ...) end |
Instance Method Details
#attributes_for_save ⇒ Object
Don't nest attributes
1135 1136 1137 |
# File 'lib/zendesk_api/resources.rb', line 1135 def attributes_for_save attributes.changes end |
#handle_response(response) ⇒ Object
1139 1140 1141 |
# File 'lib/zendesk_api/resources.rb', line 1139 def handle_response(response) @attributes.replace(response.body) if response.body end |