checkoff 0.169.0 → 0.171.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: b419b90533969c11f309154a42042afc9355aa1a1c1ba964f535887d170a0a09
4
- data.tar.gz: c05bf7c5f77ed15d652f276f3ef5383d12317626f6c4c99cdfbbbf17d4d90884
3
+ metadata.gz: f46e4443d512a1f25b9d1d960042905a99e929072dbc7d03261b204a100a7d9a
4
+ data.tar.gz: 929a3df513e5cf742d9ce9a954a4a297725b61cb2bf2871504c4ace2831fb827
5
5
  SHA512:
6
- metadata.gz: e7eadd8eafadff6b0e493926faf1eaa7f07eb5a29a766f00d82e7756bbf37d4fc2a7f54a199e545d90b6dfbd97ea6fc2be91f8ab04dc61b1bb3142c38986f36b
7
- data.tar.gz: 0a1cfb55148e3ec98711e1bc5b6b8976f809adafda374348dbe95a381850a4ece2eea931cfecdd45411eedda17fc92ea05513d10a96afe1c007496c84ec72bc7
6
+ metadata.gz: 2ddae4b92ad60143912b9ec9432c5ef807aff1c7a6165da1f48c7c034d0970071ec6a7d12ec1ba38d788bfee99d4ecc7a73a07ca784be6872be4a4bf838e8e5e
7
+ data.tar.gz: 6c3a36a7b33f7234dde63c3cb8fca69e8390003605b962d56e2ac0e9cc2db12893a034a1a4c1e7ef661f1c1859654c34a2a9cf4ab6797a2ce4faa835e592f840
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.169.0)
15
+ checkoff (0.171.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -7,7 +7,7 @@ module Checkoff
7
7
  # Uses an enhanced version of Asana event filter configuration
8
8
  #
9
9
  # See https://developers.asana.com/reference/createwebhook | body
10
- # params | data | filters for a general description of the scheme.
10
+ # params | data | filters | add object for a general description of the scheme.
11
11
  #
12
12
  # Additional supported filter keys:
13
13
  #
@@ -17,8 +17,13 @@ module Checkoff
17
17
  include Logging
18
18
 
19
19
  # @param filters [Array<Hash>, nil] The filters to match against
20
- def initialize(filters:)
20
+ # @param clients [Checkoff::Clients]
21
+ # @param client [Asana::Client]
22
+ def initialize(filters:,
23
+ clients: Checkoff::Clients.new,
24
+ client: clients.client)
21
25
  @filters = filters
26
+ @client = client
22
27
  end
23
28
 
24
29
  # @param asana_event [Hash] The event that Asana sent
@@ -66,6 +71,25 @@ module Checkoff
66
71
  value.include? asana_event.fetch('change', {})['field']
67
72
  when 'checkoff:parent.gid'
68
73
  asana_event.fetch('parent', {})['gid'] == value
74
+ when 'checkoff:resource.gid'
75
+ asana_event.fetch('resource', {})['gid'] == value
76
+ when 'checkoff:fetched.completed'
77
+ # @type [Hash{String => String}]
78
+ # @sg-ignore
79
+ resource = asana_event.fetch('resource')
80
+ # @type [String]
81
+ resource_type = resource.fetch('resource_type')
82
+ unless resource_type == 'task'
83
+ raise "Teach me how to check #{key.inspect} on resource type #{resource_type.inspect}"
84
+ end
85
+
86
+ task_gid = resource.fetch('gid')
87
+ options = {
88
+ fields: ['completed_at'],
89
+ }
90
+ task = @client.tasks.find_by_id(task_gid, options: options)
91
+ task_completed = !task.completed_at.nil?
92
+ task_completed == value
69
93
  else
70
94
  raise "Unknown filter key #{key}"
71
95
  end
@@ -135,7 +135,7 @@ module Checkoff
135
135
  # @return [Asana::Resources::Task, nil]
136
136
  def task_by_gid(task_gid,
137
137
  extra_fields: [],
138
- only_uncompleted: false)
138
+ only_uncompleted: true)
139
139
  # @type [Hash]
140
140
  options = projects.task_options.fetch(:options, {})
141
141
  options[:fields] += extra_fields
@@ -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.169.0'
6
+ VERSION = '0.171.0'
7
7
  end
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.169.0
4
+ version: 0.171.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: 2024-01-14 00:00:00.000000000 Z
11
+ date: 2024-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport