checkoff 0.118.0 → 0.119.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: 963a3b8220497cddec9b0267e32b875105ac3694d74133e074dbbf8064c61b42
4
- data.tar.gz: c0ff06c0ec7e800f26bfabd93d47bcf820644df6c33ffc3b3061c490e625188f
3
+ metadata.gz: 1e003347c4270077540d8ab45c35a1901241c13c4be077301229242a85232230
4
+ data.tar.gz: 9ae02faf012077dd032f662a364b91877860671dbf750bd85828f6eda737ac50
5
5
  SHA512:
6
- metadata.gz: 3321268a181406c1d2323946022818166a8a26867f31ea52bc235bf8070445a566868f0f78ba4aeee4dba805cda726c6fde7cdf26835a16c147b4e13f7b77f64
7
- data.tar.gz: 02ee7fb7ec62e1bef53cf39490d57a119d643efbdd4d6bd3f15d20461cc68e5831a91ed2fdbcb80d9b34f7d54f9dc77f1f413cd3a9881f9965ccada8a8c8b7f3
6
+ metadata.gz: a1e6c012f8d278e652349a9f86953fd594057d6eb01289b661170781f50b62e145288f12dd353a6c622f92301465783e6c2abaa5f855e93808435f56cf40f778
7
+ data.tar.gz: 0e7e3d03fa75ae11e39ab0c311c3e0d9f24cb6a63adaa3e9ecec58321a2c3ffe2234b775188da36bdeb7b3ef179a3c86ac0ad5821e688bb45d4e3923977c1b19
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.118.0)
15
+ checkoff (0.119.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -20,7 +20,7 @@ module Checkoff
20
20
 
21
21
  out = nil
22
22
 
23
- %w[due_date start_date].each do |prefix|
23
+ %w[due_date start_date completion_date].each do |prefix|
24
24
  next unless date_url_params.key? "#{prefix}.operator"
25
25
  raise 'Teach me how to handle simultaneous date parameters' unless out.nil?
26
26
 
@@ -44,10 +44,13 @@ module Checkoff
44
44
  # due_date.unit=day
45
45
  operator = get_single_param("#{prefix}.operator")
46
46
 
47
- out = if operator == 'through_next'
47
+ out = case operator
48
+ when 'through_next'
48
49
  handle_through_next(prefix)
49
- elsif operator == 'between'
50
+ when 'between'
50
51
  handle_between(prefix)
52
+ when 'within_last'
53
+ handle_within_last(prefix)
51
54
  else
52
55
  raise "Teach me how to handle date mode: #{operator.inspect}."
53
56
  end
@@ -62,6 +65,7 @@ module Checkoff
62
65
  API_PREFIX = {
63
66
  'due_date' => 'due_on',
64
67
  'start_date' => 'start_on',
68
+ 'completion_date' => 'completed_on',
65
69
  }.freeze
66
70
 
67
71
  # @param prefix [String]
@@ -97,6 +101,20 @@ module Checkoff
97
101
  [{ "#{API_PREFIX.fetch(prefix)}.after" => after.to_s }, []]
98
102
  end
99
103
 
104
+ # @param prefix [String]
105
+ # @return [Array(Hash<String, String>, Array<[Symbol, Array]>)] See https://developers.asana.com/docs/search-tasks-in-a-workspace
106
+ def handle_within_last(prefix)
107
+ value = get_single_param("#{prefix}.value").to_i
108
+
109
+ validate_unit_is_day!(prefix)
110
+
111
+ # @sg-ignore
112
+ # @type [Date]
113
+ after = Date.today - value
114
+
115
+ [{ "#{API_PREFIX.fetch(prefix)}.after" => after.to_s }, []]
116
+ end
117
+
100
118
  # @param param_key [String]
101
119
  # @return [String]
102
120
  def get_single_param(param_key)
@@ -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.118.0'
6
+ VERSION = '0.119.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.118.0
4
+ version: 0.119.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz