checkoff 0.34.1 → 0.35.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: b31221009bc4a8eff20ae5ee62909ffd5391cdb7621ab30ca59ef196391588ad
4
- data.tar.gz: 878750bf24c6587dce1380fcce8fb041f4b5d65db99d3e98cb836e9d8df7273c
3
+ metadata.gz: e64d7037d27c3786a9e8d4ed3b188d3826b53de95812fd0901f602b666d4c2f3
4
+ data.tar.gz: 568d16525e54ffa219441a0adebcc0a41b73266802166de3c80cfc706e0e9276
5
5
  SHA512:
6
- metadata.gz: '0645801524c2e2e787277bc5b86bceda7b19899e870b6df54878d1ece0fee340ce72ca733be852c4035aca6333355ba9c0854cd6bdad6df634e7f537bb396b23'
7
- data.tar.gz: 1d164eb6a946a0e8fe3be22461b70fa9d9720a69820c31867d78fc8f0d054758f6212d3f3de6f834480b9dba7db1179f367c22bac9fbb5585c7b8acfea9564e3
6
+ metadata.gz: e7aaac28d4faed26fca0d0a47dac956354ae9ae17eb23bf562f75a6552dbc0a9fb171fb9d71e5d07db272273f3fabd44429be9ff552d47c9352d9f805c78a1d7
7
+ data.tar.gz: 1989f2a691c02a69e6d94615de0ca636472e1636e10580d702b47b65e870f33efc85e2a36a984f8dee14218106c6a20e6587d39705f689c3c972fc069953a6e9
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.34.1)
15
+ checkoff (0.35.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -31,6 +31,8 @@ GEM
31
31
  public_suffix (>= 2.0.2, < 6.0)
32
32
  ansi (1.5.0)
33
33
  ast (2.4.2)
34
+ backport (1.2.0)
35
+ benchmark (0.2.1)
34
36
  builder (3.2.4)
35
37
  bump (0.10.0)
36
38
  cache (0.4.1)
@@ -46,6 +48,7 @@ GEM
46
48
  dalli (3.2.4)
47
49
  diff-lcs (1.5.0)
48
50
  docile (1.4.0)
51
+ e2mmap (0.1.0)
49
52
  fakeweb (1.3.0)
50
53
  faraday (1.5.1)
51
54
  faraday-em_http (~> 1.0)
@@ -71,11 +74,12 @@ GEM
71
74
  multi_json
72
75
  gli (2.21.0)
73
76
  hashdiff (1.0.1)
74
- i18n (1.12.0)
77
+ i18n (1.13.0)
75
78
  concurrent-ruby (~> 1.0)
76
79
  imagen (0.1.8)
77
80
  parser (>= 2.5, != 2.5.1.1)
78
81
  iniparse (1.5.0)
82
+ jaro_winkler (1.5.4)
79
83
  json (2.6.2)
80
84
  jwt (2.2.3)
81
85
  kramdown (2.4.0)
@@ -89,6 +93,7 @@ GEM
89
93
  mixlib-config (>= 2.2.1, < 4)
90
94
  mixlib-shellout
91
95
  method_source (1.0.0)
96
+ mini_portile2 (2.8.2)
92
97
  minitest (5.18.0)
93
98
  minitest-profile (0.0.2)
94
99
  minitest-reporters (1.5.0)
@@ -105,6 +110,13 @@ GEM
105
110
  multi_json (1.15.0)
106
111
  multi_xml (0.6.0)
107
112
  multipart-post (2.1.1)
113
+ nokogiri (1.14.3)
114
+ mini_portile2 (~> 2.8.0)
115
+ racc (~> 1.4)
116
+ nokogiri (1.14.3-x86_64-darwin)
117
+ racc (~> 1.4)
118
+ nokogiri (1.14.3-x86_64-linux)
119
+ racc (~> 1.4)
108
120
  oauth2 (1.4.11)
109
121
  faraday (>= 0.17.3, < 3.0)
110
122
  jwt (>= 1.0, < 3.0)
@@ -122,10 +134,13 @@ GEM
122
134
  coderay (~> 1.1)
123
135
  method_source (~> 1.0)
124
136
  public_suffix (5.0.0)
137
+ racc (1.6.2)
125
138
  rack (3.0.6.1)
126
139
  rainbow (3.1.1)
127
140
  rake (13.0.3)
128
141
  regexp_parser (2.6.0)
142
+ reverse_markdown (2.1.1)
143
+ nokogiri
129
144
  rexml (3.2.5)
130
145
  rspec (3.11.0)
131
146
  rspec-core (~> 3.11.0)
@@ -166,6 +181,23 @@ GEM
166
181
  simplecov-html (0.12.3)
167
182
  simplecov-lcov (0.8.0)
168
183
  simplecov_json_formatter (0.1.3)
184
+ solargraph (0.48.0)
185
+ backport (~> 1.2)
186
+ benchmark
187
+ bundler (>= 1.17.2)
188
+ diff-lcs (~> 1.4)
189
+ e2mmap
190
+ jaro_winkler (~> 1.5)
191
+ kramdown (~> 2.3)
192
+ kramdown-parser-gfm (~> 1.1)
193
+ parser (~> 3.0)
194
+ reverse_markdown (>= 1.0.5, < 3)
195
+ rubocop (>= 0.52)
196
+ thor (~> 1.0)
197
+ tilt (~> 2.0)
198
+ yard (~> 0.9, >= 0.9.24)
199
+ thor (1.2.1)
200
+ tilt (2.1.0)
169
201
  tomlrb (2.0.3)
170
202
  tzinfo (2.0.6)
171
203
  concurrent-ruby (~> 1.0)
@@ -178,6 +210,7 @@ GEM
178
210
  addressable (>= 2.8.0)
179
211
  crack (>= 0.3.2)
180
212
  hashdiff (>= 0.4.0, < 2.0.0)
213
+ yard (0.9.34)
181
214
 
182
215
  PLATFORMS
183
216
  ruby
@@ -206,6 +239,7 @@ DEPENDENCIES
206
239
  rubocop-rake
207
240
  simplecov (>= 0.18.0)
208
241
  simplecov-lcov
242
+ solargraph
209
243
  undercover
210
244
  webmock
211
245
 
data/checkoff.gemspec CHANGED
@@ -52,6 +52,7 @@ Gem::Specification.new do |spec|
52
52
  # ensure version with branch coverage
53
53
  spec.add_development_dependency 'simplecov', ['>=0.18.0']
54
54
  spec.add_development_dependency 'simplecov-lcov'
55
+ spec.add_development_dependency 'solargraph'
55
56
  spec.add_development_dependency 'undercover'
56
57
  spec.add_development_dependency 'webmock'
57
58
  spec.metadata = {
data/lib/checkoff/tags.rb CHANGED
@@ -21,13 +21,30 @@ module Checkoff
21
21
  SHORT_CACHE_TIME = MINUTE
22
22
 
23
23
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
24
- workspaces: Checkoff::Workspaces.new(config: config),
25
- clients: Checkoff::Clients.new(config: config),
26
- client: clients.client)
24
+ clients: Checkoff::Clients.new(config: config).client,
25
+ client: clients.client,
26
+ projects: Checkoff::Projects.new(config: config, client: client),
27
+ workspaces: Checkoff::Workspaces.new(config: config, client: client))
27
28
  @workspaces = workspaces
29
+ @projects = projects
28
30
  @client = client
29
31
  end
30
32
 
33
+ def tasks(workspace_name, tag_name,
34
+ only_uncompleted: true,
35
+ extra_fields: [])
36
+ tag = tag_or_raise(workspace_name, tag_name)
37
+
38
+ options = build_task_options(projects.task_options, extra_fields, only_uncompleted)
39
+
40
+ params = build_params(options)
41
+
42
+ Asana::Collection.new(parse(client.get("/tags/#{tag.gid}/tasks",
43
+ params: params, options: options[:options])),
44
+ type: Asana::Resources::Task,
45
+ client: client)
46
+ end
47
+
31
48
  def tag_or_raise(workspace_name, tag_name)
32
49
  tag = tag(workspace_name, tag_name)
33
50
  raise "Could not find tag #{tag_name} under workspace #{workspace_name}." if tag.nil?
@@ -45,7 +62,26 @@ module Checkoff
45
62
 
46
63
  private
47
64
 
48
- attr_reader :workspaces, :client
65
+ attr_reader :workspaces, :projects, :client
66
+
67
+ def build_task_options(task_options, extra_fields, only_uncompleted)
68
+ task_options[:options][:fields] += extra_fields
69
+ task_options[:completed_since] = '9999-12-01' if only_uncompleted
70
+ task_options
71
+ end
72
+
73
+ def build_params(options)
74
+ { limit: options[:per_page], completed_since: options[:completed_since] }.reject do |_, v|
75
+ v.nil? || Array(v).empty?
76
+ end
77
+ end
78
+
79
+ # https://github.com/Asana/ruby-asana/blob/master/lib/asana/resource_includes/response_helper.rb#L7
80
+ def parse(response)
81
+ data = response.body.fetch('data')
82
+ extra = response.body.except('data')
83
+ [data, extra]
84
+ end
49
85
 
50
86
  # bundle exec ./tags.rb
51
87
  # :nocov:
@@ -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.34.1'
6
+ VERSION = '0.35.0'
7
7
  end
data/lib/checkoff.rb CHANGED
@@ -9,3 +9,4 @@ require 'checkoff/tasks'
9
9
  require 'checkoff/custom_fields'
10
10
  require 'checkoff/tags'
11
11
  require 'checkoff/task_selectors'
12
+ require 'checkoff/task_searches'
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.34.1
4
+ version: 0.35.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-04-22 00:00:00.000000000 Z
11
+ date: 2023-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -316,6 +316,20 @@ dependencies:
316
316
  - - ">="
317
317
  - !ruby/object:Gem::Version
318
318
  version: '0'
319
+ - !ruby/object:Gem::Dependency
320
+ name: solargraph
321
+ requirement: !ruby/object:Gem::Requirement
322
+ requirements:
323
+ - - ">="
324
+ - !ruby/object:Gem::Version
325
+ version: '0'
326
+ type: :development
327
+ prerelease: false
328
+ version_requirements: !ruby/object:Gem::Requirement
329
+ requirements:
330
+ - - ">="
331
+ - !ruby/object:Gem::Version
332
+ version: '0'
319
333
  - !ruby/object:Gem::Dependency
320
334
  name: undercover
321
335
  requirement: !ruby/object:Gem::Requirement