checkoff 0.24.1 → 0.25.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: 14b36fb42ff1797a222323d199980f2bb5975c7c08f363d14c4a60a4bac2ebad
4
- data.tar.gz: 1e8864d3ecae5f6ef28bb8b3466c2dd6024bc7411e00822fdc451551cf458759
3
+ metadata.gz: 0163bf29ae74fcf0cf1b95a199f088b1ceb3313a8b1429491c3b08c0b662e52e
4
+ data.tar.gz: 683ee42666b4ad5594c77b79ec509c5843e88384093715fbc3f0d7d189086ff8
5
5
  SHA512:
6
- metadata.gz: 73409fb7dc9ae6407bc57ca07599da338faf97449a2bec69df98b333310cffde433f2e006fa2186233ccdc31867a0bcdd13948816babb087a904599c30e816aa
7
- data.tar.gz: f52814a389c1e25bb7d3e050d1eadbbe97613775a0de02a4aaf1e6e74e56d05a23102804a34d12d05a1b0e7f02c88570ad008bc27777aec694cad34cf9081fd3
6
+ metadata.gz: 2d1a3b432d4b101558595c35b0dda58a2dadc7802bb1976091c50518355b61985287ec6089b1bfeb4f0b3588dc7426488ffcd3f4df1a52f887fb231cd49132d7
7
+ data.tar.gz: 68523d9b54bb9d7ab79ee23167a75a1218b6de0673d09ff71f78fad9ddebfa802c110faeb54d84c50be45ed94ea11ccf4d833d7bd87e6d453ab249df1534e2c4
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- checkoff (0.24.1)
15
+ checkoff (0.25.0)
16
16
  activesupport
17
17
  asana (> 0.10.0)
18
18
  cache_method
@@ -22,7 +22,7 @@ PATH
22
22
  GEM
23
23
  remote: https://rubygems.org/
24
24
  specs:
25
- activesupport (7.0.4.1)
25
+ activesupport (7.0.4.2)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
27
  i18n (>= 1.6, < 2)
28
28
  minitest (>= 5.1)
@@ -167,7 +167,7 @@ GEM
167
167
  simplecov-lcov (0.8.0)
168
168
  simplecov_json_formatter (0.1.3)
169
169
  tomlrb (2.0.3)
170
- tzinfo (2.0.5)
170
+ tzinfo (2.0.6)
171
171
  concurrent-ruby (~> 1.0)
172
172
  undercover (0.4.5)
173
173
  imagen (>= 0.1.8)
@@ -50,6 +50,7 @@ module Checkoff
50
50
  'less_than' => CustomFieldVariant::LessThan,
51
51
  'greater_than' => CustomFieldVariant::GreaterThan,
52
52
  'doesnt_contain_any' => CustomFieldVariant::DoesntContainAny,
53
+ 'contains_any' => CustomFieldVariant::ContainsAny,
53
54
  }.freeze
54
55
 
55
56
  def convert_single_custom_field_params(gid, single_custom_field_params)
@@ -79,6 +79,20 @@ module Checkoff
79
79
  end
80
80
  end
81
81
 
82
+ # This is used in the UI for multi-select fields
83
+ #
84
+ # custom_field_#{gid}.variant = 'contains_any'
85
+ class ContainsAny < CustomFieldVariant
86
+ def convert
87
+ selected_options = fetch_solo_param("custom_field_#{gid}.selected_options").split('~')
88
+
89
+ [{ "custom_fields.#{gid}.is_set" => 'true' },
90
+ ['custom_field_gid_value_contains_any_gid',
91
+ gid,
92
+ selected_options]]
93
+ end
94
+ end
95
+
82
96
  # custom_field_#{gid}.variant = 'no_value'
83
97
  class NoValue < CustomFieldVariant
84
98
  def convert
@@ -27,25 +27,13 @@ module Checkoff
27
27
  end
28
28
 
29
29
  attr_reader :key, :values
30
- end
31
-
32
- # Handle 'any_projects.ids' search url param
33
- class AnyProjectsIds < SimpleParam
34
- def projects
35
- @projects ||= []
36
- end
37
30
 
38
- def sections
39
- @sections ||= []
40
- end
41
-
42
- def parse!
43
- # Inputs:
44
- # 123_column_456 means "abc" project, "def" section
45
- # 123 means "abc" project
46
- # 123~456 means "abc" and "def" projects
47
- project_section_pairs = single_value.split('~')
48
- project_section_pairs.each do |project_section_pair|
31
+ # Inputs:
32
+ # 123_column_456 means "abc" project, "def" section
33
+ # 123 means "abc" project
34
+ # 123~456 means "abc" and "def" projects
35
+ def parse_projects_and_sections(projects, sections)
36
+ single_value.split('~').each do |project_section_pair|
49
37
  project, section = project_section_pair.split('_column_')
50
38
  if section.nil?
51
39
  projects << project
@@ -55,15 +43,31 @@ module Checkoff
55
43
  end
56
44
  end
57
45
 
58
- def convert
59
- parse!
46
+ def convert_from_projects_and_sections(verb)
47
+ projects = []
48
+ sections = []
49
+ parse_projects_and_sections(projects, sections)
60
50
  out = {}
61
- out['projects.any'] = projects.join(',') unless projects.empty?
62
- out['sections.any'] = sections.join(',') unless sections.empty?
51
+ out["projects.#{verb}"] = projects.join(',') unless projects.empty?
52
+ out["sections.#{verb}"] = sections.join(',') unless sections.empty?
63
53
  out.to_a.flatten
64
54
  end
65
55
  end
66
56
 
57
+ # Handle 'any_projects.ids' search url param
58
+ class AnyProjectsIds < SimpleParam
59
+ def convert
60
+ convert_from_projects_and_sections('any')
61
+ end
62
+ end
63
+
64
+ # Handle 'not_projects.ids' search url param
65
+ class NotProjectsIds < SimpleParam
66
+ def convert
67
+ convert_from_projects_and_sections('not')
68
+ end
69
+ end
70
+
67
71
  # Handle 'completion' search url param
68
72
  class Completion < SimpleParam
69
73
  def convert
@@ -116,6 +120,7 @@ module Checkoff
116
120
 
117
121
  ARGS = {
118
122
  'any_projects.ids' => SimpleParam::AnyProjectsIds,
123
+ 'not_projects.ids' => SimpleParam::NotProjectsIds,
119
124
  'completion' => SimpleParam::Completion,
120
125
  'not_tags.ids' => SimpleParam::NotTagsIds,
121
126
  'any_tags.ids' => SimpleParam::AnyTagsIds,
@@ -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.24.1'
6
+ VERSION = '0.25.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.24.1
4
+ version: 0.25.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-01-22 00:00:00.000000000 Z
11
+ date: 2023-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport