Class: Checkoff::Attachments
- Inherits:
-
Object
- Object
- Checkoff::Attachments
- Includes:
- Logging
- Defined in:
- lib/checkoff/attachments.rb
Overview
Manage attachments in Asana
Class Method Summary collapse
Instance Method Summary collapse
- #create_attachment_from_url!(url, resource, attachment_name: nil, just_the_url: false) ⇒ Asana::Resources::Attachment
-
#initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config: config), clients: Checkoff::Clients.new(config: config), client: clients.client) ⇒ Attachments
constructor
A new instance of Attachments.
Methods included from Logging
#debug, #error, #finer, #info, #logger, #warn
Constructor Details
#initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config: config), clients: Checkoff::Clients.new(config: config), client: clients.client) ⇒ Attachments
Returns a new instance of Attachments.
46 47 48 49 50 51 52 |
# File 'lib/checkoff/attachments.rb', line 46 def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config: config), clients: Checkoff::Clients.new(config: config), client: clients.client) @workspaces = workspaces @client = client end |
Class Method Details
.run ⇒ void
This method returns an undefined value.
182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/checkoff/attachments.rb', line 182 def run # @sg-ignore # @type [String] gid = ARGV[0] || raise('Please pass task gid as first argument') # @sg-ignore # @type [String] url = ARGV[1] || raise('Please pass attachment URL as second argument') tasks = Checkoff::Tasks.new = Checkoff::Attachments.new task = tasks.task_by_gid(gid) = .(url, task) puts "Results: #{.inspect}" end |
Instance Method Details
#create_attachment_from_url!(url, resource, attachment_name: nil, just_the_url: false) ⇒ Asana::Resources::Attachment
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/checkoff/attachments.rb', line 60 def (url, resource, attachment_name: nil, just_the_url: false) if just_the_url (url, resource, attachment_name: ) else (url, resource, attachment_name: ) end end |