checkoff 0.63.0 → 0.64.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: 870d0aaf17cc3677a6209c961c39a604808a2917e1433ea6b1949f9036fbec53
4
- data.tar.gz: 5a15faf6c77c61ec5ee134e1d9939a52305245af7bebe799df2d15061ef05d86
3
+ metadata.gz: 8f64d6fbce5098a3e661dd96ba4ece4f1831dbeba5d2e2c12a88eae3097d3219
4
+ data.tar.gz: 612935d38a740717eeb8b23db2396352afde0ee53b3a625cb74a51e09198538e
5
5
  SHA512:
6
- metadata.gz: ebc00c7a9a2a8ae6a7b37f2473c041fae4b8a474689f634b25dc1f286ffcb4b0b23de0cf9b617d8cb84b55acef6b6fb82d222bfe3913a49e3dfcfd1d5a04ee86
7
- data.tar.gz: f735d342a7edee9681802326151212a83df2a9abf85b3e30ef050d608d3b5edacadcd414af12cd6cd47c85cbd1569b513adfbce4ae5dba012f6d2724f7da63bf
6
+ metadata.gz: 4e14fb70b482d53376784b7659c9c2e67a4d05c80888bb826c12b9d2d4d5cfa6dc9c44c6fe552b907de789e2773c86c20debbe2a2a8a252e55545ebf0ce1e071
7
+ data.tar.gz: 7a044e9893cc848c78192d8ae1002bd5a7e8e5c2703e3016adcfbe47cdfdcac5ba87bca587b4e4e91a6ac2fea7d115f0037ca6f10e0923294e5a77c01b6360e8
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.63.0)
15
+ checkoff (0.64.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -51,6 +51,10 @@
51
51
  # def create(client, assignee:, workspace:, name:); end
52
52
  # end
53
53
  # end
54
+ # class Project
55
+ # # @return [String,nil]
56
+ # def due_date; end
57
+ # end
54
58
  # end
55
59
  # module Resources
56
60
  # class Workspace
@@ -116,16 +116,36 @@ module Checkoff
116
116
  end
117
117
  end
118
118
 
119
- # @param project [Asana::Resources::Project]
119
+ # @param custom_field [Hash]
120
+ # @param enum_value [Object, nil]
121
+ # @return [Array<String>]
122
+ def find_names(enum_value)
123
+ [enum_value.fetch('name')]
124
+ end
125
+
126
+ # @param project [Asana::Resources::Project,Asana::Resources::Task]
120
127
  # @param custom_field_gid [String]
121
128
  # @return [Array<String>]
122
- def pull_custom_field_values_gids(project, custom_field_gid)
129
+ def pull_custom_field_values_gids_or_raise(project, custom_field_gid)
123
130
  custom_field = pull_custom_field_or_raise(project, custom_field_gid)
131
+
124
132
  pull_enum_values(custom_field).flat_map do |enum_value|
125
133
  find_gids(custom_field, enum_value)
126
134
  end
127
135
  end
128
136
 
137
+ # @param resource [Asana::Resources::Project,Asana::Resources::Task]
138
+ # @param custom_field_name [String]
139
+ # @return [Array<String>]
140
+ def pull_custom_field_values_names_by_name(resource, custom_field_name)
141
+ custom_field = pull_custom_field_by_name(resource, custom_field_name)
142
+ return [] if custom_field.nil?
143
+
144
+ pull_enum_values(custom_field).flat_map do |enum_value|
145
+ find_names(enum_value)
146
+ end
147
+ end
148
+
129
149
  # @sg-ignore
130
150
  # @param project [Asana::Resources::Project]
131
151
  # @param custom_field_name [String]
@@ -150,7 +150,7 @@ module Checkoff
150
150
  # @param custom_field_values_gids [Array<String>]
151
151
  # @return [Boolean]
152
152
  def evaluate(resource, custom_field_gid, custom_field_values_gids)
153
- actual_custom_field_values_gids = pull_custom_field_values_gids(resource, custom_field_gid)
153
+ actual_custom_field_values_gids = pull_custom_field_values_gids_or_raise(resource, custom_field_gid)
154
154
 
155
155
  actual_custom_field_values_gids.any? do |custom_field_value|
156
156
  custom_field_values_gids.include?(custom_field_value)
@@ -172,14 +172,14 @@ module Checkoff
172
172
 
173
173
  # @param resource [Asana::Resources::Task,Asana::Resources::Project]
174
174
  # @param custom_field_name [String]
175
- # @param custom_field_values [Array<String>]
175
+ # @param custom_field_value_names [Array<String>]
176
176
  # @return [Boolean]
177
- def evaluate(resource, custom_field_name, custom_field_values)
178
- custom_field = pull_custom_field_by_name(resource, custom_field_name)
179
-
180
- return false if custom_field.nil?
177
+ def evaluate(resource, custom_field_name, custom_field_value_names)
178
+ actual_custom_field_values_names = pull_custom_field_values_names_by_name(resource, custom_field_name)
181
179
 
182
- custom_field_values.include?(custom_field.fetch('display_value'))
180
+ actual_custom_field_values_names.any? do |custom_field_value|
181
+ custom_field_value_names.include?(custom_field_value)
182
+ end
183
183
  end
184
184
  end
185
185
 
@@ -200,7 +200,7 @@ module Checkoff
200
200
  # @param custom_field_values_gids [Array<String>]
201
201
  # @return [Boolean]
202
202
  def evaluate(resource, custom_field_gid, custom_field_values_gids)
203
- actual_custom_field_values_gids = pull_custom_field_values_gids(resource, custom_field_gid)
203
+ actual_custom_field_values_gids = pull_custom_field_values_gids_or_raise(resource, custom_field_gid)
204
204
 
205
205
  custom_field_values_gids.all? do |custom_field_value|
206
206
  actual_custom_field_values_gids.include?(custom_field_value)
@@ -5,6 +5,21 @@ require_relative 'project/function_evaluator'
5
5
  module Checkoff
6
6
  module SelectorClasses
7
7
  # Project selector classes
8
- module Project; end
8
+ module Project
9
+ # :due_date function
10
+ class DueDateFunctionEvaluator < FunctionEvaluator
11
+ FUNCTION_NAME = :due_date
12
+
13
+ def matches?
14
+ fn?(selector, FUNCTION_NAME)
15
+ end
16
+
17
+ # @param resource [Asana::Resources::Project]
18
+ # @return [String, nil]
19
+ def evaluate(resource)
20
+ resource.due_date
21
+ end
22
+ end
23
+ end
9
24
  end
10
25
  end
@@ -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.63.0'
6
+ VERSION = '0.64.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.63.0
4
+ version: 0.64.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-10-09 00:00:00.000000000 Z
11
+ date: 2023-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport