checkoff 0.170.0 → 0.172.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/checkoff/internal/asana_event_filter.rb +26 -12
- 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: 460a9e7a6cd597a95b8a4d1510776d842433d53d77e12995eaafd14473edaa8d
|
4
|
+
data.tar.gz: cb639a1b164c6029577a13643a0688bd68ce09b507b5ad1c962ad9a060e41f55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2279da4267561c7b61865047ecb2646de2d288954e792496272cf5c1ddf3408b59c333498120bb29a86c43f534b029632f9ad5b38bc1e51c0fccdfb17da47fa9
|
7
|
+
data.tar.gz: 2dba9cc6ad70e3c8b682c760d7f8b9a20698362d06bca51487e4475ed39265db86589c28ff1596926495c5e7de7554871e9d85f124ff7a79d5bf2f220568df12
|
data/Gemfile.lock
CHANGED
@@ -17,11 +17,13 @@ module Checkoff
|
|
17
17
|
include Logging
|
18
18
|
|
19
19
|
# @param filters [Array<Hash>, nil] The filters to match against
|
20
|
-
# @param
|
20
|
+
# @param clients [Checkoff::Clients]
|
21
|
+
# @param client [Asana::Client]
|
21
22
|
def initialize(filters:,
|
22
|
-
|
23
|
+
clients: Checkoff::Clients.new,
|
24
|
+
client: clients.client)
|
23
25
|
@filters = filters
|
24
|
-
@
|
26
|
+
@client = client
|
25
27
|
end
|
26
28
|
|
27
29
|
# @param asana_event [Hash] The event that Asana sent
|
@@ -29,10 +31,18 @@ module Checkoff
|
|
29
31
|
logger.debug { "Filtering using #{@filters.inspect}" }
|
30
32
|
return true if @filters.nil?
|
31
33
|
|
34
|
+
failures = []
|
35
|
+
|
32
36
|
@filters.any? do |filter|
|
33
|
-
|
34
|
-
logger.debug { "Filter #{filter.inspect} matched? #{
|
35
|
-
|
37
|
+
filter_matches = filter_matches_asana_event?(filter, asana_event, failures)
|
38
|
+
logger.debug { "Filter #{filter.inspect} matched? #{filter_matches} against event #{asana_event.inspect}" }
|
39
|
+
unless filter_matches
|
40
|
+
logger.info do
|
41
|
+
"Filter #{filter.inspect} failed to match event #{asana_event.inspect} because of #{failures.inspect}"
|
42
|
+
end
|
43
|
+
failures << filter
|
44
|
+
end
|
45
|
+
filter_matches
|
36
46
|
end
|
37
47
|
end
|
38
48
|
|
@@ -40,14 +50,18 @@ module Checkoff
|
|
40
50
|
|
41
51
|
# @param filter [Hash]
|
42
52
|
# @param asana_event [Hash]
|
53
|
+
# @param failures [Array<String>]
|
43
54
|
#
|
44
55
|
# @sg-ignore
|
45
56
|
# @return [Boolean]
|
46
|
-
def filter_matches_asana_event?(filter, asana_event)
|
57
|
+
def filter_matches_asana_event?(filter, asana_event, failures)
|
47
58
|
# @param key [String]
|
48
59
|
# @param value [String, Array<String>]
|
49
60
|
filter.all? do |key, value|
|
50
|
-
asana_event_matches_filter_item?(key, value, asana_event)
|
61
|
+
matches = asana_event_matches_filter_item?(key, value, asana_event)
|
62
|
+
failures << "#{key.inspect} = #{value.inspect}" unless matches
|
63
|
+
|
64
|
+
matches
|
51
65
|
end
|
52
66
|
end
|
53
67
|
|
@@ -82,10 +96,10 @@ module Checkoff
|
|
82
96
|
end
|
83
97
|
|
84
98
|
task_gid = resource.fetch('gid')
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
99
|
+
options = {
|
100
|
+
fields: ['completed_at'],
|
101
|
+
}
|
102
|
+
task = @client.tasks.find_by_id(task_gid, options: options)
|
89
103
|
task_completed = !task.completed_at.nil?
|
90
104
|
task_completed == value
|
91
105
|
else
|
data/lib/checkoff/version.rb
CHANGED