lib/checkoff/task_searches.rb in checkoff-0.42.0 vs lib/checkoff/task_searches.rb in checkoff-0.43.0

- old
+ new

@@ -25,10 +25,21 @@ LONG_CACHE_TIME = MINUTE * 15 SHORT_CACHE_TIME = MINUTE include Asana::Resources::ResponseHelper + # @!parse + # extend CacheMethod::ClassMethods + + # @param config [Hash<Symbol, Object>] + # @param workspaces [Checkoff::Workspaces] + # @param task_selectors [Checkoff::TaskSelectors] + # @param projects [Checkoff::Projects] + # @param clients [Checkoff::Clients] + # @param client [Asana::Client] + # @param search_url_parser [Checkoff::Internal::SearchUrl::Parser] + # @param asana_resources_collection_class [Class<Asana::Resources::Collection>] def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana), workspaces: Checkoff::Workspaces.new(config: config), task_selectors: Checkoff::TaskSelectors.new(config: config), projects: Checkoff::Projects.new(config: config), clients: Checkoff::Clients.new(config: config), @@ -47,10 +58,11 @@ # @param [String] url # @param [Array<String>] extra_fields # @return [Array<Asana::Resources::Task>] def task_search(workspace_name, url, extra_fields: []) workspace = workspaces.workspace_or_raise(workspace_name) + # @sg-ignore api_params, task_selector = @search_url_parser.convert_params(url) path = "/workspaces/#{workspace.gid}/tasks/search" options = calculate_api_options(extra_fields) tasks = @asana_resources_collection_class.new(parse(client.get(path, params: api_params, @@ -74,20 +86,32 @@ end # bundle exec ./task_searches.rb # :nocov: class << self + # @return [void] 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 end # :nocov: - attr_reader :task_selectors, :projects, :workspaces, :client + # @return [Checkoff::TaskSelectors] + attr_reader :task_selectors + # @return [Checkoff::Projects] + attr_reader :projects + # @return [Checkoff::Workspaces] + attr_reader :workspaces + # @return [Asana::Client] + attr_reader :client end end # :nocov: abs_program_name = File.expand_path($PROGRAM_NAME)