checkoff 0.226.0 → 0.228.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/checkoff.gemspec +1 -1
  3. data/lib/checkoff/attachments.rb +10 -10
  4. data/lib/checkoff/cli.rb +9 -9
  5. data/lib/checkoff/custom_fields.rb +3 -3
  6. data/lib/checkoff/events.rb +6 -6
  7. data/lib/checkoff/internal/asana_event_enrichment.rb +10 -10
  8. data/lib/checkoff/internal/asana_event_filter.rb +2 -2
  9. data/lib/checkoff/internal/project_selector_evaluator.rb +2 -2
  10. data/lib/checkoff/internal/project_timing.rb +1 -1
  11. data/lib/checkoff/internal/search_url/parser.rb +3 -3
  12. data/lib/checkoff/internal/search_url/simple_param_converter.rb +1 -1
  13. data/lib/checkoff/internal/section_selector_evaluator.rb +4 -4
  14. data/lib/checkoff/internal/selector_classes/project.rb +2 -2
  15. data/lib/checkoff/internal/selector_classes/task.rb +4 -4
  16. data/lib/checkoff/internal/selector_evaluator.rb +1 -1
  17. data/lib/checkoff/internal/task_hashes.rb +1 -1
  18. data/lib/checkoff/internal/task_selector_evaluator.rb +1 -1
  19. data/lib/checkoff/internal/task_timing.rb +1 -1
  20. data/lib/checkoff/my_tasks.rb +5 -5
  21. data/lib/checkoff/portfolios.rb +6 -6
  22. data/lib/checkoff/project_selectors.rb +8 -8
  23. data/lib/checkoff/projects.rb +13 -13
  24. data/lib/checkoff/resources.rb +6 -6
  25. data/lib/checkoff/section_selectors.rb +7 -7
  26. data/lib/checkoff/sections.rb +21 -21
  27. data/lib/checkoff/subtasks.rb +6 -6
  28. data/lib/checkoff/tags.rb +8 -8
  29. data/lib/checkoff/task_searches.rb +12 -12
  30. data/lib/checkoff/task_selectors.rb +11 -11
  31. data/lib/checkoff/tasks.rb +23 -23
  32. data/lib/checkoff/timelines.rb +6 -6
  33. data/lib/checkoff/version.rb +1 -1
  34. data/lib/checkoff/workspaces.rb +1 -1
  35. data/rbi/checkoff.rbi +2482 -49
  36. data/sig/checkoff.rbs +29 -9
  37. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92a9e8e8ca22cbfa31d1d4b02c941c20826db8e3e831f626f96500a12bc306a3
4
- data.tar.gz: be53367a968bbf2d4ca1b6b18aada517c7254765d35f9ca8b6f9b6058445eb85
3
+ metadata.gz: e45b3232b765bca7bb6fbee30ad5f42c4b468a22a3e8cc23364d38cb4892cbb7
4
+ data.tar.gz: 94a438965b5a9a2fd471ca051e708539303917b3cdc2adc21c7426acb6da3313
5
5
  SHA512:
6
- metadata.gz: bbbf49ded9ca35770835d23ef89488fafff69e4500e91b2fa688b2b450df50178b827c50d2144e52fa58485bf71dde8762a014b1c3edee324b0d0600c613a828
7
- data.tar.gz: bdc7f6e728ed13bdf96e9ab43448c8f201e5d42421f1d2141ba24c274667a22018b4e73dd145d267822ca7201767fe7fb78846bc35c7ba372147e6be9d66b0de
6
+ metadata.gz: 25517dee54899096ed93e72f87b441dd6a86c1970a53d7f86bb78b289d44afd7e7fae7beb6e14982ec062d7876b638df25d414c1a515b428f467026d56831360
7
+ data.tar.gz: 5ff93cfdd549f16b367069379490dcf2acf868d3509df899c82d5df80dda41aaed35d727a2a20a1ac8f5000b8411828fc40d170678c66dbd2b31ddf41486ced3
data/checkoff.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.summary = 'Command-line and gem client for Asana (unofficial)'
14
14
  spec.homepage = 'https://github.com/apiology/checkoff'
15
15
  spec.license = 'MIT license'
16
- spec.required_ruby_version = '>= 3.0'
16
+ spec.required_ruby_version = '>= 3.2'
17
17
 
18
18
  spec.files = Dir['README.md',
19
19
  'Rakefile',
@@ -41,13 +41,13 @@ module Checkoff
41
41
  SHORT_CACHE_TIME = MINUTE
42
42
  private_constant :SHORT_CACHE_TIME
43
43
 
44
- # @param config [Hash]
44
+ # @param config [Hash,Checkoff::Internal::EnvFallbackConfigLoader]
45
45
  # @param workspaces [Checkoff::Workspaces]
46
46
  # @param clients [Checkoff::Clients]
47
47
  # @param client [Asana::Client]
48
48
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
49
- workspaces: Checkoff::Workspaces.new(config: config),
50
- clients: Checkoff::Clients.new(config: config),
49
+ workspaces: Checkoff::Workspaces.new(config:),
50
+ clients: Checkoff::Clients.new(config:),
51
51
  client: clients.client)
52
52
  @workspaces = workspaces
53
53
  @client = client
@@ -66,10 +66,10 @@ module Checkoff
66
66
  verify_mode: OpenSSL::SSL::VERIFY_PEER,
67
67
  just_the_url: false)
68
68
  if just_the_url
69
- create_attachment_from_url_alone!(url, resource, attachment_name: attachment_name)
69
+ create_attachment_from_url_alone!(url, resource, attachment_name:)
70
70
  else
71
- create_attachment_from_downloaded_url!(url, resource, attachment_name: attachment_name,
72
- verify_mode: verify_mode)
71
+ create_attachment_from_downloaded_url!(url, resource, attachment_name:,
72
+ verify_mode:)
73
73
  end
74
74
  end
75
75
 
@@ -86,7 +86,7 @@ module Checkoff
86
86
  # @sg-ignore
87
87
  def download_uri(uri, verify_mode: OpenSSL::SSL::VERIFY_PEER, &block)
88
88
  out = nil
89
- Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https', verify_mode: verify_mode) do |http|
89
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https', verify_mode:) do |http|
90
90
  # @sg-ignore
91
91
  http.request(Net::HTTP::Get.new(uri)) do |response|
92
92
  raise("Unexpected response code: #{response.code}") unless response.code == '200'
@@ -129,7 +129,7 @@ module Checkoff
129
129
  verify_mode: OpenSSL::SSL::VERIFY_PEER)
130
130
  uri = URI(url)
131
131
  attachment_name ||= File.basename(uri.path)
132
- download_uri(uri, verify_mode: verify_mode) do |tempfile|
132
+ download_uri(uri, verify_mode:) do |tempfile|
133
133
  content_type ||= content_type_from_filename(attachment_name)
134
134
  content_type ||= content_type_from_filename(uri.path)
135
135
 
@@ -151,8 +151,8 @@ module Checkoff
151
151
  'name' => attachment_name,
152
152
  }
153
153
  options = {}
154
- Asana::Resource.new(parse(client.post('/attachments', body: with_params, options: options)).first,
155
- client: client)
154
+ Asana::Resources::Resource.new(parse(client.post('/attachments', body: with_params, options:)).first,
155
+ client:)
156
156
  end
157
157
 
158
158
  # @param filename [String]
data/lib/checkoff/cli.rb CHANGED
@@ -62,8 +62,8 @@ module Checkoff
62
62
  to_project_arg:,
63
63
  to_section_arg:,
64
64
  config: Checkoff::Internal::ConfigLoader.load(:asana),
65
- projects: Checkoff::Projects.new(config: config),
66
- sections: Checkoff::Sections.new(config: config),
65
+ projects: Checkoff::Projects.new(config:),
66
+ sections: Checkoff::Sections.new(config:),
67
67
  logger: $stderr)
68
68
  validate_and_assign_from_location(from_workspace_arg, from_project_arg, from_section_arg)
69
69
  validate_and_assign_to_location(to_workspace_arg, to_project_arg, to_section_arg)
@@ -123,11 +123,11 @@ module Checkoff
123
123
  def initialize(workspace_name, project_name, section_name,
124
124
  task_name,
125
125
  config: Checkoff::Internal::ConfigLoader.load(:asana),
126
- projects: Checkoff::Projects.new(config: config),
127
- sections: Checkoff::Sections.new(config: config,
128
- projects: projects),
129
- tasks: Checkoff::Tasks.new(config: config,
130
- sections: sections),
126
+ projects: Checkoff::Projects.new(config:),
127
+ sections: Checkoff::Sections.new(config:,
128
+ projects:),
129
+ tasks: Checkoff::Tasks.new(config:,
130
+ sections:),
131
131
  stderr: $stderr)
132
132
  @workspace_name = workspace_name
133
133
  @stderr = stderr
@@ -202,8 +202,8 @@ module Checkoff
202
202
  class QuickaddSubcommand
203
203
  def initialize(workspace_name, task_name,
204
204
  config: Checkoff::Internal::ConfigLoader.load(:asana),
205
- workspaces: Checkoff::Workspaces.new(config: config),
206
- tasks: Checkoff::Tasks.new(config: config))
205
+ workspaces: Checkoff::Workspaces.new(config:),
206
+ tasks: Checkoff::Tasks.new(config:))
207
207
  @workspace_name = workspace_name
208
208
  @task_name = task_name
209
209
  @workspaces = workspaces
@@ -29,10 +29,10 @@ module Checkoff
29
29
  # @param clients [Checkoff::Clients]
30
30
  # @param client [Asana::Client]
31
31
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
32
- clients: Checkoff::Clients.new(config: config),
32
+ clients: Checkoff::Clients.new(config:),
33
33
  client: clients.client,
34
- workspaces: Checkoff::Workspaces.new(config: config,
35
- client: client))
34
+ workspaces: Checkoff::Workspaces.new(config:,
35
+ client:))
36
36
  @workspaces = workspaces
37
37
  @client = client
38
38
  end
@@ -43,11 +43,11 @@ module Checkoff
43
43
  # @param asana_event_filter_class [Class<Checkoff::Internal::AsanaEventFilter>]
44
44
  # @param asana_event_enrichment [Checkoff::Internal::AsanaEventEnrichment]
45
45
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
46
- workspaces: Checkoff::Workspaces.new(config: config),
47
- tasks: Checkoff::Tasks.new(config: config),
48
- sections: Checkoff::Sections.new(config: config),
49
- projects: Checkoff::Projects.new(config: config),
50
- clients: Checkoff::Clients.new(config: config),
46
+ workspaces: Checkoff::Workspaces.new(config:),
47
+ tasks: Checkoff::Tasks.new(config:),
48
+ sections: Checkoff::Sections.new(config:),
49
+ projects: Checkoff::Projects.new(config:),
50
+ clients: Checkoff::Clients.new(config:),
51
51
  client: clients.client,
52
52
  asana_event_filter_class: Checkoff::Internal::AsanaEventFilter,
53
53
  asana_event_enrichment: Checkoff::Internal::AsanaEventEnrichment.new)
@@ -65,7 +65,7 @@ module Checkoff
65
65
  #
66
66
  # @return [Array<Hash>] The events that should be acted on
67
67
  def filter_asana_events(filters, asana_events)
68
- asana_event_filter = @asana_event_filter_class.new(filters: filters)
68
+ asana_event_filter = @asana_event_filter_class.new(filters:)
69
69
  asana_events.select { |event| asana_event_filter.matches?(event) }
70
70
  end
71
71
 
@@ -14,7 +14,7 @@ module Checkoff
14
14
  # Add useful info (like resource task names) into an Asana
15
15
  # event/event filters/webhook subscription for human consumption
16
16
  class AsanaEventEnrichment
17
- # @param config [Hash]
17
+ # @param config [Hash,Checkoff::Internal::EnvFallbackConfigLoader]
18
18
  # @param workspaces [Checkoff::Workspaces]
19
19
  # @param tasks [Checkoff::Tasks]
20
20
  # @param sections [Checkoff::Sections]
@@ -24,12 +24,12 @@ module Checkoff
24
24
  # @param client [Asana::Client]
25
25
  # @param asana_event_enrichment [Checkoff::Internal::AsanaEventEnrichment]
26
26
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
27
- workspaces: Checkoff::Workspaces.new(config: config),
28
- tasks: Checkoff::Tasks.new(config: config),
29
- sections: Checkoff::Sections.new(config: config),
30
- projects: Checkoff::Projects.new(config: config),
31
- resources: Checkoff::Resources.new(config: config),
32
- clients: Checkoff::Clients.new(config: config),
27
+ workspaces: Checkoff::Workspaces.new(config:),
28
+ tasks: Checkoff::Tasks.new(config:),
29
+ sections: Checkoff::Sections.new(config:),
30
+ projects: Checkoff::Projects.new(config:),
31
+ resources: Checkoff::Resources.new(config:),
32
+ clients: Checkoff::Clients.new(config:),
33
33
  client: clients.client)
34
34
  @workspaces = workspaces
35
35
  @tasks = tasks
@@ -91,7 +91,7 @@ module Checkoff
91
91
  # @return [Array<([String, nil], [String,nil])>]
92
92
  def enrich_gid(gid, resource_type: nil)
93
93
  # @sg-ignore
94
- resource, resource_type = resources.resource_by_gid(gid, resource_type: resource_type)
94
+ resource, resource_type = resources.resource_by_gid(gid, resource_type:)
95
95
  [resource&.name, resource_type]
96
96
  end
97
97
 
@@ -146,7 +146,7 @@ module Checkoff
146
146
  # @type [String]
147
147
  gid = parent.fetch('gid')
148
148
  # @sg-ignore
149
- name, _resource_type = enrich_gid(gid, resource_type: resource_type)
149
+ name, _resource_type = enrich_gid(gid, resource_type:)
150
150
  parent['checkoff:enriched:name'] = name if name
151
151
 
152
152
  nil
@@ -165,7 +165,7 @@ module Checkoff
165
165
  gid = resource.fetch('gid')
166
166
 
167
167
  # @sg-ignore
168
- name, _resource_type = enrich_gid(gid, resource_type: resource_type)
168
+ name, _resource_type = enrich_gid(gid, resource_type:)
169
169
  resource['checkoff:enriched:name'] = name if name
170
170
 
171
171
  nil
@@ -132,9 +132,9 @@ module Checkoff
132
132
 
133
133
  task_gid = resource.fetch('gid')
134
134
  options = {
135
- fields: fields,
135
+ fields:,
136
136
  }
137
- @client.tasks.find_by_id(task_gid, options: options)
137
+ @client.tasks.find_by_id(task_gid, options:)
138
138
  rescue Asana::Errors::NotFound
139
139
  nil
140
140
  end
@@ -46,8 +46,8 @@ module Checkoff
46
46
  # @return [Hash]
47
47
  def initializer_kwargs
48
48
  {
49
- projects: projects, custom_fields: custom_fields,
50
- workspaces: workspaces, portfolios: portfolios
49
+ projects:, custom_fields:,
50
+ workspaces:, portfolios:
51
51
  }
52
52
  end
53
53
 
@@ -13,7 +13,7 @@ module Checkoff
13
13
  # @param custom_fields [Checkoff::CustomFields]
14
14
  def initialize(time_class: Time, date_class: Date,
15
15
  client: Checkoff::Clients.new.client,
16
- custom_fields: Checkoff::CustomFields.new(client: client))
16
+ custom_fields: Checkoff::CustomFields.new(client:))
17
17
  @time_class = time_class
18
18
  @date_class = date_class
19
19
  @custom_fields = custom_fields
@@ -49,19 +49,19 @@ module Checkoff
49
49
  # @param date_url_params [Hash<String, Array<String>>]
50
50
  # @return [Array(Hash<String, String>, Array<[Symbol, Array]>)]
51
51
  def convert_date_params(date_url_params)
52
- DateParamConverter.new(date_url_params: date_url_params).convert
52
+ DateParamConverter.new(date_url_params:).convert
53
53
  end
54
54
 
55
55
  # @param simple_url_params [Hash<String, Array<String>>]
56
56
  # @return [Hash<String, String>]
57
57
  def convert_simple_params(simple_url_params)
58
- SimpleParamConverter.new(simple_url_params: simple_url_params).convert
58
+ SimpleParamConverter.new(simple_url_params:).convert
59
59
  end
60
60
 
61
61
  # @param custom_field_params [Hash<String, Array<String>>]
62
62
  # @return [Array(Hash<String, String>, Array<[Symbol, Array]>)]
63
63
  def convert_custom_field_params(custom_field_params)
64
- CustomFieldParamConverter.new(custom_field_params: custom_field_params).convert
64
+ CustomFieldParamConverter.new(custom_field_params:).convert
65
65
  end
66
66
 
67
67
  # @param url_params [Hash<String, String>]
@@ -229,7 +229,7 @@ module Checkoff
229
229
  clazz = ARGS.fetch(key)
230
230
  # @sg-ignore
231
231
  # @type [SimpleParam::SimpleParam]
232
- obj = clazz.new(key: key, values: values)
232
+ obj = clazz.new(key:, values:)
233
233
  # @sg-ignore
234
234
  obj.convert
235
235
  end
@@ -15,9 +15,9 @@ module Checkoff
15
15
  # @param custom_fields [Checkoff::CustomFields]
16
16
  def initialize(section:,
17
17
  client:,
18
- projects: Checkoff::Projects.new(client: client),
19
- sections: Checkoff::Sections.new(client: client),
20
- custom_fields: Checkoff::CustomFields.new(client: client),
18
+ projects: Checkoff::Projects.new(client:),
19
+ sections: Checkoff::Sections.new(client:),
20
+ custom_fields: Checkoff::CustomFields.new(client:),
21
21
  **_kwargs)
22
22
  @item = section
23
23
  @client = client
@@ -46,7 +46,7 @@ module Checkoff
46
46
 
47
47
  # @return [Hash]
48
48
  def initializer_kwargs
49
- { sections: sections, projects: projects, client: client, custom_fields: custom_fields }
49
+ { sections:, projects:, client:, custom_fields: }
50
50
  end
51
51
 
52
52
  # @return [Asana::Resources::Project]
@@ -34,7 +34,7 @@ module Checkoff
34
34
  # @param period [Symbol] - :now_or_before or :this_week
35
35
  # @return [Boolean]
36
36
  def evaluate(project, period = :now_or_before)
37
- @projects.project_ready?(project, period: period)
37
+ @projects.project_ready?(project, period:)
38
38
  end
39
39
  end
40
40
 
@@ -56,7 +56,7 @@ module Checkoff
56
56
  workspace_name ||= project.workspace&.name
57
57
  workspace_name ||= @workspaces.default_workspace.name
58
58
  projects = @portfolios.projects_in_portfolio(workspace_name, portfolio_name,
59
- extra_project_fields: extra_project_fields)
59
+ extra_project_fields:)
60
60
  projects.any? { |p| p.name == project.name }
61
61
  end
62
62
  end
@@ -160,7 +160,7 @@ module Checkoff
160
160
  # @return [Boolean]
161
161
  # rubocop:disable Style/OptionalBooleanParameter
162
162
  def evaluate(task, period = :now_or_before, ignore_dependencies = false)
163
- @tasks.task_ready?(task, period: period, ignore_dependencies: ignore_dependencies)
163
+ @tasks.task_ready?(task, period:, ignore_dependencies:)
164
164
  end
165
165
  # rubocop:enable Style/OptionalBooleanParameter
166
166
  end
@@ -305,7 +305,7 @@ module Checkoff
305
305
  # @return [Boolean]
306
306
  def evaluate(task, limit_to_portfolio_gid: nil)
307
307
  @timelines.task_dependent_on_previous_section_last_milestone?(task,
308
- limit_to_portfolio_gid: limit_to_portfolio_gid)
308
+ limit_to_portfolio_gid:)
309
309
  end
310
310
  end
311
311
 
@@ -344,7 +344,7 @@ module Checkoff
344
344
  # @return [Boolean]
345
345
  def evaluate(task, limit_to_portfolio_name = nil)
346
346
  !@timelines.last_task_milestone_depends_on_this_task?(task,
347
- limit_to_portfolio_name: limit_to_portfolio_name)
347
+ limit_to_portfolio_name:)
348
348
  end
349
349
  end
350
350
 
@@ -388,7 +388,7 @@ module Checkoff
388
388
  # @return [Boolean]
389
389
  def evaluate(task, limit_to_portfolio_name = nil)
390
390
  !@timelines.any_milestone_depends_on_this_task?(task,
391
- limit_to_portfolio_name: limit_to_portfolio_name)
391
+ limit_to_portfolio_name:)
392
392
  end
393
393
  end
394
394
  end
@@ -12,7 +12,7 @@ module Checkoff
12
12
  function_evaluators.each do |evaluator_class|
13
13
  # @type [Checkoff::SelectorClasses::FunctionEvaluator]
14
14
  # @sg-ignore
15
- evaluator = evaluator_class.new(selector: selector,
15
+ evaluator = evaluator_class.new(selector:,
16
16
  **initializer_kwargs)
17
17
 
18
18
  next unless evaluator.matches?
@@ -26,7 +26,7 @@ module Checkoff
26
26
  # copy of task_data without the 'unwrapped' key
27
27
  clean_task_data = task_data.dup
28
28
  clean_task_data.delete('unwrapped')
29
- Asana::Resources::Task.new(clean_task_data, client: client)
29
+ Asana::Resources::Task.new(clean_task_data, client:)
30
30
  end
31
31
 
32
32
  private
@@ -42,7 +42,7 @@ module Checkoff
42
42
 
43
43
  # @return [Hash]
44
44
  def initializer_kwargs
45
- { tasks: tasks, timelines: timelines, custom_fields: custom_fields }
45
+ { tasks:, timelines:, custom_fields: }
46
46
  end
47
47
 
48
48
  # @return [Asana::Resources::Task]
@@ -11,7 +11,7 @@ module Checkoff
11
11
  # @param custom_fields [Checkoff::CustomFields]
12
12
  def initialize(time_class: Time, date_class: Date,
13
13
  client: Checkoff::Clients.new.client,
14
- custom_fields: Checkoff::CustomFields.new(client: client))
14
+ custom_fields: Checkoff::CustomFields.new(client:))
15
15
  @time_class = time_class
16
16
  @date_class = date_class
17
17
  @custom_fields = custom_fields
@@ -20,9 +20,9 @@ module Checkoff
20
20
  # @param client [Asana::Client]
21
21
  # @param projects [Checkoff::Projects]
22
22
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
23
- client: Checkoff::Clients.new(config: config).client,
24
- projects: Checkoff::Projects.new(config: config,
25
- client: client))
23
+ client: Checkoff::Clients.new(config:).client,
24
+ projects: Checkoff::Projects.new(config:,
25
+ client:))
26
26
  @config = config
27
27
  @client = client
28
28
  @projects = projects
@@ -40,7 +40,7 @@ module Checkoff
40
40
  only_uncompleted: true,
41
41
  extra_fields: [])
42
42
  raw_tasks = projects.tasks_from_project(project,
43
- only_uncompleted: only_uncompleted,
43
+ only_uncompleted:,
44
44
  extra_fields: extra_fields + ['assignee_section.name'])
45
45
  active_tasks = projects.active_tasks(raw_tasks)
46
46
  by_my_tasks_section(active_tasks, project.gid)
@@ -62,7 +62,7 @@ module Checkoff
62
62
  # @return [Hash<String, Enumerable<Asana::Resources::Task>>]
63
63
  def by_my_tasks_section(tasks, project_gid)
64
64
  by_section = {}
65
- sections = client.sections.get_sections_for_project(project_gid: project_gid,
65
+ sections = client.sections.get_sections_for_project(project_gid:,
66
66
  options: { fields: ['name'] })
67
67
  sections.each_entry { |section| by_section[section_key(section.name)] = [] }
68
68
  tasks.each do |task|
@@ -33,10 +33,10 @@ module Checkoff
33
33
  # @param client [Asana::Client]
34
34
  # @param projects [Checkoff::Projects]
35
35
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
36
- clients: Checkoff::Clients.new(config: config),
36
+ clients: Checkoff::Clients.new(config:),
37
37
  client: clients.client,
38
- projects: Checkoff::Projects.new(config: config, client: client),
39
- workspaces: Checkoff::Workspaces.new(config: config, client: client))
38
+ projects: Checkoff::Projects.new(config:, client:),
39
+ workspaces: Checkoff::Workspaces.new(config:, client:))
40
40
  @workspaces = T.let(workspaces, Checkoff::Workspaces)
41
41
  @client = T.let(client, Asana::Client)
42
42
  @projects = T.let(projects, Checkoff::Projects)
@@ -81,7 +81,7 @@ module Checkoff
81
81
  fields: ['name'],
82
82
  }
83
83
  options[:fields] += extra_fields
84
- client.portfolios.find_by_id(portfolio_gid, options: options)
84
+ client.portfolios.find_by_id(portfolio_gid, options:)
85
85
  end
86
86
  cache_method :portfolio_by_gid, SHORT_CACHE_TIME
87
87
 
@@ -102,8 +102,8 @@ module Checkoff
102
102
  #
103
103
  # @return [Enumerable<Asana::Resources::Project>]
104
104
  def projects_in_portfolio_obj(portfolio, extra_project_fields: [])
105
- options = projects.project_options(extra_project_fields: extra_project_fields)
106
- client.portfolios.get_items_for_portfolio(portfolio_gid: portfolio.gid, options: options)
105
+ options = projects.project_options(extra_project_fields:)
106
+ client.portfolios.get_items_for_portfolio(portfolio_gid: portfolio.gid, options:)
107
107
  end
108
108
 
109
109
  private
@@ -20,7 +20,7 @@ module Checkoff
20
20
  LONG_CACHE_TIME = MINUTE * 15
21
21
  SHORT_CACHE_TIME = MINUTE
22
22
 
23
- # @param config [Hash<Symbol, Object>]
23
+ # @param config [Hash<Symbol, Object>,Checkoff::Internal::EnvFallbackConfigLoader]
24
24
  # @param workspaces [Checkoff::Workspaces]
25
25
  # @param projects [Checkoff::Projects]
26
26
  # @param custom_fields [Checkoff::CustomFields]
@@ -28,11 +28,11 @@ module Checkoff
28
28
  # @param clients [Checkoff::Clients]
29
29
  # @param client [Asana::Client]
30
30
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
31
- workspaces: Checkoff::Workspaces.new(config: config),
32
- projects: Checkoff::Projects.new(config: config),
33
- custom_fields: Checkoff::CustomFields.new(config: config),
34
- portfolios: Checkoff::Portfolios.new(config: config),
35
- clients: Checkoff::Clients.new(config: config),
31
+ workspaces: Checkoff::Workspaces.new(config:),
32
+ projects: Checkoff::Projects.new(config:),
33
+ custom_fields: Checkoff::CustomFields.new(config:),
34
+ portfolios: Checkoff::Portfolios.new(config:),
35
+ clients: Checkoff::Clients.new(config:),
36
36
  client: clients.client)
37
37
  @workspaces = workspaces
38
38
  @projects = projects
@@ -46,8 +46,8 @@ module Checkoff
46
46
  # project details. Examples: [:tag, 'foo'] [:not, [:tag, 'foo']] [:tag, 'foo']
47
47
  # @return [Boolean]
48
48
  def filter_via_project_selector(project, project_selector)
49
- evaluator = ProjectSelectorEvaluator.new(project: project, projects: projects, custom_fields: custom_fields,
50
- workspaces: workspaces, portfolios: portfolios)
49
+ evaluator = ProjectSelectorEvaluator.new(project:, projects:, custom_fields:,
50
+ workspaces:, portfolios:)
51
51
  evaluator.evaluate(project_selector)
52
52
  end
53
53
 
@@ -40,11 +40,11 @@ module Checkoff
40
40
  # @param project_timing [Checkoff::Internal::ProjectTiming]
41
41
  # @param timing [Checkoff::Timing]
42
42
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
43
- client: Checkoff::Clients.new(config: config).client,
44
- workspaces: Checkoff::Workspaces.new(config: config,
45
- client: client),
43
+ client: Checkoff::Clients.new(config:).client,
44
+ workspaces: Checkoff::Workspaces.new(config:,
45
+ client:),
46
46
  project_hashes: Checkoff::Internal::ProjectHashes.new,
47
- project_timing: Checkoff::Internal::ProjectTiming.new(client: client),
47
+ project_timing: Checkoff::Internal::ProjectTiming.new(client:),
48
48
  timing: Checkoff::Timing.new)
49
49
  @config = config
50
50
  @workspaces = workspaces
@@ -73,7 +73,7 @@ module Checkoff
73
73
  options = {
74
74
  per_page: 100,
75
75
  options: {
76
- fields: task_fields(extra_fields: extra_fields),
76
+ fields: task_fields(extra_fields:),
77
77
  },
78
78
  }
79
79
  options[:completed_since] = '9999-12-01' if only_uncompleted
@@ -93,7 +93,7 @@ module Checkoff
93
93
  #
94
94
  # @return [Hash<Symbol, Object>]
95
95
  def project_options(extra_project_fields: [])
96
- { fields: project_fields(extra_project_fields: extra_project_fields) }
96
+ { fields: project_fields(extra_project_fields:) }
97
97
  end
98
98
 
99
99
  # pulls an Asana API project class given a name
@@ -107,11 +107,11 @@ module Checkoff
107
107
  my_tasks(workspace_name)
108
108
  else
109
109
  # @type [Enumerable<Asana::Resources::Project>]
110
- ps = projects_by_workspace_name(workspace_name, extra_fields: extra_fields)
110
+ ps = projects_by_workspace_name(workspace_name, extra_fields:)
111
111
  # @type <Asana::Resources::Project,nil>
112
112
  # @sg-ignore
113
113
  project = ps.find { _1.name == project_name }
114
- project_by_gid(project.gid, extra_fields: extra_fields) unless project.nil?
114
+ project_by_gid(project.gid, extra_fields:) unless project.nil?
115
115
  end
116
116
  end
117
117
  cache_method :project, REALLY_LONG_CACHE_TIME
@@ -122,7 +122,7 @@ module Checkoff
122
122
  #
123
123
  # @return [Asana::Resources::Project]
124
124
  def project_or_raise(workspace_name, project_name, extra_fields: [])
125
- p = project(workspace_name, project_name, extra_fields: extra_fields)
125
+ p = project(workspace_name, project_name, extra_fields:)
126
126
  raise "Could not find project #{project_name.inspect} under workspace #{workspace_name}." if p.nil?
127
127
 
128
128
  p
@@ -159,8 +159,8 @@ module Checkoff
159
159
  only_uncompleted: true,
160
160
  extra_fields: [])
161
161
  tasks_from_project_gid(project.gid,
162
- only_uncompleted: only_uncompleted,
163
- extra_fields: extra_fields)
162
+ only_uncompleted:,
163
+ extra_fields:)
164
164
  end
165
165
 
166
166
  # Pull task objects from a project identified by a gid
@@ -173,7 +173,7 @@ module Checkoff
173
173
  def tasks_from_project_gid(project_gid,
174
174
  only_uncompleted: true,
175
175
  extra_fields: [])
176
- options = task_options(extra_fields: extra_fields, only_uncompleted: only_uncompleted)
176
+ options = task_options(extra_fields:, only_uncompleted:)
177
177
  options[:project] = project_gid
178
178
  # Note: 30 minute cache time on a raw Enumerable from SDK gives
179
179
  # 'Your pagination token has expired' errors. So we go ahead
@@ -201,7 +201,7 @@ module Checkoff
201
201
  #
202
202
  # @return [Hash]
203
203
  def project_to_h(project_obj, project: :not_specified)
204
- project_hashes.project_to_h(project_obj, project: project)
204
+ project_hashes.project_to_h(project_obj, project:)
205
205
  end
206
206
 
207
207
  # Indicates a project is ready for a person to work on it. This
@@ -30,7 +30,7 @@ module Checkoff
30
30
  SHORT_CACHE_TIME = MINUTE
31
31
  private_constant :SHORT_CACHE_TIME
32
32
 
33
- # @param config [Hash]
33
+ # @param config [Hash,Checkoff::Internal::EnvFallbackConfigLoader]
34
34
  # @param workspaces [Checkoff::Workspaces]
35
35
  # @param tasks [Checkoff::Tasks]
36
36
  # @param sections [Checkoff::Sections]
@@ -38,11 +38,11 @@ module Checkoff
38
38
  # @param clients [Checkoff::Clients]
39
39
  # @param client [Asana::Client]
40
40
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
41
- workspaces: Checkoff::Workspaces.new(config: config),
42
- tasks: Checkoff::Tasks.new(config: config),
43
- sections: Checkoff::Sections.new(config: config),
44
- projects: Checkoff::Projects.new(config: config),
45
- clients: Checkoff::Clients.new(config: config),
41
+ workspaces: Checkoff::Workspaces.new(config:),
42
+ tasks: Checkoff::Tasks.new(config:),
43
+ sections: Checkoff::Sections.new(config:),
44
+ projects: Checkoff::Projects.new(config:),
45
+ clients: Checkoff::Clients.new(config:),
46
46
  client: clients.client)
47
47
  @workspaces = workspaces
48
48
  @tasks = tasks