lib/checkoff/task_searches.rb in checkoff-0.36.1 vs lib/checkoff/task_searches.rb in checkoff-0.37.0
- old
+ new
@@ -17,13 +17,16 @@
# https://developers.asana.com/reference/searchtasksforworkspace
module Checkoff
# Run task searches against the Asana API
class TaskSearches
MINUTE = 60
+ # @sg-ignore
HOUR = MINUTE * 60
DAY = 24 * HOUR
+ # @sg-ignore
REALLY_LONG_CACHE_TIME = HOUR * 1
+ # @sg-ignore
LONG_CACHE_TIME = MINUTE * 15
SHORT_CACHE_TIME = MINUTE
include Asana::Resources::ResponseHelper
@@ -57,25 +60,33 @@
options: options)),
type: Asana::Resources::Task,
client: client)
tasks.select { |task| task_selectors.filter_via_task_selector(task, task_selector) }
end
+ # @sg-ignore
cache_method :task_search, LONG_CACHE_TIME
private
+ # @param [Array<String>] extra_fields
+ # @return [Hash<Symbol, Object>]
def calculate_api_options(extra_fields)
+ # @type [Hash<Symbol, Object>]
options = projects.task_options[:options]
options[:fields] += ['custom_fields']
options[:fields] += extra_fields
options
end
# bundle exec ./task_searches.rb
# :nocov:
class << self
def run
+ # @sg-ignore
+ # @type [String]
workspace_name = ARGV[0] || raise('Please pass workspace name as first argument')
+ # @sg-ignore
+ # @type [String]
url = ARGV[1] || raise('Please pass task search URL as second argument')
task_searches = Checkoff::TaskSearches.new
task_search = task_searches.task_search(workspace_name, url)
puts "Results: #{task_search}"
end