checkoff 0.172.0 → 0.174.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/checkoff/projects.rb +4 -1
- data/lib/checkoff/sections.rb +4 -1
- data/lib/checkoff/tasks.rb +22 -6
- data/lib/checkoff/version.rb +1 -1
- 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: afd1b7c89796ffabac7ae3776f3b1f55abd649355d30b2f7c05865d359841116
|
4
|
+
data.tar.gz: 7970b7b72e38f600ff5ff03f21ab8a97fc6e4f583d963422c79006541758344b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffb5752c0a924f5fb4942a44a22e0778fe0c129048f7a893ae899b73731f13f5f5890671c018322d98057f82d284c35febe3ca92dbb7d34247dbc7b68d8bc5b4
|
7
|
+
data.tar.gz: 4456268d46432f2187d4984b1df16711bcc1fc82efb3c07f899225d21df897308cc6f5d206a8ff3b8859dfc4d9feaaed60925f697a1fa8646fdd0a45385b81d2
|
data/Gemfile.lock
CHANGED
data/lib/checkoff/projects.rb
CHANGED
@@ -141,7 +141,10 @@ module Checkoff
|
|
141
141
|
options[:completed_since] = '9999-12-01' if only_uncompleted
|
142
142
|
options[:project] = project_gid
|
143
143
|
options[:options][:fields] += extra_fields
|
144
|
-
|
144
|
+
# Note: 30 minute cache time on a raw Enumerable from SDK gives
|
145
|
+
# 'Your pagination token has expired' errors. So we go ahead
|
146
|
+
# and eagerly evaluate here so we can enjoy the cache.
|
147
|
+
client.tasks.find_all(**options).to_a
|
145
148
|
end
|
146
149
|
cache_method :tasks_from_project_gid, REALLY_LONG_CACHE_TIME
|
147
150
|
|
data/lib/checkoff/sections.rb
CHANGED
@@ -129,8 +129,11 @@ module Checkoff
|
|
129
129
|
options = projects.task_options
|
130
130
|
options[:options][:fields] += extra_fields
|
131
131
|
options[:completed_since] = '9999-12-01' if only_uncompleted
|
132
|
+
# Note: 30 minute cache time on a raw Enumerable from SDK gives
|
133
|
+
# 'Your pagination token has expired' errors. So we go ahead
|
134
|
+
# and eagerly evaluate here so we can enjoy the cache.
|
132
135
|
client.tasks.get_tasks(section: section.gid,
|
133
|
-
**options)
|
136
|
+
**options).to_a
|
134
137
|
end
|
135
138
|
cache_method :tasks, REALLY_LONG_CACHE_TIME
|
136
139
|
|
data/lib/checkoff/tasks.rb
CHANGED
@@ -22,7 +22,7 @@ module Checkoff
|
|
22
22
|
MINUTE = 60
|
23
23
|
HOUR = MINUTE * 60
|
24
24
|
DAY = 24 * HOUR
|
25
|
-
REALLY_LONG_CACHE_TIME =
|
25
|
+
REALLY_LONG_CACHE_TIME = MINUTE * 30
|
26
26
|
LONG_CACHE_TIME = MINUTE * 15
|
27
27
|
SHORT_CACHE_TIME = MINUTE * 5
|
28
28
|
|
@@ -116,15 +116,31 @@ module Checkoff
|
|
116
116
|
section_name: :unspecified,
|
117
117
|
only_uncompleted: true,
|
118
118
|
extra_fields: [])
|
119
|
+
task_gid = gid_for_task(workspace_name, project_name, section_name, task_name)
|
120
|
+
|
121
|
+
return nil if task_gid.nil?
|
122
|
+
|
123
|
+
task_by_gid(task_gid, only_uncompleted: only_uncompleted, extra_fields: extra_fields)
|
124
|
+
end
|
125
|
+
cache_method :task, LONG_CACHE_TIME
|
126
|
+
|
127
|
+
# @param workspace_name [String]
|
128
|
+
# @param project_name [String, Symbol]
|
129
|
+
# @param section_name [String, nil, Symbol]
|
130
|
+
# @param task_name [String]
|
131
|
+
#
|
132
|
+
# @return [String, nil]
|
133
|
+
# @sg-ignore
|
134
|
+
def gid_for_task(workspace_name, project_name, section_name, task_name)
|
119
135
|
# @sg-ignore
|
120
136
|
t = tasks(workspace_name,
|
121
137
|
project_name,
|
122
138
|
section_name: section_name,
|
123
|
-
only_uncompleted:
|
124
|
-
|
125
|
-
|
139
|
+
only_uncompleted: false)
|
140
|
+
task_for_gid = t.find { |task| task.name == task_name }
|
141
|
+
task_for_gid&.gid
|
126
142
|
end
|
127
|
-
cache_method :
|
143
|
+
cache_method :gid_for_task, REALLY_LONG_CACHE_TIME
|
128
144
|
|
129
145
|
# Pull a specific task by GID
|
130
146
|
#
|
@@ -296,7 +312,7 @@ module Checkoff
|
|
296
312
|
#
|
297
313
|
# @return [Enumerable<Asana::Resources::Task>]
|
298
314
|
def tasks(workspace_name, project_name,
|
299
|
-
only_uncompleted:, extra_fields
|
315
|
+
only_uncompleted:, extra_fields: [], section_name: :unspecified)
|
300
316
|
if section_name == :unspecified
|
301
317
|
project = projects.project_or_raise(workspace_name, project_name)
|
302
318
|
projects.tasks_from_project(project,
|
data/lib/checkoff/version.rb
CHANGED