checkoff 0.44.2 → 0.44.3
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 +72 -0
- data/lib/checkoff/projects.rb +11 -13
- data/lib/checkoff/sections.rb +1 -0
- 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: a1e122dcb6fa01052af47f61287ae9c9935f33f2b8f76d88ab1c28b60f760643
|
4
|
+
data.tar.gz: cd3b9ebb8285f665db56624db599cc16b8f48e7b3e9bc7a1496be8bb0d406825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b26dcb1341e3b69da84d527206dc637529fc1e00d2dd9c813a9f0979f5cbf3bebd7a5cb8d5ce4974684026755e84074381b9582866cdeb633c1ed88485856b7f
|
7
|
+
data.tar.gz: 960570cff6bfc672295d5a1ca14fb9048d06f59b22ad89253f1aa93f701c6c84346c5fcb8bc12d183fa7981ad6464f372d5d898bd2ab05e4560bf5bd07c23841
|
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,6 +51,42 @@
|
|
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
92
|
# # @return [Array<Asana::Resources::Task>]
|
@@ -66,5 +108,35 @@
|
|
66
108
|
# # @return [Array<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
|
@@ -80,13 +80,12 @@ module Checkoff
|
|
80
80
|
|
81
81
|
# find uncompleted tasks in a list
|
82
82
|
# @param [Array<Asana::Resources::Task>] tasks
|
83
|
-
# @return [
|
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
|
@@ -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
@@ -59,6 +59,7 @@ module Checkoff
|
|
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
|
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.3
|
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-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|