3llo 1.0.0.pre.rc.0 → 1.3.1.pre.rc.0

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +4 -0
  3. data/.rubocop.yml +122 -0
  4. data/3llo.gemspec +11 -11
  5. data/CHANGELOG.md +21 -0
  6. data/Gemfile +3 -3
  7. data/LICENSE +2 -1
  8. data/Rakefile +3 -9
  9. data/bin/3llo +4 -4
  10. data/lib/3llo/api/board.rb +23 -27
  11. data/lib/3llo/api/card.rb +87 -103
  12. data/lib/3llo/api/checklist.rb +26 -48
  13. data/lib/3llo/api/label.rb +64 -0
  14. data/lib/3llo/api/list.rb +22 -23
  15. data/lib/3llo/api/token.rb +2 -2
  16. data/lib/3llo/api/user.rb +8 -32
  17. data/lib/3llo/api.rb +7 -6
  18. data/lib/3llo/application.rb +32 -22
  19. data/lib/3llo/command/board/add.rb +29 -0
  20. data/lib/3llo/command/board.rb +7 -9
  21. data/lib/3llo/command/card/add.rb +12 -8
  22. data/lib/3llo/command/card/add_label.rb +56 -0
  23. data/lib/3llo/command/card/assign.rb +3 -3
  24. data/lib/3llo/command/card/edit.rb +33 -0
  25. data/lib/3llo/command/card/move.rb +3 -7
  26. data/lib/3llo/command/card/self_assign.rb +2 -2
  27. data/lib/3llo/command/card.rb +42 -53
  28. data/lib/3llo/command/label/add.rb +22 -0
  29. data/lib/3llo/command/label/edit.rb +37 -0
  30. data/lib/3llo/command/label/invalid.rb +18 -0
  31. data/lib/3llo/command/label/list.rb +18 -0
  32. data/lib/3llo/command/label/remove.rb +28 -0
  33. data/lib/3llo/command/label.rb +47 -0
  34. data/lib/3llo/command/list/add.rb +21 -0
  35. data/lib/3llo/command/list.rb +10 -9
  36. data/lib/3llo/command.rb +47 -14
  37. data/lib/3llo/controller.rb +28 -13
  38. data/lib/3llo/entities.rb +2 -2
  39. data/lib/3llo/interface.rb +3 -2
  40. data/lib/3llo/registry.rb +3 -4
  41. data/lib/3llo/remote_server.rb +99 -0
  42. data/lib/3llo/utils.rb +18 -0
  43. data/lib/3llo/version.rb +1 -1
  44. data/lib/3llo/view/board/help.rb +1 -0
  45. data/lib/3llo/view/board/list.rb +2 -2
  46. data/lib/3llo/view/card/help.rb +2 -1
  47. data/lib/3llo/view/help.rb +2 -0
  48. data/lib/3llo/view/label/help.rb +20 -0
  49. data/lib/3llo/view/label/list.rb +21 -0
  50. data/lib/3llo/view/list/help.rb +1 -0
  51. data/lib/3llo/view.rb +13 -11
  52. data/lib/3llo.rb +14 -14
  53. metadata +38 -9
  54. data/lib/3llo/http/client.rb +0 -95
  55. data/lib/3llo/http/request_error.rb +0 -18
@@ -4,20 +4,14 @@ module Tr3llo
4
4
  extend self
5
5
 
6
6
  def create(card_id, data)
7
- params = data.merge(key: api_key, token: api_token)
7
+ req_path = Utils.build_req_path("/cards/#{card_id}/checklists")
8
8
 
9
- client.post("/cards/#{card_id}/checklists", params)
9
+ client.post(req_path, {}, data)
10
10
  end
11
11
 
12
12
  def get(checklist_id)
13
- payload =
14
- JSON.parse(
15
- client.get(
16
- "/checklists/#{checklist_id}",
17
- key: api_key,
18
- token: api_token
19
- )
20
- )
13
+ req_path = Utils.build_req_path("/checklists/#{checklist_id}")
14
+ payload = client.get(req_path, {})
21
15
 
22
16
  checklist_id, checklist_name = payload.fetch_values("id", "name")
23
17
  checklist_shortcut = Entities.make_shortcut(:checklist, checklist_id)
@@ -31,24 +25,20 @@ module Tr3llo
31
25
  end
32
26
 
33
27
  def update(checklist_id, data)
34
- params = data.merge(key: api_key, token: api_token)
28
+ req_path = Utils.build_req_path("/checklists/#{checklist_id}")
35
29
 
36
- client.put("/checklists/#{checklist_id}", params)
30
+ client.put(req_path, {}, data)
37
31
  end
38
32
 
39
33
  def delete(checklist_id)
40
- client.delete("/checklists/#{checklist_id}", token: api_token, key: api_key)
34
+ req_path = Utils.build_req_path("/checklists/#{checklist_id}")
35
+
36
+ client.delete(req_path, {}, {})
41
37
  end
42
38
 
43
39
  def list_by_card_id(card_id)
44
- payload =
45
- JSON.parse(
46
- client.get(
47
- "/cards/#{card_id}/checklists",
48
- key: api_key,
49
- token: api_token
50
- )
51
- )
40
+ req_path = Utils.build_req_path("/cards/#{card_id}/checklists")
41
+ payload = client.get(req_path, {})
52
42
 
53
43
  payload.map do |checklist_payload|
54
44
  checklist_id, checklist_name = checklist_payload.fetch_values("id", "name")
@@ -56,8 +46,8 @@ module Tr3llo
56
46
 
57
47
  items =
58
48
  checklist_payload
59
- .fetch("checkItems", [])
60
- .map do |item_payload|
49
+ .fetch("checkItems", [])
50
+ .map do |item_payload|
61
51
  item_id, item_name, item_state = item_payload.fetch_values("id", "name", "state")
62
52
  item_shortcut = Entities.make_shortcut(:check_item, item_id)
63
53
 
@@ -74,14 +64,8 @@ module Tr3llo
74
64
  end
75
65
 
76
66
  def get_item(card_id, item_id)
77
- item_payload =
78
- JSON.parse(
79
- client.get(
80
- "/cards/#{card_id}/checkItem/#{item_id}",
81
- key: api_key,
82
- token: api_token
83
- )
84
- )
67
+ req_path = Utils.build_req_path("/cards/#{card_id}/checkItem/#{item_id}")
68
+ item_payload = client.get(req_path, {})
85
69
 
86
70
  item_id, item_name, item_state = item_payload.fetch_values("id", "name", "state")
87
71
  item_shortcut = Entities.make_shortcut(:check_item, item_id)
@@ -90,35 +74,29 @@ module Tr3llo
90
74
  end
91
75
 
92
76
  def create_item(checklist_id, name)
93
- client.post(
94
- "/checklists/#{checklist_id}/checkItems",
95
- key: api_key,
96
- token: api_token,
77
+ req_path = Utils.build_req_path("/checklists/#{checklist_id}/checkItems")
78
+ payload = {
97
79
  name: name,
98
80
  pos: "bottom",
99
- state: false
100
- )
81
+ state: "false"
82
+ }
83
+
84
+ client.post(req_path, {}, payload)
101
85
  end
102
86
 
103
87
  def update_item(card_id, check_item_id, data)
104
- params = data.merge(key: api_key, token: api_token)
88
+ req_path = Utils.build_req_path("/cards/#{card_id}/checkItem/#{check_item_id}")
105
89
 
106
- client.put("/cards/#{card_id}/checkItem/#{check_item_id}", params)
90
+ client.put(req_path, {}, data)
107
91
  end
108
92
 
109
93
  def delete_item(card_id, item_id)
110
- client.delete("/cards/#{card_id}/checkItem/#{item_id}", token: api_token, key: api_key)
111
- end
112
-
113
- private
94
+ req_path = Utils.build_req_path("/cards/#{card_id}/checkItem/#{item_id}")
114
95
 
115
- def api_key
116
- Application.fetch_configuration!().api_key
96
+ client.delete(req_path, {}, {})
117
97
  end
118
98
 
119
- def api_token
120
- Application.fetch_configuration!().api_token
121
- end
99
+ private
122
100
 
123
101
  def client
124
102
  Application.fetch_client!()
@@ -0,0 +1,64 @@
1
+ module Tr3llo
2
+ module API
3
+ module Label
4
+ extend self
5
+
6
+ def find_all_by_board(board_id)
7
+ req_path =
8
+ Utils.build_req_path(
9
+ "/boards/#{board_id}/labels"
10
+ )
11
+
12
+ client
13
+ .get(req_path, {})
14
+ .reject { |label| label["name"].empty? }
15
+ .map do |label_payload|
16
+ make_struct(label_payload)
17
+ end
18
+ end
19
+
20
+ def find(label_id)
21
+ req_path = Utils.build_req_path("/labels/#{label_id}")
22
+ label_payload = client.get(req_path, {})
23
+
24
+ make_struct(label_payload)
25
+ end
26
+
27
+ def create(name:, color:, board_id:)
28
+ req_path = Utils.build_req_path("/labels")
29
+ payload = {
30
+ "name" => name,
31
+ "color" => color,
32
+ "idBoard" => board_id
33
+ }
34
+
35
+ client.post(req_path, {}, payload)
36
+ end
37
+
38
+ def update(label_id, data)
39
+ req_path = Utils.build_req_path("/labels/#{label_id}")
40
+
41
+ client.put(req_path, {}, data)
42
+ end
43
+
44
+ def delete(label_id)
45
+ req_path = Utils.build_req_path("/labels/#{label_id}")
46
+
47
+ client.delete(req_path, {}, {})
48
+ end
49
+
50
+ private
51
+
52
+ def make_struct(payload)
53
+ id, name, color = payload.fetch_values("id", "name", "color")
54
+ shortcut = Entities.make_shortcut(:label, id)
55
+
56
+ Entities::Label.new(id: id, shortcut: shortcut, name: name, color: color)
57
+ end
58
+
59
+ def client
60
+ Application.fetch_client!()
61
+ end
62
+ end
63
+ end
64
+ end
data/lib/3llo/api/list.rb CHANGED
@@ -4,26 +4,33 @@ module Tr3llo
4
4
  extend self
5
5
 
6
6
  def find_all_by_board(board_id)
7
- JSON.parse(
8
- client.get(
7
+ req_path =
8
+ Utils.build_req_path(
9
9
  "/boards/#{board_id}/lists",
10
- list: true,
11
- key: api_key,
12
- token: api_token
10
+ {"list" => "true"}
13
11
  )
14
- ).map do |list_payload|
15
- make_struct(list_payload)
16
- end
12
+
13
+ client
14
+ .get(req_path, {})
15
+ .map do |list_payload|
16
+ make_struct(list_payload)
17
+ end
17
18
  end
18
19
 
19
20
  def archive_cards(list_id)
20
- JSON.parse(
21
- client.post(
22
- "/lists/#{list_id}/archiveAllCards",
23
- key: api_key,
24
- token: api_token
25
- )
26
- )
21
+ req_path = Utils.build_req_path("/lists/#{list_id}/archiveAllCards")
22
+
23
+ client.post(req_path, {}, {})
24
+ end
25
+
26
+ def create(name, board_id)
27
+ req_path = Utils.build_req_path("/lists")
28
+ payload = {
29
+ "name" => name,
30
+ "idBoard" => board_id
31
+ }
32
+
33
+ client.post(req_path, {}, payload)
27
34
  end
28
35
 
29
36
  private
@@ -38,14 +45,6 @@ module Tr3llo
38
45
  def client
39
46
  Application.fetch_client!()
40
47
  end
41
-
42
- def api_key
43
- Application.fetch_configuration!().api_key
44
- end
45
-
46
- def api_token
47
- Application.fetch_configuration!().api_token
48
- end
49
48
  end
50
49
  end
51
50
  end
@@ -4,10 +4,10 @@ module Tr3llo
4
4
  extend self
5
5
 
6
6
  def verify(key, token)
7
- client.get("/tokens/#{token}", key: key)
7
+ client.get("/tokens/#{token}?key=#{key}", {})
8
8
 
9
9
  true
10
- rescue HTTP::Client::RequestError
10
+ rescue RemoteServer::RequestError
11
11
  false
12
12
  end
13
13
 
data/lib/3llo/api/user.rb CHANGED
@@ -4,31 +4,19 @@ module Tr3llo
4
4
  extend self
5
5
 
6
6
  def find(user_id)
7
- url = "/members/#{user_id}"
7
+ client = Application.fetch_client!()
8
+ req_path = Utils.build_req_path("/members/#{user_id}")
8
9
 
9
- make_struct(
10
- JSON.parse(
11
- client.get(
12
- url,
13
- key: key,
14
- token: token
15
- )
16
- )
17
- )
10
+ make_struct(client.get(req_path, {}))
18
11
  end
19
12
 
20
13
  def find_all_by_board(board_id)
21
- url = "/board/#{board_id}/members"
14
+ client = Application.fetch_client!()
15
+ req_path = Utils.build_req_path("/board/#{board_id}/members")
22
16
 
23
- JSON.parse(
24
- client.get(
25
- url,
26
- key: key,
27
- token: token
28
- )
29
- ).map do |user_payload|
30
- make_struct(user_payload)
31
- end
17
+ client
18
+ .get(req_path, {})
19
+ .map { |user_payload| make_struct(user_payload) }
32
20
  end
33
21
 
34
22
  private
@@ -39,18 +27,6 @@ module Tr3llo
39
27
 
40
28
  Entities::User.new(id, shortcut, username)
41
29
  end
42
-
43
- def key
44
- Application.fetch_configuration!().api_key
45
- end
46
-
47
- def token
48
- Application.fetch_configuration!().api_token
49
- end
50
-
51
- def client
52
- Application.fetch_client!()
53
- end
54
30
  end
55
31
  end
56
32
  end
data/lib/3llo/api.rb CHANGED
@@ -1,6 +1,7 @@
1
- require '3llo/api/board'
2
- require '3llo/api/card'
3
- require '3llo/api/list'
4
- require '3llo/api/user'
5
- require '3llo/api/checklist'
6
- require '3llo/api/token'
1
+ require "3llo/api/board"
2
+ require "3llo/api/card"
3
+ require "3llo/api/list"
4
+ require "3llo/api/label"
5
+ require "3llo/api/user"
6
+ require "3llo/api/checklist"
7
+ require "3llo/api/token"
@@ -2,10 +2,10 @@ module Tr3llo
2
2
  module Application
3
3
  extend self
4
4
 
5
- DEFAULT_CONFIG_FILE_PATH = "~/.3llo.config.json"
5
+ DEFAULT_CONFIG_FILE_PATH = "~/.3llo.config.json".freeze
6
6
 
7
7
  def start(args)
8
- $container = Container.new()
8
+ $application = Container.new()
9
9
 
10
10
  interface = register_interface!()
11
11
  option_parser = build_option_parser()
@@ -13,12 +13,12 @@ module Tr3llo
13
13
 
14
14
  options = parse_cli_args!(option_parser, args)
15
15
 
16
- if options.key?(:help)
16
+ if options.has_key?(:help)
17
17
  execute_help!(option_parser, interface)
18
18
  exit
19
19
  end
20
20
 
21
- if options.key?(:configure)
21
+ if options.has_key?(:configure)
22
22
  execute_configure!(interface)
23
23
  exit
24
24
  end
@@ -28,7 +28,7 @@ module Tr3llo
28
28
 
29
29
  print_help!(interface)
30
30
 
31
- load_configuration!(config_file, interface)
31
+ load_configuration!(config_file)
32
32
  register_registry!()
33
33
 
34
34
  load_user!(interface)
@@ -64,7 +64,7 @@ module Tr3llo
64
64
  parser.parse!(args, into: options)
65
65
 
66
66
  options
67
- rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => exception
67
+ rescue OptionParser::InvalidArgument, OptionParser::InvalidOption
68
68
  {}
69
69
  end
70
70
 
@@ -85,19 +85,21 @@ module Tr3llo
85
85
  end
86
86
 
87
87
  def register_api_client!()
88
- $container.register(:api_client, Tr3llo::HTTP::Client)
88
+ remote_server = Tr3llo::RemoteServer.new("https://api.trello.com/1")
89
+
90
+ $application.register(:api_client, remote_server)
89
91
  end
90
92
 
91
93
  def register_interface!()
92
94
  prompt = TTY::Prompt.new()
93
- $container.register(:interface, Tr3llo::Interface.new(prompt, $stdout))
95
+ $application.register(:interface, Tr3llo::Interface.new(prompt, $stdout))
94
96
  end
95
97
 
96
- def load_configuration!(config_file, interface)
98
+ def load_configuration!(config_file)
97
99
  config_path = File.expand_path(config_file)
98
100
 
99
101
  config =
100
- if File.exists?(config_path)
102
+ if File.exist?(config_path)
101
103
  JSON.load(File.read(config_path))
102
104
  else
103
105
  {}
@@ -110,17 +112,25 @@ module Tr3llo
110
112
 
111
113
  configuration.finalize!()
112
114
 
113
- $container.register(:configuration, configuration)
115
+ $application.register(:configuration, configuration)
114
116
  rescue KeyError => exception
115
117
  command_string = "3llo --configure"
116
- abort(Utils.paint("#{exception.key.inspect} has not been configured. Please run #{command_string.inspect} to set up configuration.", "red"))
118
+
119
+ abort(
120
+ Utils.paint(
121
+ "#{exception.key.inspect} has not been configured. " \
122
+ "Please run #{command_string.inspect} to set up configuration.",
123
+ "red"
124
+ )
125
+ )
117
126
  end
118
127
 
119
128
  def get_config_entry(config, key, env_key)
120
129
  config.fetch(key) do
121
130
  if ENV.has_key?(env_key)
122
131
  Utils.deprecate!(
123
- "Setting #{env_key.inspect} as an environment variable is deprecated. It will be removed in the future versions of 3llo. Please use config file instead."
132
+ "Setting #{env_key.inspect} as an environment variable is deprecated. " \
133
+ "It will be removed in the future versions of 3llo. Please use config file instead."
124
134
  )
125
135
 
126
136
  ENV.fetch(env_key)
@@ -131,37 +141,37 @@ module Tr3llo
131
141
  end
132
142
 
133
143
  def register_registry!()
134
- $container.register(:registry, Tr3llo::Registry.new)
144
+ $application.register(:registry, Tr3llo::Registry.new)
135
145
  end
136
146
 
137
147
  def register_board!(board)
138
- $container.register(:board, board)
148
+ $application.register(:board, board)
139
149
  end
140
150
 
141
151
  def fetch_board!()
142
- $container.resolve(:board)
152
+ $application.resolve(:board)
143
153
  rescue ::Container::KeyNotFoundError
144
154
  raise BoardNotSelectedError
145
155
  end
146
156
 
147
157
  def fetch_user!()
148
- $container.resolve(:user)
158
+ $application.resolve(:user)
149
159
  end
150
160
 
151
161
  def fetch_configuration!()
152
- $container.resolve(:configuration)
162
+ $application.resolve(:configuration)
153
163
  end
154
164
 
155
165
  def fetch_interface!()
156
- $container.resolve(:interface)
166
+ $application.resolve(:interface)
157
167
  end
158
168
 
159
169
  def fetch_client!()
160
- $container.resolve(:api_client)
170
+ $application.resolve(:api_client)
161
171
  end
162
172
 
163
173
  def fetch_registry!()
164
- $container.resolve(:registry)
174
+ $application.resolve(:registry)
165
175
  end
166
176
 
167
177
  def load_user!(interface)
@@ -172,7 +182,7 @@ module Tr3llo
172
182
  interface.puts("You're logged in as #{decorated_username}")
173
183
  end
174
184
 
175
- $container.register(:user, user)
185
+ $application.register(:user, user)
176
186
  end
177
187
  end
178
188
  end
@@ -0,0 +1,29 @@
1
+ module Tr3llo
2
+ module Command
3
+ module Board
4
+ module Add
5
+ extend self
6
+
7
+ def execute()
8
+ interface = Application.fetch_interface!()
9
+
10
+ interface.print_frame do
11
+ name = interface.input.ask("Name:", required: true)
12
+ desc = interface.input.ask("Description:")
13
+
14
+ default_lists =
15
+ interface.input.yes?("With default set of lists to the board (To Do, Doing, Done)?") do |question|
16
+ question.default false
17
+ question.positive "Y"
18
+ question.negative "N"
19
+ end
20
+
21
+ API::Board.create(name: name, desc: desc, default_lists: default_lists)
22
+
23
+ interface.puts("Board has been created.")
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,6 +1,4 @@
1
- require '3llo/command/board/list'
2
- require '3llo/command/board/select'
3
- require '3llo/command/board/invalid'
1
+ Tr3llo::Utils.require_directory(File.dirname(__FILE__) + "/board/*.rb")
4
2
 
5
3
  module Tr3llo
6
4
  module Command
@@ -9,21 +7,21 @@ module Tr3llo
9
7
 
10
8
  def execute(subcommand, args)
11
9
  case subcommand
12
- when 'list'
10
+ when "list"
13
11
  user = Application.fetch_user!()
14
12
 
15
13
  Command::Board::List.execute(user[:id])
16
- when 'select'
17
- board_key, _ = args
14
+ when "select"
15
+ board_key, = args
18
16
  Utils.assert_string!(board_key, "board key is missing")
19
17
 
20
18
  Command::Board::Select.execute(board_key)
19
+ when "add"
20
+ Command::Board::Add.execute()
21
21
  else
22
22
  handle_invalid_subcommand(subcommand, args)
23
23
  end
24
- rescue InvalidCommandError => exception
25
- Command::Board::Invalid.execute(exception.message)
26
- rescue InvalidArgumentError => exception
24
+ rescue InvalidCommandError, InvalidArgumentError => exception
27
25
  Command::Board::Invalid.execute(exception.message)
28
26
  end
29
27
 
@@ -14,17 +14,21 @@ module Tr3llo
14
14
  interface = Application.fetch_interface!()
15
15
 
16
16
  interface.print_frame do
17
- list_id = interface.input.select(
18
- "Choose the list this card should belong to:",
19
- list_options
20
- )
17
+ if list_options.any?
18
+ list_id = interface.input.select(
19
+ "Choose the list this card should belong to:",
20
+ list_options
21
+ )
21
22
 
22
- name = interface.input.ask("Name:", required: true)
23
- description = interface.input.ask("Description:")
23
+ name = interface.input.ask("Name:", required: true)
24
+ description = interface.input.multiline("Description:").join("")
24
25
 
25
- API::Card.create(name, description, list_id)
26
+ API::Card.create(name, description, list_id)
26
27
 
27
- interface.puts("Card has been created.")
28
+ interface.puts("Card has been created.")
29
+ else
30
+ interface.puts("There is no list on board.")
31
+ end
28
32
  end
29
33
  end
30
34
  end
@@ -0,0 +1,56 @@
1
+ module Tr3llo
2
+ module Command
3
+ module Card
4
+ module AddLabel
5
+ extend self
6
+
7
+ def execute(key, board_id)
8
+ card_id = Entities.parse_id(:card, key)
9
+ assert_card_id!(card_id, key)
10
+
11
+ card = API::Card.find(card_id)
12
+
13
+ interface = Application.fetch_interface!()
14
+
15
+ interface.print_frame do
16
+ label_ids = select_labels(interface, card, board_id)
17
+
18
+ add_labels(card_id, label_ids)
19
+ interface.puts("Chosen labels have been added to the card.")
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def assert_card_id!(card_id, key)
26
+ raise InvalidArgumentError.new("#{key.inspect} is not a valid card key") unless card_id
27
+ end
28
+
29
+ def add_labels(card_id, label_ids)
30
+ API::Card.add_labels(card_id, label_ids)
31
+ end
32
+
33
+ def select_labels(interface, card, board_id)
34
+ label_options =
35
+ API::Label.find_all_by_board(board_id)
36
+ .map { |label| [label.name, label.id] }
37
+ .to_h()
38
+
39
+ preselected_label_ids =
40
+ card.labels.flat_map do |label|
41
+ index = label_options.find_index { |_label_name, label_id| label_id == label.id }
42
+
43
+ index ? [index + 1] : []
44
+ end
45
+
46
+ interface.input.multi_select(
47
+ "Choose the labels to add to this card:",
48
+ label_options,
49
+ default: preselected_label_ids,
50
+ enum: "."
51
+ )
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -33,14 +33,14 @@ module Tr3llo
33
33
  def select_user(interface, card, board_id)
34
34
  user_options =
35
35
  API::User.find_all_by_board(board_id)
36
- .map { |user| [user.username, user.id] }
37
- .to_h()
36
+ .map { |user| [user.username, user.id] }
37
+ .to_h()
38
38
 
39
39
  member_ids =
40
40
  card.members.flat_map do |member|
41
41
  index = user_options.find_index { |_username, user_id| user_id == member.id }
42
42
 
43
- if index then [index + 1] else [] end
43
+ index ? [index + 1] : []
44
44
  end
45
45
 
46
46
  interface.input.multi_select(