Class: 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
- #host ⇒ Object readonly
- #id ⇒ Object readonly
- #name ⇒ Object readonly
- #parent ⇒ 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 Resource
inherited, #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)
14 15 16 |
# File 'lib/asana/resources/attachment.rb', line 14 def created_at @created_at end |
#download_url ⇒ Object (readonly)
16 17 18 |
# File 'lib/asana/resources/attachment.rb', line 16 def download_url @download_url end |
#host ⇒ Object (readonly)
18 19 20 |
# File 'lib/asana/resources/attachment.rb', line 18 def host @host end |
#id ⇒ Object (readonly)
12 13 14 |
# File 'lib/asana/resources/attachment.rb', line 12 def id @id end |
#name ⇒ Object (readonly)
20 21 22 |
# File 'lib/asana/resources/attachment.rb', line 20 def name @name end |
#parent ⇒ Object (readonly)
22 23 24 |
# File 'lib/asana/resources/attachment.rb', line 22 def parent @parent end |
#view_url ⇒ Object (readonly)
24 25 26 |
# File 'lib/asana/resources/attachment.rb', line 24 def view_url @view_url end |
Class Method Details
.find_by_id(client, id, options: {}) ⇒ Object
Returns the full record for a single attachment.
37 38 39 40 |
# File 'lib/asana/resources/attachment.rb', line 37 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.
48 49 50 51 |
# File 'lib/asana/resources/attachment.rb', line 48 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.
28 29 30 |
# File 'lib/asana/resources/attachment.rb', line 28 def plural_name 'attachments' end |