Class: ZendeskAPI::App::Upload
- Includes:
- Create
- Defined in:
- lib/zendesk_api/resources.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#attributes_for_save ⇒ Object
Don't nest attributes.
-
#changed? ⇒ Boolean
Always save.
-
#clear_associations ⇒ Object
included
from Save
Removes all cached associations.
- #handle_response(response) ⇒ Object included from ResponseHandler
-
#initialize(client, attributes) ⇒ Upload
constructor
A new instance of Upload.
-
#save(options = {}, &block) ⇒ Object
included
from Save
Saves, returning false if it fails and attaching the errors.
-
#save! ⇒ Object
Not nested under :upload, just returns :id.
-
#save_associations ⇒ Object
included
from Save
Saves associations Takes into account inlining, collections, and id setting on the parent resource.
Constructor Details
#initialize(client, attributes) ⇒ Upload
Returns a new instance of Upload
910 911 912 913 914 |
# File 'lib/zendesk_api/resources.rb', line 910 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
903 904 905 |
# File 'lib/zendesk_api/resources.rb', line 903 def resource_path "uploads" end |
Instance Method Details
#attributes_for_save ⇒ Object
Don't nest attributes
929 930 931 |
# File 'lib/zendesk_api/resources.rb', line 929 def attributes_for_save attributes end |
#changed? ⇒ Boolean
Always save
924 925 926 |
# File 'lib/zendesk_api/resources.rb', line 924 def changed? true end |
#clear_associations ⇒ Object Originally defined in module Save
Removes all cached associations
#handle_response(response) ⇒ Object Originally defined in module ResponseHandler
#save(options = {}, &block) ⇒ Object Originally defined in module Save
Saves, returning false if it fails and attaching the errors
#save! ⇒ Object
Not nested under :upload, just returns :id
917 918 919 920 921 |
# File 'lib/zendesk_api/resources.rb', line 917 def save!(*) super.tap do attributes.id = @response.body["id"] end end |
#save_associations ⇒ Object Originally defined in module Save
Saves associations Takes into account inlining, collections, and id setting on the parent resource.