checkoff 0.149.0 → 0.151.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d22e09a2b3d0e47fa0eebca1c5484aa916327cf014caa2f5a5491c66791aa607
4
- data.tar.gz: aa50373ee49bf7c70f0930fbd8480670bb395ebf760e27309c3dbcfd692ff22d
3
+ metadata.gz: 814abd2292e805c48daa1ab1fbfafd5f48930f0690a40f0ec4f09ccf4236b2ab
4
+ data.tar.gz: fc4237862cf34cc1541bf025a982115d10d727733f4146d6dcfe2ad6d6222302
5
5
  SHA512:
6
- metadata.gz: f855008ebd7d20737f7d4e8771796f67c6c86ab0fb991e83469caca6de5bb3fac634c97edbd0b6728ae4c9191c979a75d91722f6729b74eb1318bb4ed293eabb
7
- data.tar.gz: 2bcdb1624b4bf845a61b6ac920277cccd13960212c5ce956fb02d304a9ef5a85110e9bf0f5ffb9d7bd1cdc0630b8caa7275a2ec28b95e858deab5c724514fdac
6
+ metadata.gz: bcbe6b9ec7e0b8c74bbb80a3493b8a223c4d9f4e6151068eb9fefaf5bf6f6db9babc158b69c59fff799f80f5841f59317ad5043daa8b12fa3c248a89f80b6b0c
7
+ data.tar.gz: e5af723e0c0877b78e4a546bbe511f2132439be39c3923033c59a4cfb640c5bd3616e735518db90e2fb0d3234bb6d971b9ba1e7374ffdd6aae5eccbad8b22064
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.149.0)
15
+ checkoff (0.151.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -52,6 +52,29 @@ module Checkoff
52
52
  end
53
53
  end
54
54
 
55
+ # :in_project_named? function
56
+ class InProjectNamedPFunctionEvaluator < FunctionEvaluator
57
+ def matches?
58
+ fn?(selector, :in_project_named?)
59
+ end
60
+
61
+ # @param _index [Integer]
62
+ def evaluate_arg?(_index)
63
+ false
64
+ end
65
+
66
+ # @sg-ignore
67
+ # @param task [Asana::Resources::Task]
68
+ # @param project_name [String]
69
+ # @return [Boolean]
70
+ def evaluate(task, project_name)
71
+ project_names = task.memberships.map do |membership|
72
+ membership.fetch('project').fetch('name')
73
+ end
74
+ project_names.include? project_name
75
+ end
76
+ end
77
+
55
78
  # :tag? function
56
79
  class TagPFunctionEvaluator < FunctionEvaluator
57
80
  def matches?
@@ -80,7 +80,7 @@ module Checkoff
80
80
  end
81
81
  end
82
82
  end
83
- cache_method :project, LONG_CACHE_TIME
83
+ cache_method :project, REALLY_LONG_CACHE_TIME
84
84
 
85
85
  # @param workspace_name [String]
86
86
  # @param project_name [String,Symbol<:my_tasks>]
@@ -93,7 +93,7 @@ module Checkoff
93
93
 
94
94
  p
95
95
  end
96
- cache_method :project_or_raise, LONG_CACHE_TIME
96
+ cache_method :project_or_raise, REALLY_LONG_CACHE_TIME
97
97
 
98
98
  # @param gid [String]
99
99
  # @param [Array<String>] extra_fields
@@ -102,7 +102,7 @@ module Checkoff
102
102
  def project_by_gid(gid, extra_fields: [])
103
103
  projects.find_by_id(gid, options: { fields: %w[name] + extra_fields })
104
104
  end
105
- cache_method :project_by_gid, LONG_CACHE_TIME
105
+ cache_method :project_by_gid, REALLY_LONG_CACHE_TIME
106
106
 
107
107
  # find uncompleted tasks in a list
108
108
  # @param [Enumerable<Asana::Resources::Task>] tasks
@@ -133,10 +133,12 @@ module Checkoff
133
133
  def projects_by_workspace_name(workspace_name, extra_fields: [])
134
134
  workspace = @workspaces.workspace_or_raise(workspace_name)
135
135
  options = { fields: %w[name] + extra_fields }
136
- projects.find_by_workspace(workspace: workspace.gid, per_page: 100, options: options)
136
+ # 15 minute cache resulted in 'Your pagination token has
137
+ # expired', so let's cache this a super long time and force
138
+ # evaluation
139
+ projects.find_by_workspace(workspace: workspace.gid, per_page: 100, options: options).to_a
137
140
  end
138
- # 15 minute cache resulted in 'Your pagination token has expired'
139
- cache_method :projects_by_workspace_name, MEDIUM_CACHE_TIME
141
+ cache_method :projects_by_workspace_name, REALLY_LONG_CACHE_TIME
140
142
 
141
143
  # @param project_obj [Asana::Resources::Project]
142
144
  # @param project [String, Symbol<:not_specified, :my_tasks>]
@@ -190,6 +192,7 @@ module Checkoff
190
192
  cache_method :projects, LONG_CACHE_TIME
191
193
 
192
194
  # @param [String] workspace_name
195
+ #
193
196
  # @return [Asana::Resources::Project]
194
197
  def my_tasks(workspace_name)
195
198
  workspace = @workspaces.workspace_or_raise(workspace_name)
@@ -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.149.0'
6
+ VERSION = '0.151.0'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.149.0
4
+ version: 0.151.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-05 00:00:00.000000000 Z
11
+ date: 2023-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport