Class: ZendeskAPI::App::Upload
- Includes:
- Create
- Defined in:
- lib/zendesk_api/resources.rb
Instance Attribute Summary
Attributes inherited from Data
#association, #attributes, #errors, #response
Class Method Summary collapse
Instance Method Summary collapse
-
#attributes_for_save ⇒ Object
Don’t nest attributes.
-
#changed? ⇒ Boolean
Always save.
-
#initialize(client, attributes) ⇒ Upload
constructor
A new instance of Upload.
-
#save! ⇒ Object
Not nested under :upload, just returns :id.
Methods included from Create
Methods included from Save
#clear_associations, #save, #save_associations
Methods included from ResponseHandler
Methods inherited from Data
#==, #id, inherited, #loaded_associations, #method_missing, namespace, new_from_response, #new_record?, #path, resource_name, singular_resource_name, subclasses, #to_json, #to_s
Methods included from ZendeskAPI::Associations
Constructor Details
#initialize(client, attributes) ⇒ Upload
Returns a new instance of Upload.
894 895 896 897 898 |
# File 'lib/zendesk_api/resources.rb', line 894 def initialize(client, attributes) attributes[:file] ||= attributes.delete(:id) super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ZendeskAPI::Data
Class Method Details
.resource_path ⇒ Object
887 888 889 |
# File 'lib/zendesk_api/resources.rb', line 887 def resource_path "uploads" end |
Instance Method Details
#attributes_for_save ⇒ Object
Don’t nest attributes
913 914 915 |
# File 'lib/zendesk_api/resources.rb', line 913 def attributes_for_save attributes end |
#changed? ⇒ Boolean
Always save
908 909 910 |
# File 'lib/zendesk_api/resources.rb', line 908 def changed? true end |
#save! ⇒ Object
Not nested under :upload, just returns :id
901 902 903 904 905 |
# File 'lib/zendesk_api/resources.rb', line 901 def save!(*) super.tap do attributes.id = @response.body["id"] end end |