checkoff 0.26.1 → 0.28.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/search_url/simple_param_converter.rb +8 -3
- data/lib/checkoff/internal/task_selector_evaluator.rb +3 -1
- data/lib/checkoff/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc77ff8291abdf8396b00f06b6a264aced462d4017962f22b12be600ca0838e7
|
4
|
+
data.tar.gz: 04cd04ace148582a064b9eb52fa46e738e8621effe5316f8e9dc75909564d3b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aa7f83850fd0b422d1c9d2e9f0634da82bc16bfd9a84a0116b839921c64448de06b49a7c8af009bfce2c282d5c7b6f65b2cf7e5dc4fdef31724613984010c31
|
7
|
+
data.tar.gz: 9317f20ab81c07d64ae5c955ffe345a2849ba966d5faf9de03d73e8712ddac3ad0d1d90ac70dc7af3af54dcf6a12ae48bb80aa8e4ec43eed4368942fae206b32
|
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
|
@@ -71,9 +71,14 @@ module Checkoff
|
|
71
71
|
# Handle 'completion' search url param
|
72
72
|
class Completion < SimpleParam
|
73
73
|
def convert
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
case single_value
|
75
|
+
when 'incomplete'
|
76
|
+
['completed', false]
|
77
|
+
when 'complete'
|
78
|
+
['completed', true]
|
79
|
+
else
|
80
|
+
raise "Teach me how to handle #{key} = #{values}"
|
81
|
+
end
|
77
82
|
end
|
78
83
|
end
|
79
84
|
|
@@ -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
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.
|
4
|
+
version: 0.28.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-02-
|
11
|
+
date: 2023-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|