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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e346e26787afb1656a88445f35f22cd18c88519080b6224d4dcb83074149696f
4
- data.tar.gz: f33d96167e8036964aee3eaa9a69e8b3e81c31a4e9fcec314ece54defe375b83
3
+ metadata.gz: 460a9e7a6cd597a95b8a4d1510776d842433d53d77e12995eaafd14473edaa8d
4
+ data.tar.gz: cb639a1b164c6029577a13643a0688bd68ce09b507b5ad1c962ad9a060e41f55
5
5
  SHA512:
6
- metadata.gz: abf2f44932128fdfdf7d89e162431d4e4cfa89029bd106adb3b49ad6cc801e5b41838249595cf1f7dab8d25d3d52dcc1a2114be1f8f4a821dead7b9dcaf2fb71
7
- data.tar.gz: 3828a170cdaa9cdd0f82beb5830dc2392a87a69bb45bff4f54d06865a6acde7a9962379c94435f03d3774450e6f4939ef282bd8e8922b4360d8162d809630b13
6
+ metadata.gz: 2279da4267561c7b61865047ecb2646de2d288954e792496272cf5c1ddf3408b59c333498120bb29a86c43f534b029632f9ad5b38bc1e51c0fccdfb17da47fa9
7
+ data.tar.gz: 2dba9cc6ad70e3c8b682c760d7f8b9a20698362d06bca51487e4475ed39265db86589c28ff1596926495c5e7de7554871e9d85f124ff7a79d5bf2f220568df12
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.170.0)
15
+ checkoff (0.172.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -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 tasks [Checkoff::Tasks]
20
+ # @param clients [Checkoff::Clients]
21
+ # @param client [Asana::Client]
21
22
  def initialize(filters:,
22
- tasks: Checkoff::Tasks.new)
23
+ clients: Checkoff::Clients.new,
24
+ client: clients.client)
23
25
  @filters = filters
24
- @tasks = tasks
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
- out = filter_matches_asana_event?(filter, asana_event)
34
- logger.debug { "Filter #{filter.inspect} matched? #{out} against event #{asana_event.inspect}" }
35
- 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
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
- task = @tasks.task_by_gid(task_gid,
87
- extra_fields: ['completed_at'],
88
- only_uncompleted: false)
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
@@ -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.170.0'
6
+ VERSION = '0.172.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.170.0
4
+ version: 0.172.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz