checkoff 0.171.0 → 0.173.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: f46e4443d512a1f25b9d1d960042905a99e929072dbc7d03261b204a100a7d9a
4
- data.tar.gz: 929a3df513e5cf742d9ce9a954a4a297725b61cb2bf2871504c4ace2831fb827
3
+ metadata.gz: 1673c2678f44633dec96080ac5d922966010a76366fcaf386354b18af8b76b06
4
+ data.tar.gz: 553d8638f76827ed472325af3643543fa05f190bda63bf152be949e7daf81235
5
5
  SHA512:
6
- metadata.gz: 2ddae4b92ad60143912b9ec9432c5ef807aff1c7a6165da1f48c7c034d0970071ec6a7d12ec1ba38d788bfee99d4ecc7a73a07ca784be6872be4a4bf838e8e5e
7
- data.tar.gz: 6c3a36a7b33f7234dde63c3cb8fca69e8390003605b962d56e2ac0e9cc2db12893a034a1a4c1e7ef661f1c1859654c34a2a9cf4ab6797a2ce4faa835e592f840
6
+ metadata.gz: ad1531b9807b536e7c7bc937d9cbe236e2aa88b3322877a71dc146ba0e562a3404f1106f8b240e75860b11f21094713b24844cdb370b9cbb87a552889e53f397
7
+ data.tar.gz: e664eb216308a74311b23ee76b37f2cb165f886387bd2c30c6581367c53e536afc9d3f21773e9e49b7a2a4e968f65646c2e5746ecb588e6bbfbe26eae8f5ef7f
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.171.0)
15
+ checkoff (0.173.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -31,10 +31,18 @@ module Checkoff
31
31
  logger.debug { "Filtering using #{@filters.inspect}" }
32
32
  return true if @filters.nil?
33
33
 
34
+ failures = []
35
+
34
36
  @filters.any? do |filter|
35
- out = filter_matches_asana_event?(filter, asana_event)
36
- logger.debug { "Filter #{filter.inspect} matched? #{out} against event #{asana_event.inspect}" }
37
- out
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
38
46
  end
39
47
  end
40
48
 
@@ -42,14 +50,18 @@ module Checkoff
42
50
 
43
51
  # @param filter [Hash]
44
52
  # @param asana_event [Hash]
53
+ # @param failures [Array<String>]
45
54
  #
46
55
  # @sg-ignore
47
56
  # @return [Boolean]
48
- def filter_matches_asana_event?(filter, asana_event)
57
+ def filter_matches_asana_event?(filter, asana_event, failures)
49
58
  # @param key [String]
50
59
  # @param value [String, Array<String>]
51
60
  filter.all? do |key, value|
52
- 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
53
65
  end
54
66
  end
55
67
 
@@ -141,7 +141,10 @@ module Checkoff
141
141
  options[:completed_since] = '9999-12-01' if only_uncompleted
142
142
  options[:project] = project_gid
143
143
  options[:options][:fields] += extra_fields
144
- client.tasks.find_all(**options)
144
+ # Note: 30 minute cache time on a raw Enumerable from SDK gives
145
+ # 'Your pagination token has expired' errors. So we go ahead
146
+ # and eagerly evaluate here so we can enjoy the cache.
147
+ client.tasks.find_all(**options).to_a
145
148
  end
146
149
  cache_method :tasks_from_project_gid, REALLY_LONG_CACHE_TIME
147
150
 
@@ -129,8 +129,11 @@ module Checkoff
129
129
  options = projects.task_options
130
130
  options[:options][:fields] += extra_fields
131
131
  options[:completed_since] = '9999-12-01' if only_uncompleted
132
+ # Note: 30 minute cache time on a raw Enumerable from SDK gives
133
+ # 'Your pagination token has expired' errors. So we go ahead
134
+ # and eagerly evaluate here so we can enjoy the cache.
132
135
  client.tasks.get_tasks(section: section.gid,
133
- **options)
136
+ **options).to_a
134
137
  end
135
138
  cache_method :tasks, REALLY_LONG_CACHE_TIME
136
139
 
@@ -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.171.0'
6
+ VERSION = '0.173.0'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkoff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.171.0
4
+ version: 0.173.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz