checkoff 0.138.0 → 0.145.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: 725b9dacf6d77fcbf82da1f222e121a18c9ea9a689fa77f3013a8875b9229c23
4
- data.tar.gz: e42423592c5aa8e34f27d1e616e1b6ccf60b5f5575d46d1a1515df1a4ad72b7d
3
+ metadata.gz: 4c59aedc40fa2bbf1ad37259d1a19cc1e3677268e4d150690ea6f417f8deacc1
4
+ data.tar.gz: 19d9b9a77195016972c0b636549c8a808b2308885a100e264d73f1d4c65ec8b7
5
5
  SHA512:
6
- metadata.gz: e1e5ac1ec0223672681d984c3ec081811bb651f0b3cb48bb557f8924968ad82d37cc6cadca5c67d5a19f531d9c1dbe1a960cac73f98a643e1063287955123596
7
- data.tar.gz: d43024f89975c216f429b7c12f9ccde0d1bc87f13c2d48d25ff52d519bdb2b80515ea8aaa5750d0f43a526982e4404b77fe304e64c766de3d79c0f7e294d875c
6
+ metadata.gz: 005b9771d276e6f870e99210458c68a7002514b4304c79f5902aea8844a9a3bbead76119c8e109cdec1380883b92de517d7786914e5358154795c2c9375ee860
7
+ data.tar.gz: ec1d850413b2e0e9460adaa5860c3e093ef9ec99fc28819502c08d792639dbc351e7076f702552611db964390c4c247621ef08a8ca7efdd7a6e471c3d3a1b6c7
data/.rubocop.yml CHANGED
@@ -1,4 +1,8 @@
1
1
  ---
2
+ Gemspec/RequireMFA:
3
+ # We publish via CI/CD, so MFA is not possible.
4
+ Enabled: false
5
+
2
6
  Layout/LineLength:
3
7
  Max: 120
4
8
 
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.138.0)
15
+ checkoff (0.145.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
data/checkoff.gemspec CHANGED
@@ -31,6 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.add_runtime_dependency 'gli'
32
32
 
33
33
  spec.metadata = {
34
- 'rubygems_mfa_required' => 'true',
34
+ 'rubygems_mfa_required' => 'false',
35
35
  }
36
36
  end
@@ -51,6 +51,8 @@ module Checkoff
51
51
  handle_between(prefix)
52
52
  when 'within_last'
53
53
  handle_within_last(prefix)
54
+ when 'within_next'
55
+ handle_within_next(prefix)
54
56
  else
55
57
  raise "Teach me how to handle date mode: #{operator.inspect}."
56
58
  end
@@ -115,6 +117,20 @@ module Checkoff
115
117
  [{ "#{API_PREFIX.fetch(prefix)}.after" => after.to_s }, []]
116
118
  end
117
119
 
120
+ # @param prefix [String]
121
+ # @return [Array(Hash<String, String>, Array<[Symbol, Array]>)] See https://developers.asana.com/docs/search-tasks-in-a-workspace
122
+ def handle_within_next(prefix)
123
+ value = get_single_param("#{prefix}.value").to_i
124
+
125
+ validate_unit_is_day!(prefix)
126
+
127
+ # @sg-ignore
128
+ # @type [Date]
129
+ before = Date.today + value + 1
130
+
131
+ [{ "#{API_PREFIX.fetch(prefix)}.before" => before.to_s }, []]
132
+ end
133
+
118
134
  # @param param_key [String]
119
135
  # @return [String]
120
136
  def get_single_param(param_key)
@@ -65,7 +65,7 @@ module Checkoff
65
65
 
66
66
  # pulls an Asana API project class given a name
67
67
  # @param [String] workspace_name
68
- # @param [String] project_name
68
+ # @param [String,Symbol<:my_tasks>] project_name
69
69
  # @param [Array<String>] extra_fields
70
70
  #
71
71
  # @return [Asana::Resources::Project, nil]
@@ -83,7 +83,7 @@ module Checkoff
83
83
  cache_method :project, LONG_CACHE_TIME
84
84
 
85
85
  # @param workspace_name [String]
86
- # @param project_name [String]
86
+ # @param project_name [String,Symbol<:my_tasks>]
87
87
  # @param [Array<String>] extra_fields
88
88
  #
89
89
  # @return [Asana::Resources::Project]
@@ -147,13 +147,16 @@ module Checkoff
147
147
  # @param workspace_name [String]
148
148
  # @param project_name [String, Symbol]
149
149
  # @param section_name [String, nil]
150
+ # @param extra_section_fields [Array<String>]
150
151
  #
151
152
  # @sg-ignore
152
153
  # @return [Asana::Resources::Section]
153
- def section_or_raise(workspace_name, project_name, section_name)
154
- s = section(workspace_name, project_name, section_name)
154
+ def section_or_raise(workspace_name, project_name, section_name, extra_section_fields: [])
155
+ s = section(workspace_name, project_name, section_name,
156
+ extra_section_fields: extra_section_fields)
155
157
  if s.nil?
156
- valid_sections = sections_or_raise(workspace_name, project_name).map(&:name)
158
+ valid_sections = sections_or_raise(workspace_name, project_name,
159
+ extra_fields: extra_section_fields).map(&:name)
157
160
 
158
161
  raise "Could not find section #{section_name.inspect} under project #{project_name.inspect} " \
159
162
  "under workspace #{workspace_name.inspect}. Valid sections: #{valid_sections.inspect}"
@@ -279,9 +282,12 @@ module Checkoff
279
282
  # @param workspace_name [String]
280
283
  # @param project_name [String, Symbol]
281
284
  # @param section_name [String, nil]
285
+ # @param extra_section_fields [Array<String>]
286
+ #
282
287
  # @return [Asana::Resources::Section, nil]
283
- def section(workspace_name, project_name, section_name)
284
- sections = sections_or_raise(workspace_name, project_name)
288
+ def section(workspace_name, project_name, section_name, extra_section_fields: [])
289
+ sections = sections_or_raise(workspace_name, project_name,
290
+ extra_fields: extra_section_fields)
285
291
  sections.find { |section| section_key(section.name)&.chomp(':') == section_name&.chomp(':') }
286
292
  end
287
293
  end
@@ -13,6 +13,7 @@ require 'asana/resource_includes/collection'
13
13
  require 'asana/resource_includes/response_helper'
14
14
 
15
15
  require 'checkoff/internal/search_url'
16
+ require 'checkoff/internal/logging'
16
17
 
17
18
  # https://developers.asana.com/reference/searchtasksforworkspace
18
19
  module Checkoff
@@ -25,6 +26,7 @@ module Checkoff
25
26
  LONG_CACHE_TIME = MINUTE * 15
26
27
  SHORT_CACHE_TIME = MINUTE
27
28
 
29
+ include Logging
28
30
  include Asana::Resources::ResponseHelper
29
31
 
30
32
  # @!parse
@@ -70,6 +72,7 @@ module Checkoff
70
72
  workspace = workspaces.workspace_or_raise(workspace_name)
71
73
  # @sg-ignore
72
74
  api_params, task_selector = @search_url_parser.convert_params(url)
75
+ debug { "Task search params: api_params=#{api_params}, task_selector=#{task_selector}" }
73
76
  raw_task_search(api_params, workspace_gid: workspace.gid, task_selector: task_selector,
74
77
  extra_fields: extra_fields)
75
78
  end
@@ -95,9 +98,23 @@ module Checkoff
95
98
  options: options)),
96
99
  type: Asana::Resources::Task,
97
100
  client: client)
101
+
102
+ if tasks.length == 100
103
+ raise 'Too many results returned. ' \
104
+ 'Please narrow your search in ways expressible through task search API: ' \
105
+ 'https://developers.asana.com/reference/searchtasksforworkspace'
106
+ end
107
+
108
+ debug { "#{tasks.length} raw tasks returned" }
109
+
98
110
  tasks.select { |task| task_selectors.filter_via_task_selector(task, task_selector) }
99
111
  end
100
112
 
113
+ # @return [Hash]
114
+ def as_cache_key
115
+ {}
116
+ end
117
+
101
118
  private
102
119
 
103
120
  # @param [Array<String>] extra_fields
@@ -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.138.0'
6
+ VERSION = '0.145.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.138.0
4
+ version: 0.145.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-26 00:00:00.000000000 Z
11
+ date: 2023-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description:
83
+ description:
84
84
  email:
85
85
  - vince@broz.cc
86
86
  executables:
@@ -214,8 +214,8 @@ homepage: https://github.com/apiology/checkoff
214
214
  licenses:
215
215
  - MIT license
216
216
  metadata:
217
- rubygems_mfa_required: 'true'
218
- post_install_message:
217
+ rubygems_mfa_required: 'false'
218
+ post_install_message:
219
219
  rdoc_options: []
220
220
  require_paths:
221
221
  - lib
@@ -231,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
231
  version: '0'
232
232
  requirements: []
233
233
  rubygems_version: 3.2.33
234
- signing_key:
234
+ signing_key:
235
235
  specification_version: 4
236
236
  summary: Command-line and gem client for Asana (unofficial)
237
237
  test_files: []