checkoff 0.26.1 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/checkoff/internal/search_url/custom_field_param_converter.rb +1 -0
- data/lib/checkoff/internal/search_url/custom_field_variant.rb +32 -20
- data/lib/checkoff/internal/task_selector_evaluator.rb +3 -1
- 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: bac942429684609678acb06e7426577be0bfd0239b9bf7ca4123e71484125746
|
4
|
+
data.tar.gz: 5cad1409ce70028e43f52789878b3d2cbcfaceb3bfcd26b230890a27d9d87fbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b68f2aa40aef9ecfe7fb4fbbe1bfac3b48f99c7cdf4ed1ed6308f93e3f4ac9f0d8b289bd5e82a7e1e05ee189b9fc62ca7cf6e07a237cb5d626318509ec24f5b8
|
7
|
+
data.tar.gz: 493cc1f59007c7fce4146e3bebae38a9447fa57cf418079afd835783529f8952c981e4bf86819fc8ec66f40f2c32a251da43fccafaf064316bee90f8bdbf781a
|
data/Gemfile.lock
CHANGED
@@ -49,6 +49,7 @@ module Checkoff
|
|
49
49
|
VARIANTS = {
|
50
50
|
'is' => CustomFieldVariant::Is,
|
51
51
|
'no_value' => CustomFieldVariant::NoValue,
|
52
|
+
'any_value' => CustomFieldVariant::AnyValue,
|
52
53
|
'is_not' => CustomFieldVariant::IsNot,
|
53
54
|
'less_than' => CustomFieldVariant::LessThan,
|
54
55
|
'greater_than' => CustomFieldVariant::GreaterThan,
|
@@ -16,6 +16,12 @@ module Checkoff
|
|
16
16
|
|
17
17
|
attr_reader :gid, :remaining_params
|
18
18
|
|
19
|
+
def ensure_no_remaining_params!
|
20
|
+
return if remaining_params.length.zero?
|
21
|
+
|
22
|
+
raise "Teach me how to handle these remaining keys: #{remaining_params}"
|
23
|
+
end
|
24
|
+
|
19
25
|
def fetch_solo_param(param_name)
|
20
26
|
case remaining_params.keys
|
21
27
|
when [param_name]
|
@@ -96,9 +102,7 @@ module Checkoff
|
|
96
102
|
# custom_field_#{gid}.variant = 'no_value'
|
97
103
|
class NoValue < CustomFieldVariant
|
98
104
|
def convert
|
99
|
-
|
100
|
-
raise "Teach me how to handle these remaining keys for #{variant_key}: #{remaining_params}"
|
101
|
-
end
|
105
|
+
ensure_no_remaining_params!
|
102
106
|
|
103
107
|
api_params = { "custom_fields.#{gid}.is_set" => 'false' }
|
104
108
|
# As of 2023-02, the 'is_set' => 'false' seems to not do
|
@@ -112,30 +116,38 @@ module Checkoff
|
|
112
116
|
end
|
113
117
|
end
|
114
118
|
|
115
|
-
# custom_field_#{gid}.variant = '
|
116
|
-
|
119
|
+
# custom_field_#{gid}.variant = 'any_value'
|
120
|
+
#
|
121
|
+
# Not used for multi-select fields
|
122
|
+
class AnyValue < CustomFieldVariant
|
117
123
|
def convert
|
118
|
-
|
119
|
-
raise "Teach me how to handle these remaining keys for #{variant_key}: #{remaining_params}"
|
120
|
-
end
|
124
|
+
ensure_no_remaining_params!
|
121
125
|
|
122
|
-
|
123
|
-
|
126
|
+
api_params = { "custom_fields.#{gid}.is_set" => 'true' }
|
127
|
+
task_selector = []
|
128
|
+
[api_params, task_selector]
|
124
129
|
end
|
130
|
+
end
|
125
131
|
|
126
|
-
|
132
|
+
# custom_field_#{gid}.variant = 'is'
|
133
|
+
class Is < CustomFieldVariant
|
134
|
+
def convert
|
135
|
+
selected_options = fetch_solo_param("custom_field_#{gid}.selected_options").split('~')
|
127
136
|
|
128
|
-
def convert_custom_field_is_arg(key, values)
|
129
137
|
empty_task_selector = []
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
138
|
+
if selected_options.length == 1
|
139
|
+
[{ "custom_fields.#{gid}.value" => selected_options[0] },
|
140
|
+
empty_task_selector]
|
141
|
+
else
|
142
|
+
# As of 2023-01,
|
143
|
+
# https://developers.asana.com/reference/searchtasksforworkspace
|
144
|
+
# says "Not Supported: searching for multiple exact
|
145
|
+
# matches of a custom field". So I guess we have to
|
146
|
+
# search this manually.
|
147
|
+
api_params = { "custom_fields.#{gid}.is_set" => 'true' }
|
148
|
+
task_selector = [:custom_field_gid_value_contains_any_gid, gid, selected_options]
|
149
|
+
[api_params, task_selector]
|
136
150
|
end
|
137
|
-
|
138
|
-
raise "Teach me how to handle #{key} = #{values}"
|
139
151
|
end
|
140
152
|
end
|
141
153
|
end
|
@@ -135,7 +135,9 @@ module Checkoff
|
|
135
135
|
def evaluate(task, custom_field_gid, custom_field_values_gids)
|
136
136
|
actual_custom_field_values_gids = pull_custom_field_values_gids(task, custom_field_gid)
|
137
137
|
|
138
|
-
|
138
|
+
actual_custom_field_values_gids.any? do |custom_field_value|
|
139
|
+
custom_field_values_gids.include?(custom_field_value)
|
140
|
+
end
|
139
141
|
end
|
140
142
|
|
141
143
|
private
|
data/lib/checkoff/version.rb
CHANGED