Class: Wrike3::Attachment
- Inherits:
-
Object
- Object
- Wrike3::Attachment
- Includes:
- Common
- Defined in:
- lib/wrike3/attachment.rb
Instance Attribute Summary
Attributes included from Common
Instance Method Summary collapse
-
#delete(id, options = {}) ⇒ Object
Delete attachments.
-
#details(id, options = {}) ⇒ Object
Get attachment details.
-
#download(id, options = {}) ⇒ Object
Get file binary stream.
-
#initialize(wrike) ⇒ Attachment
constructor
A new instance of Attachment.
- #list(attachable_type = nil, attachable_id = nil, options = {}) ⇒ Object
-
#upload(attachable_type, attachable_id, stream, options = {}) ⇒ Object
Upload attachment for specified task.
Constructor Details
#initialize(wrike) ⇒ Attachment
Returns a new instance of Attachment.
5 6 7 |
# File 'lib/wrike3/attachment.rb', line 5 def initialize(wrike) @wrike = wrike end |
Instance Method Details
#delete(id, options = {}) ⇒ Object
Delete attachments
30 31 32 |
# File 'lib/wrike3/attachment.rb', line 30 def delete(id, ={}) wrike.execute(:delete, api_url("attachments/#{id}"), ) end |
#details(id, options = {}) ⇒ Object
Get attachment details
14 15 16 |
# File 'lib/wrike3/attachment.rb', line 14 def details(id, ={}) wrike.execute(:get, api_url("attachments/#{id}"), ) end |
#download(id, options = {}) ⇒ Object
Get file binary stream
25 26 27 |
# File 'lib/wrike3/attachment.rb', line 25 def download(id, ={}) wrike.execute(:get, api_url("attachments/#{id}/download"), ) end |
#list(attachable_type = nil, attachable_id = nil, options = {}) ⇒ Object
9 10 11 |
# File 'lib/wrike3/attachment.rb', line 9 def list(attachable_type = nil, attachable_id = nil, ={}) wrike.execute(:get, api_url(nested_path('attachments', attachable_type, attachable_id)), ) end |
#upload(attachable_type, attachable_id, stream, options = {}) ⇒ Object
Upload attachment for specified task
19 20 21 22 |
# File 'lib/wrike3/attachment.rb', line 19 def upload(attachable_type, attachable_id, stream, ={}) body, headers = http_multipart_data({:stream => stream}) wrike.execute(:post, api_url(nested_path('attachments', attachable_type, attachable_id)), body, headers) end |