checkoff 0.184.0 → 0.185.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/events.rb +40 -0
- 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: 2c144884f931d0a839d66654dbb1ce02487d6024bbd32ca3a56ed749dfb650fa
|
4
|
+
data.tar.gz: fbce0b5063ca8dbec172cc2f3d062a266daae30af1d70d090586cb8eee485b03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c77b6170bf7eaa08e532eb38013ff25ae581d7363543128516a98d1cf354bc5137e6caa24e8f99d5d2ec52747ed300fc3e9ab279a3a209e89eee5a64b5900b10
|
7
|
+
data.tar.gz: 928dba035f252897d2a400b1b55ba05bf98dc91f676818395a6d070f14ed0f179a8e09421f4580f9c7c3bff15d1570eee7b7561d0a4d01b0d3dfcd68d0f6ab83
|
data/Gemfile.lock
CHANGED
data/lib/checkoff/events.rb
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
require 'forwardable'
|
6
6
|
require 'cache_method'
|
7
7
|
require_relative 'internal/config_loader'
|
8
|
+
require_relative 'internal/logging'
|
8
9
|
require_relative 'internal/asana_event_filter'
|
9
10
|
require_relative 'workspaces'
|
10
11
|
require_relative 'clients'
|
@@ -32,15 +33,18 @@ module Checkoff
|
|
32
33
|
|
33
34
|
# @param config [Hash]
|
34
35
|
# @param workspaces [Checkoff::Workspaces]
|
36
|
+
# @param tasks [Checkoff::Tasks]
|
35
37
|
# @param clients [Checkoff::Clients]
|
36
38
|
# @param client [Asana::Client]
|
37
39
|
# @param asana_event_filter_class [Class<Checkoff::Internal::AsanaEventFilter>]
|
38
40
|
def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
|
39
41
|
workspaces: Checkoff::Workspaces.new(config: config),
|
42
|
+
tasks: Checkoff::Tasks.new(config: config),
|
40
43
|
clients: Checkoff::Clients.new(config: config),
|
41
44
|
client: clients.client,
|
42
45
|
asana_event_filter_class: Checkoff::Internal::AsanaEventFilter)
|
43
46
|
@workspaces = workspaces
|
47
|
+
@tasks = tasks
|
44
48
|
@client = client
|
45
49
|
@asana_event_filter_class = asana_event_filter_class
|
46
50
|
end
|
@@ -54,8 +58,44 @@ module Checkoff
|
|
54
58
|
asana_events.select { |event| asana_event_filter.matches?(event) }
|
55
59
|
end
|
56
60
|
|
61
|
+
# Add useful info (like resource task names) into an event for
|
62
|
+
# human consumption
|
63
|
+
#
|
64
|
+
# @param asana_event [Hash]
|
65
|
+
#
|
66
|
+
# @return [Hash]
|
67
|
+
def enrich_event(asana_event)
|
68
|
+
finer { "Enriching event: #{asana_event}" }
|
69
|
+
asana_event = asana_event.dup
|
70
|
+
enrich_event_resource!(asana_event)
|
71
|
+
asana_event
|
72
|
+
end
|
73
|
+
|
57
74
|
private
|
58
75
|
|
76
|
+
# @param asana_event [Hash{'resource' => Hash}]
|
77
|
+
#
|
78
|
+
# @return [void]
|
79
|
+
def enrich_event_resource!(asana_event)
|
80
|
+
# @type [Hash{String => String }]
|
81
|
+
resource = asana_event['resource']
|
82
|
+
# @type [String]
|
83
|
+
resource_type = resource.fetch('resource_type')
|
84
|
+
# @type [String]
|
85
|
+
gid = resource.fetch('gid')
|
86
|
+
|
87
|
+
if resource_type == 'task'
|
88
|
+
task = tasks.task_by_gid(gid, only_uncompleted: false)
|
89
|
+
resource['checkoff:name'] = task.name if task
|
90
|
+
end
|
91
|
+
nil
|
92
|
+
end
|
93
|
+
|
94
|
+
include Logging
|
95
|
+
|
96
|
+
# @return [Checkoff::Tasks]
|
97
|
+
attr_reader :tasks
|
98
|
+
|
59
99
|
# @return [Checkoff::Workspaces]
|
60
100
|
attr_reader :workspaces
|
61
101
|
|
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.185.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-
|
11
|
+
date: 2024-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|