Class: ZendeskAPI::App
- Inherits:
-
Resource
- Object
- Data
- DataResource
- Resource
- ZendeskAPI::App
- Defined in:
- lib/zendesk_api/resources.rb
Defined Under Namespace
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.
-
#plans(options = {}) ⇒ ZendeskAPI::App::Plan
The associated object.
-
#plans=(value) ⇒ ZendeskAPI::App::Plan
The associated object.
-
#upload ⇒ ZendeskAPI::Upload
The associated object.
-
#upload=(value) ⇒ ZendeskAPI::Upload
The associated object.
Constructor Details
#initialize(client, attributes = {}) ⇒ App
Returns a new instance of App
884 885 886 887 888 |
# File 'lib/zendesk_api/resources.rb', line 884 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
890 891 892 893 894 895 896 |
# File 'lib/zendesk_api/resources.rb', line 890 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
938 939 940 |
# File 'lib/zendesk_api/resources.rb', line 938 def self.installations(client, *args, &block) ZendeskAPI::Collection.new(client, AppInstallation, *args, &block) end |
.uploads(client, *args, &block) ⇒ Object
934 935 936 |
# File 'lib/zendesk_api/resources.rb', line 934 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
946 947 948 |
# File 'lib/zendesk_api/resources.rb', line 946 def attributes_for_save attributes.changes end |
#handle_response(response) ⇒ Object
950 951 952 |
# File 'lib/zendesk_api/resources.rb', line 950 def handle_response(response) @attributes.replace(response.body) if response.body end |
#plans(options = {}) ⇒ ZendeskAPI::App::Plan
Returns The associated object
943 |
# File 'lib/zendesk_api/resources.rb', line 943 has_many Plan |
#plans=(value) ⇒ ZendeskAPI::App::Plan
Returns The associated object
943 |
# File 'lib/zendesk_api/resources.rb', line 943 has_many Plan |
#upload ⇒ ZendeskAPI::Upload
Returns The associated object
942 |
# File 'lib/zendesk_api/resources.rb', line 942 has Upload, :path => "uploads" |
#upload=(value) ⇒ ZendeskAPI::Upload
Returns The associated object
942 |
# File 'lib/zendesk_api/resources.rb', line 942 has Upload, :path => "uploads" |