checkoff 0.173.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1673c2678f44633dec96080ac5d922966010a76366fcaf386354b18af8b76b06
4
- data.tar.gz: 553d8638f76827ed472325af3643543fa05f190bda63bf152be949e7daf81235
3
+ metadata.gz: afd1b7c89796ffabac7ae3776f3b1f55abd649355d30b2f7c05865d359841116
4
+ data.tar.gz: 7970b7b72e38f600ff5ff03f21ab8a97fc6e4f583d963422c79006541758344b
5
5
  SHA512:
6
- metadata.gz: ad1531b9807b536e7c7bc937d9cbe236e2aa88b3322877a71dc146ba0e562a3404f1106f8b240e75860b11f21094713b24844cdb370b9cbb87a552889e53f397
7
- data.tar.gz: e664eb216308a74311b23ee76b37f2cb165f886387bd2c30c6581367c53e536afc9d3f21773e9e49b7a2a4e968f65646c2e5746ecb588e6bbfbe26eae8f5ef7f
6
+ metadata.gz: ffb5752c0a924f5fb4942a44a22e0778fe0c129048f7a893ae899b73731f13f5f5890671c018322d98057f82d284c35febe3ca92dbb7d34247dbc7b68d8bc5b4
7
+ data.tar.gz: 4456268d46432f2187d4984b1df16711bcc1fc82efb3c07f899225d21df897308cc6f5d206a8ff3b8859dfc4d9feaaed60925f697a1fa8646fdd0a45385b81d2
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.173.0)
15
+ checkoff (0.174.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -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 = HOUR
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: only_uncompleted,
124
- extra_fields: extra_fields)
125
- t.find { |task| task.name == task_name }
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 :task, SHORT_CACHE_TIME
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:, section_name: :unspecified)
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,
@@ -3,5 +3,5 @@
3
3
  # Command-line and gem client for Asana (unofficial)
4
4
  module Checkoff
5
5
  # Version of library
6
- VERSION = '0.173.0'
6
+ VERSION = '0.174.0'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.173.0
4
+ version: 0.174.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz