Class: Asana::Resources::Attachment
- Inherits:
-
AttachmentsBase
- Object
- Resource
- AttachmentsBase
- Asana::Resources::Attachment
- Defined in:
- lib/asana/resources/attachment.rb
Overview
An attachment object represents any file attached to a task in Asana, whether it’s an uploaded file or one associated via a third-party service such as Dropbox or Google Drive.
Instance Attribute Summary collapse
- #created_at ⇒ Object readonly
- #download_url ⇒ Object readonly
- #gid ⇒ Object readonly
- #host ⇒ Object readonly
- #name ⇒ Object readonly
- #parent ⇒ Object readonly
- #resource_type ⇒ Object readonly
- #view_url ⇒ Object readonly
Class Method Summary collapse
-
.find_by_id(client, id, options: {}) ⇒ Object
Returns the full record for a single attachment.
-
.find_by_task(client, task: required("task"), per_page: 20, options: {}) ⇒ Object
Returns the compact records for all attachments on the task.
-
.plural_name ⇒ Object
Returns the plural name of the resource.
Methods inherited from AttachmentsBase
delete_attachment, get_attachment, get_attachments_for_object, inherited
Methods inherited from Resource
#initialize, #method_missing, #refresh, #respond_to_missing?, #to_h, #to_s
Methods included from ResponseHelper
Constructor Details
This class inherits a constructor from Asana::Resources::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Asana::Resources::Resource
Instance Attribute Details
#created_at ⇒ Object (readonly)
15 16 17 |
# File 'lib/asana/resources/attachment.rb', line 15 def created_at @created_at end |
#download_url ⇒ Object (readonly)
17 18 19 |
# File 'lib/asana/resources/attachment.rb', line 17 def download_url @download_url end |
#gid ⇒ Object (readonly)
11 12 13 |
# File 'lib/asana/resources/attachment.rb', line 11 def gid @gid end |
#host ⇒ Object (readonly)
19 20 21 |
# File 'lib/asana/resources/attachment.rb', line 19 def host @host end |
#name ⇒ Object (readonly)
21 22 23 |
# File 'lib/asana/resources/attachment.rb', line 21 def name @name end |
#parent ⇒ Object (readonly)
23 24 25 |
# File 'lib/asana/resources/attachment.rb', line 23 def parent @parent end |
#resource_type ⇒ Object (readonly)
13 14 15 |
# File 'lib/asana/resources/attachment.rb', line 13 def resource_type @resource_type end |
#view_url ⇒ Object (readonly)
25 26 27 |
# File 'lib/asana/resources/attachment.rb', line 25 def view_url @view_url end |
Class Method Details
.find_by_id(client, id, options: {}) ⇒ Object
Returns the full record for a single attachment.
38 39 40 41 |
# File 'lib/asana/resources/attachment.rb', line 38 def find_by_id(client, id, options: {}) self.new(parse(client.get("/attachments/#{id}", options: )).first, client: client) end |
.find_by_task(client, task: required("task"), per_page: 20, options: {}) ⇒ Object
Returns the compact records for all attachments on the task.
49 50 51 52 |
# File 'lib/asana/resources/attachment.rb', line 49 def find_by_task(client, task: required("task"), per_page: 20, options: {}) params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? } Collection.new(parse(client.get("/tasks/#{task}/attachments", params: params, options: )), type: self, client: client) end |
.plural_name ⇒ Object
Returns the plural name of the resource.
29 30 31 |
# File 'lib/asana/resources/attachment.rb', line 29 def plural_name 'attachments' end |