checkoff 0.44.2 → 0.44.4
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 +4 -4
- data/Gemfile.lock +1 -1
- data/config/definitions.rb +75 -3
- data/lib/checkoff/projects.rb +13 -15
- data/lib/checkoff/sections.rb +9 -8
- data/lib/checkoff/subtasks.rb +2 -2
- data/lib/checkoff/tags.rb +1 -1
- data/lib/checkoff/task_searches.rb +1 -1
- data/lib/checkoff/tasks.rb +2 -2
- data/lib/checkoff/version.rb +1 -1
- data/lib/checkoff/workspaces.rb +1 -0
- 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: 37638fcbc55eff5ef89c7335ba3841e39376d9055c7995ecbf5e17446f3f641e
|
4
|
+
data.tar.gz: 97e451ca7abae2f8cc5a6f70af6fa9779131c69361452b87ace3c631e0a6d8aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fbdeb108ae04b165077972937931f3889c1e4b72c647cedb45ac176de303d80ce47bb08fe4d0b50b2433fc522db9ebec5ca703b5e27cc7e1f52b38721af1e45
|
7
|
+
data.tar.gz: fa3f9c267cb2d750ef04382023ab691114239d6b359379ac1951ecfc31e9cb9750fff03211bb53a82e3f2c8ab6a5f160a23e7c92e5fc6c3c02426e02a8fcd288
|
data/Gemfile.lock
CHANGED
data/config/definitions.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
|
+
# rubocop:disable Layout/LineLength
|
3
4
|
# @!parse
|
4
5
|
# class Time
|
5
6
|
# class << self
|
@@ -16,7 +17,12 @@
|
|
16
17
|
# def workspaces; end
|
17
18
|
# # @return [Asana::ProxiedResourceClasses::Section]
|
18
19
|
# def sections; end
|
20
|
+
# # @return [Asana::ProxiedResourceClasses::Project]
|
21
|
+
# def projects; end
|
22
|
+
# # @return [Asana::ProxiedResourceClasses::UserTaskList]
|
23
|
+
# def user_task_lists; end
|
19
24
|
# end
|
25
|
+
# class Collection < Asana::Resources::Collection; end
|
20
26
|
# module Resources
|
21
27
|
# class Task
|
22
28
|
# # @return [String, nil]
|
@@ -45,9 +51,45 @@
|
|
45
51
|
# # @param options [Hash] the request I/O options.
|
46
52
|
# # @return [Asana::Resources::Task]
|
47
53
|
# def find_by_id(id, options: {}); end
|
54
|
+
# # Returns the compact task records for some filtered set of tasks. Use one
|
55
|
+
# # or more of the parameters provided to filter the tasks returned. You must
|
56
|
+
# # specify a `project`, `section`, `tag`, or `user_task_list` if you do not
|
57
|
+
# # specify `assignee` and `workspace`.
|
58
|
+
# #
|
59
|
+
# # @param assignee [String] The assignee to filter tasks on.
|
60
|
+
# # @param workspace [String] The workspace or organization to filter tasks on.
|
61
|
+
# # @param project [String] The project to filter tasks on.
|
62
|
+
# # @param section [Gid] The section to filter tasks on.
|
63
|
+
# # @param tag [Gid] The tag to filter tasks on.
|
64
|
+
# # @param user_task_list [Gid] The user task list to filter tasks on.
|
65
|
+
# # @param completed_since [String] Only return tasks that are either incomplete or that have been
|
66
|
+
# # completed since this time.
|
67
|
+
# #
|
68
|
+
# # @param modified_since [String] Only return tasks that have been modified since the given time.
|
69
|
+
# #
|
70
|
+
# # @param per_page [Integer] the number of records to fetch per page.
|
71
|
+
# # @param options [Hash] the request I/O options.
|
72
|
+
# # Notes:
|
73
|
+
# #
|
74
|
+
# # If you specify `assignee`, you must also specify the `workspace` to filter on.
|
75
|
+
# #
|
76
|
+
# # If you specify `workspace`, you must also specify the `assignee` to filter on.
|
77
|
+
# #
|
78
|
+
# # Currently, this is only supported in board views.
|
79
|
+
# #
|
80
|
+
# # A task is considered "modified" if any of its properties change,
|
81
|
+
# # or associations between it and other objects are modified (e.g.
|
82
|
+
# # a task being added to a project). A task is not considered modified
|
83
|
+
# # just because another object it is associated with (e.g. a subtask)
|
84
|
+
# # is modified. Actions that count as modifying the task include
|
85
|
+
# # assigning, renaming, completing, and adding stories.
|
86
|
+
# # @return [Asana::Collection<Asana::Resources::Task>]
|
87
|
+
# def find_all(assignee: nil, workspace: nil, project: nil, section: nil,
|
88
|
+
# tag: nil, user_task_list: nil, completed_since: nil,
|
89
|
+
# modified_since: nil, per_page: 20, options: {}); end
|
48
90
|
# # @param section [Asana::Resources::section]
|
49
91
|
# # @param options [Hash] the request I/O options.
|
50
|
-
# # @return [
|
92
|
+
# # @return [Enumerable<Asana::Resources::Task>]
|
51
93
|
# def get_tasks(assignee: nil,
|
52
94
|
# project: nil,
|
53
95
|
# section: nil,
|
@@ -58,13 +100,43 @@
|
|
58
100
|
# options: {}); end
|
59
101
|
# end
|
60
102
|
# class Workspace
|
61
|
-
# # @return [
|
103
|
+
# # @return [Enumerable<Asana::Resources::Workspace>]
|
62
104
|
# def find_all; end
|
63
105
|
# end
|
64
106
|
# class Section
|
65
107
|
# # @param project_gid [String]
|
66
|
-
# # @return [
|
108
|
+
# # @return [Enumerable<Asana::Resources::Section>]
|
67
109
|
# def get_sections_for_project(client, project_gid:, options: {}); end
|
68
110
|
# end
|
111
|
+
# class Project
|
112
|
+
# # Returns the compact project records for all projects in the workspace.
|
113
|
+
# #
|
114
|
+
# # @param workspace [Strin] The workspace or organization to find projects in.
|
115
|
+
# # @param is_template [Boolean] **Note: This parameter can only be included if a team is also defined, or the workspace is not an organization**
|
116
|
+
# # Filters results to include only template projects.
|
117
|
+
# #
|
118
|
+
# # @param archived [Boolean] Only return projects whose `archived` field takes on the value of
|
119
|
+
# # this parameter.
|
120
|
+
# #
|
121
|
+
# # @param per_page [Integer] the number of records to fetch per page.
|
122
|
+
# # @param options [Hash] the request I/O options.
|
123
|
+
# # @return [Asana::Collection<Asana::Resources::Project>]
|
124
|
+
# def find_by_workspace(client, workspace: required("workspace"), is_template: nil, archived: nil, per_page: 20, options: {}); end
|
125
|
+
# # Returns the complete project record for a single project.
|
126
|
+
# #
|
127
|
+
# # @param id [String] The project to get.
|
128
|
+
# # @param options [Hash] the request I/O options.
|
129
|
+
# # @return [Asana::Resources::Project]
|
130
|
+
# def find_by_id(id, options: {}); end
|
131
|
+
# end
|
132
|
+
# class UserTaskList
|
133
|
+
# # @param user_gid [String] (required) A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
|
134
|
+
# # @param workspace [String] (required) The workspace in which to get the user task list.
|
135
|
+
# # @param options [Hash] the request I/O options
|
136
|
+
# # @return [Asana::Resources::UserTaskList]
|
137
|
+
# def get_user_task_list_for_user(client, user_gid:,
|
138
|
+
# workspace: nil, options: {}); end
|
139
|
+
# end
|
69
140
|
# end
|
70
141
|
# end
|
142
|
+
# rubocop:enable Layout/LineLength
|
data/lib/checkoff/projects.rb
CHANGED
@@ -17,19 +17,18 @@ module Checkoff
|
|
17
17
|
# Work with projects in Asana
|
18
18
|
class Projects
|
19
19
|
MINUTE = 60
|
20
|
-
# @sg-ignore
|
21
20
|
HOUR = MINUTE * 60
|
22
21
|
DAY = 24 * HOUR
|
23
|
-
# @sg-ignore
|
24
22
|
REALLY_LONG_CACHE_TIME = HOUR * 1
|
25
|
-
# @sg-ignore
|
26
23
|
LONG_CACHE_TIME = MINUTE * 15
|
27
24
|
SHORT_CACHE_TIME = MINUTE
|
28
25
|
|
29
26
|
# @!parse
|
30
27
|
# extend CacheMethod::ClassMethods
|
31
28
|
|
29
|
+
# @param config [Hash<Symbol, Object>]
|
32
30
|
# @param client [Asana::Client]
|
31
|
+
# @param workspaces [Checkoff::Workspaces]
|
33
32
|
def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
|
34
33
|
client: Checkoff::Clients.new(config: config).client,
|
35
34
|
workspaces: Checkoff::Workspaces.new(config: config,
|
@@ -59,8 +58,9 @@ module Checkoff
|
|
59
58
|
if project_name.is_a?(Symbol) && project_name.to_s.start_with?('my_tasks')
|
60
59
|
my_tasks(workspace_name)
|
61
60
|
else
|
62
|
-
|
63
|
-
|
61
|
+
# @type [Asana::Collection<Asana::Resources::Project>]
|
62
|
+
ps = projects_by_workspace_name(workspace_name)
|
63
|
+
ps.find do |project|
|
64
64
|
project.name == project_name
|
65
65
|
end
|
66
66
|
end
|
@@ -79,18 +79,17 @@ module Checkoff
|
|
79
79
|
cache_method :project_or_raise, LONG_CACHE_TIME
|
80
80
|
|
81
81
|
# find uncompleted tasks in a list
|
82
|
-
# @param [
|
83
|
-
# @return [
|
82
|
+
# @param [Enumerable<Asana::Resources::Task>] tasks
|
83
|
+
# @return [Enumerable<Asana::Resources::Task>]
|
84
84
|
def active_tasks(tasks)
|
85
85
|
tasks.select { |task| task.completed_at.nil? }
|
86
86
|
end
|
87
87
|
|
88
88
|
# pull task objects from a named project
|
89
|
-
# @sg-ignore
|
90
89
|
# @param [Asana::Resources::Project] project
|
91
90
|
# @param [Boolean] only_uncompleted
|
92
91
|
# @param [Array<String>] extra_fields
|
93
|
-
# @return [
|
92
|
+
# @return [Enumerable<Asana::Resources::Task>]
|
94
93
|
def tasks_from_project(project, only_uncompleted: true, extra_fields: [])
|
95
94
|
options = task_options
|
96
95
|
options[:completed_since] = '9999-12-01' if only_uncompleted
|
@@ -102,31 +101,30 @@ module Checkoff
|
|
102
101
|
|
103
102
|
private
|
104
103
|
|
104
|
+
# @return [Asana::Client]
|
105
105
|
attr_reader :client
|
106
106
|
|
107
|
-
# @
|
107
|
+
# @return [Asana::ProxiedResourceClasses::Project]
|
108
108
|
def projects
|
109
109
|
client.projects
|
110
110
|
end
|
111
111
|
cache_method :projects, LONG_CACHE_TIME
|
112
112
|
|
113
|
-
# @sg-ignore
|
114
113
|
# @param [String] workspace_name
|
115
|
-
# @return [
|
114
|
+
# @return [Asana::Collection<Asana::Resources::Project>]
|
116
115
|
def projects_by_workspace_name(workspace_name)
|
117
116
|
workspace = @workspaces.workspace_or_raise(workspace_name)
|
118
117
|
raise "Could not find workspace named #{workspace_name}" unless workspace
|
119
118
|
|
120
|
-
projects.find_by_workspace(workspace: workspace.gid)
|
119
|
+
projects.find_by_workspace(workspace: workspace.gid, per_page: 100)
|
121
120
|
end
|
121
|
+
cache_method :projects_by_workspace_name, LONG_CACHE_TIME
|
122
122
|
|
123
|
-
# @sg-ignore
|
124
123
|
# @param [String] workspace_name
|
125
124
|
# @return [Asana::Resources::Project]
|
126
125
|
def my_tasks(workspace_name)
|
127
126
|
workspace = @workspaces.workspace_or_raise(workspace_name)
|
128
127
|
# @sg-ignore
|
129
|
-
# @type [Asana::Resources::UserTaskList]
|
130
128
|
result = client.user_task_lists.get_user_task_list_for_user(user_gid: 'me',
|
131
129
|
workspace: workspace.gid)
|
132
130
|
gid = result.gid
|
data/lib/checkoff/sections.rb
CHANGED
@@ -53,19 +53,20 @@ module Checkoff
|
|
53
53
|
# @param workspace_name [String]
|
54
54
|
# @param project_name [String, Symbol]
|
55
55
|
#
|
56
|
-
# @return [
|
56
|
+
# @return [Enumerable<Asana::Resources::Section>]
|
57
57
|
def sections_or_raise(workspace_name, project_name)
|
58
58
|
project = project_or_raise(workspace_name, project_name)
|
59
59
|
# @sg-ignore
|
60
60
|
client.sections.get_sections_for_project(project_gid: project.gid)
|
61
61
|
end
|
62
|
+
cache_method :sections_or_raise, SHORT_CACHE_TIME
|
62
63
|
|
63
64
|
# Given a workspace name and project name, then provide a Hash of
|
64
65
|
# tasks with section name -> task list of the uncompleted tasks
|
65
66
|
# @param workspace_name [String]
|
66
67
|
# @param project_name [String, Symbol]
|
67
68
|
# @param extra_fields [Array<String>]
|
68
|
-
# @return [Hash{[String, nil] =>
|
69
|
+
# @return [Hash{[String, nil] => Enumerable<Asana::Resources::Task>}]
|
69
70
|
def tasks_by_section(workspace_name, project_name, extra_fields: [])
|
70
71
|
raise ArgumentError, 'Provided nil workspace name' if workspace_name.nil?
|
71
72
|
raise ArgumentError, 'Provided nil project name' if project_name.nil?
|
@@ -88,7 +89,7 @@ module Checkoff
|
|
88
89
|
# @param only_uncompleted [Boolean]
|
89
90
|
# @param extra_fields [Array<String>]
|
90
91
|
#
|
91
|
-
# @return [
|
92
|
+
# @return [Enumerable<Asana::Resources::Task>]
|
92
93
|
def tasks(workspace_name, project_name, section_name,
|
93
94
|
only_uncompleted: true,
|
94
95
|
extra_fields: [])
|
@@ -140,7 +141,7 @@ module Checkoff
|
|
140
141
|
# tasks with section name -> task list of the uncompleted tasks
|
141
142
|
# @param project [Asana::Resources::Project]
|
142
143
|
# @param extra_fields [Array<String>]
|
143
|
-
# @return [Hash<[String,nil],
|
144
|
+
# @return [Hash<[String,nil], Enumerable<Asana::Resources::Task>>]
|
144
145
|
def tasks_by_section_for_project(project, extra_fields: [])
|
145
146
|
raw_tasks = projects.tasks_from_project(project, extra_fields: extra_fields)
|
146
147
|
active_tasks = projects.active_tasks(raw_tasks)
|
@@ -150,16 +151,16 @@ module Checkoff
|
|
150
151
|
# @param name [String]
|
151
152
|
# @return [String, nil]
|
152
153
|
def section_key(name)
|
153
|
-
inbox_section_names = ['(no section)', 'Untitled section', 'Inbox']
|
154
|
+
inbox_section_names = ['(no section)', 'Untitled section', 'Inbox', 'Recently assigned']
|
154
155
|
return nil if inbox_section_names.include?(name)
|
155
156
|
|
156
157
|
name
|
157
158
|
end
|
158
159
|
|
159
160
|
# Given a list of tasks, pull a Hash of tasks with section name -> task list
|
160
|
-
# @param tasks [
|
161
|
+
# @param tasks [Enumerable<Asana::Resources::Task>]
|
161
162
|
# @param project_gid [String]
|
162
|
-
# @return [Hash<[String,nil],
|
163
|
+
# @return [Hash<[String,nil], Enumerable<Asana::Resources::Task>>]
|
163
164
|
def by_section(tasks, project_gid)
|
164
165
|
by_section = {}
|
165
166
|
# @sg-ignore
|
@@ -170,7 +171,7 @@ module Checkoff
|
|
170
171
|
end
|
171
172
|
cache_method :by_section, LONG_CACHE_TIME
|
172
173
|
|
173
|
-
# @param by_section [Hash{[String, nil] =>
|
174
|
+
# @param by_section [Hash{[String, nil] => Enumerable<Asana::Resources::Task>}]
|
174
175
|
# @param task [Asana::Resources::Task]
|
175
176
|
# @param project_gid [String]
|
176
177
|
# @return [void]
|
data/lib/checkoff/subtasks.rb
CHANGED
@@ -27,8 +27,8 @@ module Checkoff
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# pulls a Hash of subtasks broken out by section
|
30
|
-
# @param tasks [
|
31
|
-
# @return [Hash<[nil,String],
|
30
|
+
# @param tasks [Enumerable<Asana::Resources::Task>]
|
31
|
+
# @return [Hash<[nil,String], Enumerable<Asana::Resources::Task>>]
|
32
32
|
def by_section(tasks)
|
33
33
|
current_section = nil
|
34
34
|
by_section = { nil => [] }
|
data/lib/checkoff/tags.rb
CHANGED
@@ -57,7 +57,7 @@ module Checkoff
|
|
57
57
|
# @param [String] workspace_name
|
58
58
|
# @param [String] url
|
59
59
|
# @param [Array<String>] extra_fields
|
60
|
-
# @return [
|
60
|
+
# @return [Enumerable<Asana::Resources::Task>]
|
61
61
|
def task_search(workspace_name, url, extra_fields: [])
|
62
62
|
workspace = workspaces.workspace_or_raise(workspace_name)
|
63
63
|
# @sg-ignore
|
data/lib/checkoff/tasks.rb
CHANGED
@@ -109,7 +109,7 @@ module Checkoff
|
|
109
109
|
# @param section_name [String, nil, :unspecified]
|
110
110
|
# @param only_uncompleted [Boolean]
|
111
111
|
# @param extra_fields [Array<String>]
|
112
|
-
# @return [
|
112
|
+
# @return [Enumerable<Asana::Resources::Task>]
|
113
113
|
def tasks_from_section(workspace_name, project_name,
|
114
114
|
section_name:,
|
115
115
|
only_uncompleted:,
|
@@ -160,7 +160,7 @@ module Checkoff
|
|
160
160
|
# https://github.com/Asana/ruby-asana/issues/125
|
161
161
|
|
162
162
|
# @sg-ignore
|
163
|
-
# @type [
|
163
|
+
# @type [Enumerable<Asana::Resources::Task>, nil]
|
164
164
|
dependencies = task.instance_variable_get(:@dependencies)
|
165
165
|
dependencies = task.dependencies.map { |task| { 'gid' => task.gid } } if dependencies.nil?
|
166
166
|
|
data/lib/checkoff/version.rb
CHANGED
data/lib/checkoff/workspaces.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.44.
|
4
|
+
version: 0.44.4
|
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-07-
|
11
|
+
date: 2023-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|