checkoff 0.233.0 → 0.238.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: 9218ef611b8c8112e754246e1eadd4bbb5c92397cf98ca8e834f8391a1ce8e4c
4
- data.tar.gz: '082d8bdba278d67312003fca7ac6a3fef158b43f3b14a4762b40dae4c73867d6'
3
+ metadata.gz: 2851f48d7b933afc805cc3ac97ec772b3174319428a0187262af265a96e2f548
4
+ data.tar.gz: 811c5584d44877c8803322412f3379a362437bfbab2c9d86af5f6a608ec284c8
5
5
  SHA512:
6
- metadata.gz: 8e06342012be266e5e1bae0002ea37bb980c7a37334640ddb0a32067dab2de2f23e35653c1d95eb3d967c8ec328e2bf6be0b96ac681f9c013409bd4d91b979ae
7
- data.tar.gz: 99565139c87dd3ef0dbb4a3c577e3bbb367429505861115d0778c25b36ccf0e93efc73da11c8487d7aae9f31d053e24d6806bac93eecce149bc719abd1389dfa
6
+ metadata.gz: db852001366912ed62a0c107e5232e8be811afeee74b943a80464cd6655c7fff38e6556de8d3fb844ad31df9ec875dbc474f04daf58674b7f78310f648466a62
7
+ data.tar.gz: 99f81ced44101aa4ddc42abdce3bd971b142bb77d2e3828a68e41de844854811b51faa7ae03d37969648d6630ff3c1e03d92650915d6b0f5ad65ec3d8138a985
data/lib/checkoff/cli.rb CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  # frozen_string_literal: true
5
5
 
6
+ require 'json'
6
7
  require 'ostruct'
7
8
  require 'gli'
8
9
  require 'cache_method'
@@ -208,13 +209,16 @@ module Checkoff
208
209
 
209
210
  # @param workspace [String, Symbol]
210
211
  # @param project [String, Symbol]
212
+ #
211
213
  # @return [String]
214
+ # @sg-ignore
212
215
  def run_on_project(workspace, project)
213
216
  tasks_by_section =
214
217
  sections.tasks_by_section(workspace, project)
215
218
  tasks_by_section.update(tasks_by_section) do |_key, tasks|
216
219
  tasks_to_hash(tasks)
217
220
  end
221
+ # @sg-ignore
218
222
  tasks_by_section.to_json
219
223
  end
220
224
 
@@ -222,9 +226,11 @@ module Checkoff
222
226
  # @param project [String, Symbol]
223
227
  # @param section [String, Symbol, nil]
224
228
  # @return [String]
229
+ # @sg-ignore
225
230
  def run_on_section(workspace, project, section)
226
231
  section = nil if section == ''
227
232
  tasks = sections.tasks(workspace, project, section) || []
233
+ # @sg-ignore
228
234
  tasks_to_hash(tasks).to_json
229
235
  end
230
236
 
@@ -233,9 +239,11 @@ module Checkoff
233
239
  # @param section [String, Symbol, nil]
234
240
  # @param task_name [String]
235
241
  # @return [String]
242
+ # @sg-ignore
236
243
  def run_on_task(workspace, project, section, task_name)
237
244
  section = nil if section == ''
238
245
  task = tasks.task(workspace, project, task_name, section_name: section)
246
+ # @sg-ignore
239
247
  task_to_hash(task).to_json
240
248
  end
241
249
 
@@ -145,6 +145,15 @@ module Checkoff
145
145
  end
146
146
  end
147
147
 
148
+ # Handle 'all_tags.ids' search url param
149
+ class AllTagsIds < SimpleParam
150
+ # @return [Array<String>]
151
+ def convert
152
+ tag_ids = single_value.split('~')
153
+ ['tags.all', tag_ids.join(',')]
154
+ end
155
+ end
156
+
148
157
  # Handle 'sort' search url param
149
158
  class Sort < SimpleParam
150
159
  # @return [Array<String>]
@@ -173,6 +182,18 @@ module Checkoff
173
182
  end
174
183
  end
175
184
 
185
+ # Handle 'approval' search url param
186
+ class Approval < SimpleParam
187
+ # @return [Array<String>]
188
+ def convert
189
+ return %w[resource_subtype approval] if single_value == 'is_approval'
190
+
191
+ return %w[resource_subtype default_task] if single_value == 'is_not_approval'
192
+
193
+ raise "Teach me how to handle #{key} = #{values}"
194
+ end
195
+ end
196
+
176
197
  # Handle 'searched_type' search url param
177
198
  class SearchedType < SimpleParam
178
199
  # @return [Array<String>]
@@ -182,6 +203,18 @@ module Checkoff
182
203
  raise "Teach me how to handle #{key} = #{values}"
183
204
  end
184
205
  end
206
+
207
+ # Handle 'locatedIn' search url param
208
+ class LocatedIn < SimpleParam
209
+ # @return [Array<String>]
210
+ def convert
211
+ return [] if single_value == 'anywhere'
212
+
213
+ return [] if single_value == 'inAnyOfTheseProjects'
214
+
215
+ raise "Teach me how to handle #{key} = #{values}"
216
+ end
217
+ end
185
218
  end
186
219
 
187
220
  # Convert simple parameters - ones where the param name itself
@@ -220,10 +253,13 @@ module Checkoff
220
253
  'completion' => SimpleParam::Completion,
221
254
  'not_tags.ids' => SimpleParam::NotTagsIds,
222
255
  'any_tags.ids' => SimpleParam::AnyTagsIds,
256
+ 'all_tags.ids' => SimpleParam::AllTagsIds,
223
257
  'subtask' => SimpleParam::Subtask,
224
258
  'sort' => SimpleParam::Sort,
225
259
  'milestone' => SimpleParam::Milestone,
260
+ 'approval' => SimpleParam::Approval,
226
261
  'searched_type' => SimpleParam::SearchedType,
262
+ 'locatedIn' => SimpleParam::LocatedIn,
227
263
  }.freeze
228
264
  private_constant :ARGS
229
265
 
@@ -17,6 +17,7 @@ module Checkoff
17
17
  # Pull portfolios from Asana
18
18
  class Portfolios
19
19
  extend T::Sig
20
+
20
21
  # @!parse
21
22
  # extend CacheMethod::ClassMethods
22
23
 
@@ -57,7 +58,6 @@ module Checkoff
57
58
  # @param workspace_name [String]
58
59
  # @param portfolio_name [String]
59
60
  #
60
- # @sg-ignore
61
61
  # @return [Asana::Resources::Portfolio,nil]
62
62
  def portfolio(workspace_name, portfolio_name)
63
63
  workspace = workspaces.workspace_or_raise(workspace_name)
@@ -122,10 +122,8 @@ module Checkoff
122
122
  class << self
123
123
  # @return [void]
124
124
  def run
125
- # @sg-ignore
126
125
  # @type [String]
127
126
  workspace_name = ARGV[0] || raise('Please pass workspace name as first argument')
128
- # @sg-ignore
129
127
  # @type [String]
130
128
  portfolio_name = ARGV[1] || raise('Please pass portfolio name as second argument')
131
129
  portfolios = Checkoff::Portfolios.new
@@ -4,5 +4,5 @@
4
4
  # Command-line and gem client for Asana (unofficial)
5
5
  module Checkoff
6
6
  # Version of library
7
- VERSION = '0.233.0'
7
+ VERSION = '0.238.0'
8
8
  end