checkoff 0.44.2 → 0.44.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d924c906eed129ad1c57bdbfdd8cdcc61b572e296a09721195b7c1a10d78dbe5
4
- data.tar.gz: 79e71aac6289b18a448288a601c62a02cee6583bcbbc966e64a71003c8e73e89
3
+ metadata.gz: a1e122dcb6fa01052af47f61287ae9c9935f33f2b8f76d88ab1c28b60f760643
4
+ data.tar.gz: cd3b9ebb8285f665db56624db599cc16b8f48e7b3e9bc7a1496be8bb0d406825
5
5
  SHA512:
6
- metadata.gz: 8bc265211c02ebf11e7c7f35ce79aae7517c6b86cf023c8d0b41713a24df2365954f9757bfe9b44a85573187af7fb355f84e7d6b1bad9e8b32fc9b8b9ed6891d
7
- data.tar.gz: 5de92894cb1f12d633667b87f426f4460d63a54d84cb1a9f2e8e38c529c45d41efdd9097cb9a2dd6f73691669a4a070ba87aedc55a5d8ec7780fa9cec5e2d13a
6
+ metadata.gz: b26dcb1341e3b69da84d527206dc637529fc1e00d2dd9c813a9f0979f5cbf3bebd7a5cb8d5ce4974684026755e84074381b9582866cdeb633c1ed88485856b7f
7
+ data.tar.gz: 960570cff6bfc672295d5a1ca14fb9048d06f59b22ad89253f1aa93f701c6c84346c5fcb8bc12d183fa7981ad6464f372d5d898bd2ab05e4560bf5bd07c23841
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.44.2)
15
+ checkoff (0.44.3)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -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
@@ -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
- projects = projects_by_workspace_name(workspace_name)
63
- projects.find do |project|
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 [Array<Asana::Resources::Task>]
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
- # @sg-ignore
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 [Array<Asana::Resources::Project>]
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
@@ -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
@@ -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.44.2'
6
+ VERSION = '0.44.3'
7
7
  end
@@ -41,6 +41,7 @@ module Checkoff
41
41
  workspace.name == workspace_name
42
42
  end
43
43
  end
44
+ cache_method :workspace, LONG_CACHE_TIME
44
45
 
45
46
  # @return [Asana::Resources::Workspace]
46
47
  def default_workspace
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.2
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-02 00:00:00.000000000 Z
11
+ date: 2023-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport