checkoff 0.46.1 → 0.47.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: 5a4be48acbc5f3ab9954ca8f7ec3ef64f1c629bfbc0015f158cde7a87fcc4049
4
- data.tar.gz: 1824e5607d750cc1d9b2161dc897cd4a08fd90c27fea1c4cc7a5f19ee4e2c497
3
+ metadata.gz: ceda0651cbf579c86f81e93c887531c64a3147519488daf1be6d11491e896bf9
4
+ data.tar.gz: 17c109b638773681a63b209ab74b82f6de4bba2962b2475ceac8305c426f14aa
5
5
  SHA512:
6
- metadata.gz: 3ef67e1152d4399b8b507a6b6b6555f300ac83ffda4b998a8ae031ada997deabdd60974228db9cb01101bf319a3092a36fa259391c4fbdc6940266e1d53f923d
7
- data.tar.gz: e04b024a9f4def03f62fb7a8b1498e53ed2d08cc53cff3a5b76bc7f16b6a20402a450704a7f782372b5f3438a7ecad063f1e7047b552d50a360fa7c5d1d60dbc
6
+ metadata.gz: 183735480d70aef2cfb4a23bf0b37e18df9360208286bd16ff5fbbfe07dcb5447918cd0400604cb95cb0720b11322effee388af4c9b3832d92b06b6b5a400ac6
7
+ data.tar.gz: 3c93bb2a2182f53960e763fdab615741be3ec9fc7cfc383c907ef6adf09351fd4b000be9869d8bec37b2cf221c3d41aa52dc6714ed398fad11c90dfc558e95e1
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.46.1)
15
+ checkoff (0.47.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -32,6 +32,17 @@ module Checkoff
32
32
  object.is_a?(Array) && !object.empty? && [fn_name, fn_name.to_s].include?(object[0])
33
33
  end
34
34
 
35
+ # @param task [Asana::Resources::Task]
36
+ # @param field_name [Symbol]
37
+ #
38
+ # @sg-ignore
39
+ # @return [Date, nil]
40
+ def pull_date_field_by_name_or_raise(task, field_name)
41
+ raise "Teach me how to handle field #{field_name}" unless field_name == :modified_at
42
+
43
+ task.modified_at
44
+ end
45
+
35
46
  # @sg-ignore
36
47
  # @param task [Asana::Resources::Task]
37
48
  # @param custom_field_gid [String]
@@ -330,6 +341,34 @@ module Checkoff
330
341
  end
331
342
  end
332
343
 
344
+ # :field_less_than_n_days_ago
345
+ class FieldLessThanNDaysAgoFunctionEvaluator < FunctionEvaluator
346
+ FUNCTION_NAME = :field_less_than_n_days_ago
347
+
348
+ def matches?
349
+ fn?(task_selector, FUNCTION_NAME)
350
+ end
351
+
352
+ def evaluate_arg?(_index)
353
+ false
354
+ end
355
+
356
+ # @param task [Asana::Resources::Task]
357
+ # @param field_name [Symbol]
358
+ # @param num_days [Integer]
359
+ #
360
+ # @return [Boolean]
361
+ def evaluate(task, field_name, num_days)
362
+ time = pull_date_field_by_name_or_raise(task, field_name)
363
+
364
+ return false if time.nil?
365
+
366
+ n_days_ago = (Time.now - (num_days * 24 * 60 * 60))
367
+ # @sg-ignore
368
+ time < n_days_ago
369
+ end
370
+ end
371
+
333
372
  # :custom_field_less_than_n_days_from_now function
334
373
  class CustomFieldLessThanNDaysFromNowFunctionEvaluator < FunctionEvaluator
335
374
  FUNCTION_NAME = :custom_field_less_than_n_days_from_now
@@ -427,6 +466,7 @@ module Checkoff
427
466
  Checkoff::TaskSelectorClasses::AndFunctionEvaluator,
428
467
  Checkoff::TaskSelectorClasses::DuePFunctionEvaluator,
429
468
  Checkoff::TaskSelectorClasses::DueDateSetPFunctionEvaluator,
469
+ Checkoff::TaskSelectorClasses::FieldLessThanNDaysAgoFunctionEvaluator,
430
470
  Checkoff::TaskSelectorClasses::CustomFieldLessThanNDaysFromNowFunctionEvaluator,
431
471
  Checkoff::TaskSelectorClasses::CustomFieldGreaterThanOrEqualToNDaysFromNowFunctionEvaluator,
432
472
  Checkoff::TaskSelectorClasses::StringLiteralEvaluator,
@@ -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.46.1'
6
+ VERSION = '0.47.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.46.1
4
+ version: 0.47.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: 2023-09-02 00:00:00.000000000 Z
11
+ date: 2023-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport