checkoff 0.197.0 → 0.199.0

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: 3418376569519f417f88e6e2a2ee492b91d9e3d45f838f5d35a12f4f757473c8
4
- data.tar.gz: fa62605019dbc34da3bbcfe1801c6ccdceff9dbe2d16718e0fb857f717ed5076
3
+ metadata.gz: 1c58298d6292e9d70cfb62d354224e8b03de39798b8e2a822c284a55ca4aba4f
4
+ data.tar.gz: a9454f466639dcb730d6e2ecfe1f4a928827bade28f56a183c07a83b414c42c3
5
5
  SHA512:
6
- metadata.gz: a32931a1162f346a1988e231779c97f44c1c61a2a0103e8d6d29225115246673c4d7d015c9beacf3825ce55937109a6e898e9daea31bc023fda3acb1f8f9442f
7
- data.tar.gz: 2da623caac1139c8a2e9779c8bb95fbe1cdcc146656b462de02689fb7647f187d9c3729b4723d146810f433f2046fe5eb495cfcd8117ea9fe8a3a7dc249f04ef
6
+ metadata.gz: c6b583c219f0d571e9d1837a3fb9ff6fc5c2ff936da0bee0e33fe6207796c3b7d4bbe4e88e55c5959b4c8d43001bcdec805ba67f9ba674d3a347f8a4a287eb25
7
+ data.tar.gz: 4a0e6bcca51683b18266751047b7914d2abe039d3bef5363e1438065477a2b7c7069f3738dd8f7aedc3b705c60b9a67200509c7eb1dc7ae83809d9eec7f6d8a0
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.197.0)
15
+ checkoff (0.199.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -7,6 +7,7 @@ require 'cache_method'
7
7
  require_relative 'internal/config_loader'
8
8
  require_relative 'workspaces'
9
9
  require_relative 'clients'
10
+ require_relative 'projects'
10
11
 
11
12
  # https://developers.asana.com/reference/portfolios
12
13
 
@@ -27,12 +28,15 @@ module Checkoff
27
28
  # @param workspaces [Checkoff::Workspaces]
28
29
  # @param clients [Checkoff::Clients]
29
30
  # @param client [Asana::Client]
31
+ # @param projects [Checkoff::Projects]
30
32
  def initialize(config: Checkoff::Internal::ConfigLoader.load(:asana),
31
33
  clients: Checkoff::Clients.new(config: config),
32
34
  client: clients.client,
35
+ projects: Checkoff::Projects.new(config: config, client: client),
33
36
  workspaces: Checkoff::Workspaces.new(config: config, client: client))
34
37
  @workspaces = workspaces
35
38
  @client = client
39
+ @projects = projects
36
40
  end
37
41
 
38
42
  # @param workspace_name [String]
@@ -95,10 +99,7 @@ module Checkoff
95
99
  #
96
100
  # @return [Enumerable<Asana::Resources::Project>]
97
101
  def projects_in_portfolio_obj(portfolio, extra_project_fields: [])
98
- options = {
99
- fields: ['name'],
100
- }
101
- options[:fields] += extra_project_fields
102
+ options = projects.project_options(extra_project_fields: extra_project_fields)
102
103
  client.portfolios.get_items_for_portfolio(portfolio_gid: portfolio.gid, options: options)
103
104
  end
104
105
 
@@ -107,6 +108,9 @@ module Checkoff
107
108
  # @return [Checkoff::Workspaces]
108
109
  attr_reader :workspaces
109
110
 
111
+ # @return [Checkoff::Projects]
112
+ attr_reader :projects
113
+
110
114
  # @return [Asana::Client]
111
115
  attr_reader :client
112
116
 
@@ -70,7 +70,7 @@ module Checkoff
70
70
  #
71
71
  # @return [Enumerable<Asana::Resources::Section>]
72
72
  def sections_by_project_gid(project_gid, extra_fields: [])
73
- fields = %w[name] + extra_fields
73
+ fields = (%w[name] + extra_fields).sort.uniq
74
74
  client.sections.get_sections_for_project(project_gid: project_gid,
75
75
  options: { fields: fields })
76
76
  end
@@ -212,6 +212,19 @@ module Checkoff
212
212
  {}
213
213
  end
214
214
 
215
+ # @sg-ignore
216
+ # @param workspace_name [String]
217
+ # @param project_name [String, Symbol]
218
+ # @param section_name [String, nil]
219
+ # @param extra_section_fields [Array<String>]
220
+ #
221
+ # @return [Asana::Resources::Section, nil]
222
+ def section(workspace_name, project_name, section_name, extra_section_fields: [])
223
+ sections = sections_or_raise(workspace_name, project_name,
224
+ extra_fields: extra_section_fields)
225
+ sections.find { |section| section_key(section.name)&.chomp(':') == section_name&.chomp(':') }
226
+ end
227
+
215
228
  private
216
229
 
217
230
  include Logging
@@ -292,18 +305,5 @@ module Checkoff
292
305
  end
293
306
  project
294
307
  end
295
-
296
- # @sg-ignore
297
- # @param workspace_name [String]
298
- # @param project_name [String, Symbol]
299
- # @param section_name [String, nil]
300
- # @param extra_section_fields [Array<String>]
301
- #
302
- # @return [Asana::Resources::Section, nil]
303
- def section(workspace_name, project_name, section_name, extra_section_fields: [])
304
- sections = sections_or_raise(workspace_name, project_name,
305
- extra_fields: extra_section_fields)
306
- sections.find { |section| section_key(section.name)&.chomp(':') == section_name&.chomp(':') }
307
- end
308
308
  end
309
309
  end
@@ -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.197.0'
6
+ VERSION = '0.199.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.197.0
4
+ version: 0.199.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: 2024-02-18 00:00:00.000000000 Z
11
+ date: 2024-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport