checkoff 0.226.0 → 0.227.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/checkoff/attachments.rb +10 -10
- data/lib/checkoff/cli.rb +9 -9
- data/lib/checkoff/custom_fields.rb +3 -3
- data/lib/checkoff/events.rb +6 -6
- data/lib/checkoff/internal/asana_event_enrichment.rb +10 -10
- data/lib/checkoff/internal/asana_event_filter.rb +2 -2
- data/lib/checkoff/internal/project_selector_evaluator.rb +2 -2
- data/lib/checkoff/internal/project_timing.rb +1 -1
- data/lib/checkoff/internal/search_url/parser.rb +3 -3
- data/lib/checkoff/internal/search_url/simple_param_converter.rb +1 -1
- data/lib/checkoff/internal/section_selector_evaluator.rb +4 -4
- data/lib/checkoff/internal/selector_classes/project.rb +2 -2
- data/lib/checkoff/internal/selector_classes/task.rb +4 -4
- data/lib/checkoff/internal/selector_evaluator.rb +1 -1
- data/lib/checkoff/internal/task_hashes.rb +1 -1
- data/lib/checkoff/internal/task_selector_evaluator.rb +1 -1
- data/lib/checkoff/internal/task_timing.rb +1 -1
- data/lib/checkoff/my_tasks.rb +5 -5
- data/lib/checkoff/portfolios.rb +6 -6
- data/lib/checkoff/project_selectors.rb +8 -8
- data/lib/checkoff/projects.rb +13 -13
- data/lib/checkoff/resources.rb +6 -6
- data/lib/checkoff/section_selectors.rb +7 -7
- data/lib/checkoff/sections.rb +21 -21
- data/lib/checkoff/subtasks.rb +6 -6
- data/lib/checkoff/tags.rb +8 -8
- data/lib/checkoff/task_searches.rb +12 -12
- data/lib/checkoff/task_selectors.rb +11 -11
- data/lib/checkoff/tasks.rb +23 -23
- data/lib/checkoff/timelines.rb +6 -6
- data/lib/checkoff/version.rb +1 -1
- data/lib/checkoff/workspaces.rb +1 -1
- data/rbi/checkoff.rbi +2482 -49
- data/sig/checkoff.rbs +29 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6155968a7e8fed6083772ab037df3c80c5e7e55614adb8b46d317dd6d6a8c95
|
4
|
+
data.tar.gz: 839bdc1c4b8b95dda24897ca3b3ff1e7b1a588f31b7f7caaa19c9ddd334f7a8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1313777828767f01034fc4af02d7ddc789b901395d003c9fe1b188bfb803236c7ffc18ff782f159a897a0e44ac847b9a20a1dba72d3d3c619481a19b3ef63ac
|
7
|
+
data.tar.gz: acf148142ffd2dee2be141b8d1ebf35437d073336c1ac8ab2884f72f60777760df22591804aa5576aa4f27dfeac53308096b4d5ea069e9652545c1f4da4f5659
|
data/lib/checkoff/attachments.rb
CHANGED
@@ -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:
|
50
|
-
clients: Checkoff::Clients.new(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:
|
69
|
+
create_attachment_from_url_alone!(url, resource, attachment_name:)
|
70
70
|
else
|
71
|
-
create_attachment_from_downloaded_url!(url, resource, attachment_name
|
72
|
-
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:
|
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:
|
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:
|
155
|
-
|
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:
|
66
|
-
sections: Checkoff::Sections.new(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:
|
127
|
-
sections: Checkoff::Sections.new(config
|
128
|
-
projects:
|
129
|
-
tasks: Checkoff::Tasks.new(config
|
130
|
-
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:
|
206
|
-
tasks: Checkoff::Tasks.new(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:
|
32
|
+
clients: Checkoff::Clients.new(config:),
|
33
33
|
client: clients.client,
|
34
|
-
workspaces: Checkoff::Workspaces.new(config
|
35
|
-
client:
|
34
|
+
workspaces: Checkoff::Workspaces.new(config:,
|
35
|
+
client:))
|
36
36
|
@workspaces = workspaces
|
37
37
|
@client = client
|
38
38
|
end
|
data/lib/checkoff/events.rb
CHANGED
@@ -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:
|
47
|
-
tasks: Checkoff::Tasks.new(config:
|
48
|
-
sections: Checkoff::Sections.new(config:
|
49
|
-
projects: Checkoff::Projects.new(config:
|
50
|
-
clients: Checkoff::Clients.new(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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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
|
135
|
+
fields:,
|
136
136
|
}
|
137
|
-
@client.tasks.find_by_id(task_gid, options:
|
137
|
+
@client.tasks.find_by_id(task_gid, options:)
|
138
138
|
rescue Asana::Errors::NotFound
|
139
139
|
nil
|
140
140
|
end
|
@@ -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:
|
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:
|
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:
|
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:
|
64
|
+
CustomFieldParamConverter.new(custom_field_params:).convert
|
65
65
|
end
|
66
66
|
|
67
67
|
# @param url_params [Hash<String, String>]
|
@@ -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:
|
19
|
-
sections: Checkoff::Sections.new(client:
|
20
|
-
custom_fields: Checkoff::CustomFields.new(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
|
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:
|
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:
|
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
|
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:
|
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:
|
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:
|
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
|
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:
|
29
|
+
Asana::Resources::Task.new(clean_task_data, client:)
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
@@ -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:
|
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
|
data/lib/checkoff/my_tasks.rb
CHANGED
@@ -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:
|
24
|
-
projects: Checkoff::Projects.new(config
|
25
|
-
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
|
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
|
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|
|
data/lib/checkoff/portfolios.rb
CHANGED
@@ -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:
|
36
|
+
clients: Checkoff::Clients.new(config:),
|
37
37
|
client: clients.client,
|
38
|
-
projects: Checkoff::Projects.new(config
|
39
|
-
workspaces: Checkoff::Workspaces.new(config
|
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:
|
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:
|
106
|
-
client.portfolios.get_items_for_portfolio(portfolio_gid: portfolio.gid, 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:
|
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:
|
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
|
50
|
-
workspaces
|
49
|
+
evaluator = ProjectSelectorEvaluator.new(project:, projects:, custom_fields:,
|
50
|
+
workspaces:, portfolios:)
|
51
51
|
evaluator.evaluate(project_selector)
|
52
52
|
end
|
53
53
|
|
data/lib/checkoff/projects.rb
CHANGED
@@ -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:
|
44
|
-
workspaces: Checkoff::Workspaces.new(config
|
45
|
-
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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
|
163
|
-
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
|
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:
|
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
|
data/lib/checkoff/resources.rb
CHANGED
@@ -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:
|
42
|
-
tasks: Checkoff::Tasks.new(config:
|
43
|
-
sections: Checkoff::Sections.new(config:
|
44
|
-
projects: Checkoff::Projects.new(config:
|
45
|
-
clients: Checkoff::Clients.new(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
|
@@ -20,17 +20,17 @@ 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 sections [Checkoff::Sections]
|
26
26
|
# @param custom_fields [Checkoff::CustomFields]
|
27
27
|
# @param clients [Checkoff::Clients]
|
28
28
|
# @param client [Asana::Client]
|
29
29
|
def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
|
30
|
-
workspaces: Checkoff::Workspaces.new(config:
|
31
|
-
sections: Checkoff::Sections.new(config:
|
32
|
-
custom_fields: Checkoff::CustomFields.new(config:
|
33
|
-
clients: Checkoff::Clients.new(config:
|
30
|
+
workspaces: Checkoff::Workspaces.new(config:),
|
31
|
+
sections: Checkoff::Sections.new(config:),
|
32
|
+
custom_fields: Checkoff::CustomFields.new(config:),
|
33
|
+
clients: Checkoff::Clients.new(config:),
|
34
34
|
client: clients.client)
|
35
35
|
@workspaces = workspaces
|
36
36
|
@sections = sections
|
@@ -44,8 +44,8 @@ module Checkoff
|
|
44
44
|
# @return [Boolean]
|
45
45
|
def filter_via_section_selector(section, section_selector)
|
46
46
|
# @sg-ignore
|
47
|
-
evaluator = SectionSelectorEvaluator.new(section
|
48
|
-
client:
|
47
|
+
evaluator = SectionSelectorEvaluator.new(section:, sections:, custom_fields:,
|
48
|
+
client:)
|
49
49
|
evaluator.evaluate(section_selector)
|
50
50
|
end
|
51
51
|
|