checkoff 0.51.0 → 0.52.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/internal/search_url/date_param_converter.rb +49 -19
- 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: c150952f6929705defdcfb0d506308ca1d5e285e732eb6715fcb9c03a78e8ad4
|
4
|
+
data.tar.gz: ac88caf643edccda95c7fcf345e601bcee87f6f1e59b0af83136fe7194420766
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d4a6454075c4e2332b3c59ca3f93b3358b77f77f8bf43e2c7e28f9a615d73b204edc3b1ac00b51acbe109355ae3b6a16b30944bd13ea6be653dc28e2e45d857
|
7
|
+
data.tar.gz: 774fb7f8311cc540f762f36d30f79b59de16897105ae8a34496585a5c1c6e19353b37736b691b98b3bc447a88685bdd73db297dbaa23f2bde1b3d70f0ef47ab2
|
data/Gemfile.lock
CHANGED
@@ -14,6 +14,45 @@ module Checkoff
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# @return [Array(Hash<String, String>, Array<[Symbol, Array]>)] See https://developers.asana.com/docs/search-tasks-in-a-workspace
|
17
|
+
def handle_through_next
|
18
|
+
due_date_value = get_single_param('due_date.value').to_i
|
19
|
+
|
20
|
+
validate_unit_is_day!
|
21
|
+
|
22
|
+
# @sg-ignore
|
23
|
+
# @type [Date]
|
24
|
+
before = Date.today + due_date_value
|
25
|
+
# 'due_on.before' => '2023-01-01',
|
26
|
+
# 'due_on.after' => '2023-01-01',
|
27
|
+
# [{ 'due_on.before' => '2023-09-01' }, []]
|
28
|
+
[{ 'due_on.before' => before.to_s }, []]
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Array(Hash<String, String>, Array<[Symbol, Array]>)] See https://developers.asana.com/docs/search-tasks-in-a-workspace
|
32
|
+
def handle_between
|
33
|
+
due_date_after = get_single_param('due_date.after')
|
34
|
+
raise 'Teach me how to handle due_date_before' if date_url_params.key? 'due_date.before'
|
35
|
+
|
36
|
+
validate_unit_not_provided!
|
37
|
+
|
38
|
+
# Example value: 1702857600000
|
39
|
+
after = Time.at(due_date_after.to_i / 1000).to_date
|
40
|
+
[{ 'due_on.after' => after.to_s }, []]
|
41
|
+
end
|
42
|
+
|
43
|
+
# @param param_key [String]
|
44
|
+
# @return [String]
|
45
|
+
def get_single_param(param_key)
|
46
|
+
raise "Expected #{param_key} to have at least one value" unless date_url_params.key? param_key
|
47
|
+
|
48
|
+
value = date_url_params.fetch(param_key)
|
49
|
+
|
50
|
+
raise "Expected #{param_key} to have one value" if value.length != 1
|
51
|
+
|
52
|
+
value[0]
|
53
|
+
end
|
54
|
+
|
55
|
+
# @return [Array(Hash<String, String>, Array<[Symbol, Array]>)]
|
17
56
|
def convert
|
18
57
|
return [{}, []] if date_url_params.empty?
|
19
58
|
|
@@ -21,38 +60,29 @@ module Checkoff
|
|
21
60
|
# due_date.operator=through_next
|
22
61
|
# due_date.value=0
|
23
62
|
# due_date.unit=day
|
24
|
-
|
63
|
+
due_date_operator = get_single_param('due_date.operator')
|
25
64
|
|
26
|
-
|
65
|
+
return handle_through_next if due_date_operator == 'through_next'
|
27
66
|
|
28
|
-
|
29
|
-
# @type [Date]
|
30
|
-
before = Date.today + value
|
67
|
+
return handle_between if due_date_operator == 'between'
|
31
68
|
|
32
|
-
|
33
|
-
|
34
|
-
# 'due_on.before' => '2023-01-01',
|
35
|
-
# 'due_on.after' => '2023-01-01',
|
36
|
-
# [{ 'due_on.before' => '2023-09-01' }, []]
|
37
|
-
[{ 'due_on.before' => before.to_s }, []]
|
69
|
+
raise "Teach me how to handle date mode: #{due_date_operator.inspect}."
|
38
70
|
end
|
39
71
|
|
40
72
|
private
|
41
73
|
|
42
74
|
# @return [void]
|
43
|
-
def
|
44
|
-
|
75
|
+
def validate_unit_not_provided!
|
76
|
+
return unless date_url_params.key? 'due_date.unit'
|
45
77
|
|
46
|
-
raise
|
78
|
+
raise "Teach me how to handle other due_date.unit for these params: #{date_url_params.inspect}"
|
47
79
|
end
|
48
80
|
|
49
81
|
# @return [void]
|
50
|
-
def
|
51
|
-
|
52
|
-
|
53
|
-
return if due_date_operators == ['through_next']
|
82
|
+
def validate_unit_is_day!
|
83
|
+
unit = date_url_params.fetch('due_date.unit').fetch(0)
|
54
84
|
|
55
|
-
raise
|
85
|
+
raise 'Teach me how to handle other time units' unless unit == 'day'
|
56
86
|
end
|
57
87
|
|
58
88
|
# @return [Hash<String, Array<String>>]
|
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.52.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-
|
11
|
+
date: 2023-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|