monday_ruby 1.1.0 → 1.2.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.
- checksums.yaml +4 -4
- data/.env +1 -1
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +14 -0
- data/CONTRIBUTING.md +104 -0
- data/README.md +146 -142
- data/docs/.vitepress/config.mjs +255 -0
- data/docs/.vitepress/theme/index.js +4 -0
- data/docs/.vitepress/theme/style.css +43 -0
- data/docs/README.md +80 -0
- data/docs/explanation/architecture.md +507 -0
- data/docs/explanation/best-practices/errors.md +478 -0
- data/docs/explanation/best-practices/performance.md +1084 -0
- data/docs/explanation/best-practices/rate-limiting.md +630 -0
- data/docs/explanation/best-practices/testing.md +820 -0
- data/docs/explanation/column-values.md +857 -0
- data/docs/explanation/design.md +795 -0
- data/docs/explanation/graphql.md +356 -0
- data/docs/explanation/migration/v1.md +808 -0
- data/docs/explanation/pagination.md +447 -0
- data/docs/guides/advanced/batch.md +1274 -0
- data/docs/guides/advanced/complex-queries.md +1114 -0
- data/docs/guides/advanced/errors.md +818 -0
- data/docs/guides/advanced/pagination.md +934 -0
- data/docs/guides/advanced/rate-limiting.md +981 -0
- data/docs/guides/authentication.md +286 -0
- data/docs/guides/boards/create.md +386 -0
- data/docs/guides/boards/delete.md +405 -0
- data/docs/guides/boards/duplicate.md +511 -0
- data/docs/guides/boards/query.md +530 -0
- data/docs/guides/boards/update.md +453 -0
- data/docs/guides/columns/create.md +452 -0
- data/docs/guides/columns/metadata.md +492 -0
- data/docs/guides/columns/query.md +455 -0
- data/docs/guides/columns/update-multiple.md +459 -0
- data/docs/guides/columns/update-values.md +509 -0
- data/docs/guides/files/add-to-column.md +40 -0
- data/docs/guides/files/add-to-update.md +37 -0
- data/docs/guides/files/clear-column.md +33 -0
- data/docs/guides/first-request.md +285 -0
- data/docs/guides/folders/manage.md +750 -0
- data/docs/guides/groups/items.md +626 -0
- data/docs/guides/groups/manage.md +501 -0
- data/docs/guides/installation.md +169 -0
- data/docs/guides/items/create.md +493 -0
- data/docs/guides/items/delete.md +514 -0
- data/docs/guides/items/query.md +605 -0
- data/docs/guides/items/subitems.md +483 -0
- data/docs/guides/items/update.md +699 -0
- data/docs/guides/updates/manage.md +619 -0
- data/docs/guides/use-cases/dashboard.md +1421 -0
- data/docs/guides/use-cases/import.md +1962 -0
- data/docs/guides/use-cases/task-management.md +1381 -0
- data/docs/guides/workspaces/manage.md +502 -0
- data/docs/index.md +69 -0
- data/docs/package-lock.json +2468 -0
- data/docs/package.json +13 -0
- data/docs/reference/client.md +540 -0
- data/docs/reference/configuration.md +586 -0
- data/docs/reference/errors.md +693 -0
- data/docs/reference/resources/account.md +208 -0
- data/docs/reference/resources/activity-log.md +369 -0
- data/docs/reference/resources/board-view.md +359 -0
- data/docs/reference/resources/board.md +393 -0
- data/docs/reference/resources/column.md +543 -0
- data/docs/reference/resources/file.md +236 -0
- data/docs/reference/resources/folder.md +386 -0
- data/docs/reference/resources/group.md +507 -0
- data/docs/reference/resources/item.md +348 -0
- data/docs/reference/resources/subitem.md +267 -0
- data/docs/reference/resources/update.md +259 -0
- data/docs/reference/resources/workspace.md +213 -0
- data/docs/reference/response.md +560 -0
- data/docs/tutorial/first-integration.md +713 -0
- data/lib/monday/client.rb +24 -0
- data/lib/monday/configuration.rb +5 -0
- data/lib/monday/request.rb +15 -0
- data/lib/monday/resources/base.rb +4 -0
- data/lib/monday/resources/file.rb +56 -0
- data/lib/monday/util.rb +1 -0
- data/lib/monday/version.rb +1 -1
- metadata +87 -4
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
# Archive & Delete Boards
|
|
2
|
+
|
|
3
|
+
Archive or permanently delete boards from your monday.com account.
|
|
4
|
+
|
|
5
|
+
## Archive a Board
|
|
6
|
+
|
|
7
|
+
Archiving removes a board from active view while preserving data:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
require "monday_ruby"
|
|
11
|
+
|
|
12
|
+
Monday.configure do |config|
|
|
13
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
client = Monday::Client.new
|
|
17
|
+
|
|
18
|
+
board_id = 1234567890
|
|
19
|
+
|
|
20
|
+
response = client.board.archive(board_id)
|
|
21
|
+
|
|
22
|
+
if response.success?
|
|
23
|
+
archived_board = response.body.dig("data", "archive_board")
|
|
24
|
+
puts "✓ Archived board ID: #{archived_board['id']}"
|
|
25
|
+
else
|
|
26
|
+
puts "✗ Failed to archive board"
|
|
27
|
+
end
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Archive with Custom Fields
|
|
31
|
+
|
|
32
|
+
Return specific fields from the archived board:
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
response = client.board.archive(
|
|
36
|
+
board_id,
|
|
37
|
+
select: ["id", "name", "state"]
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
if response.success?
|
|
41
|
+
board = response.body.dig("data", "archive_board")
|
|
42
|
+
|
|
43
|
+
puts "✓ Archived: #{board['name']}"
|
|
44
|
+
puts " ID: #{board['id']}"
|
|
45
|
+
puts " State: #{board['state']}"
|
|
46
|
+
end
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Delete a Board
|
|
50
|
+
|
|
51
|
+
Permanently delete a board:
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
board_id = 1234567890
|
|
55
|
+
|
|
56
|
+
response = client.board.delete(board_id)
|
|
57
|
+
|
|
58
|
+
if response.success?
|
|
59
|
+
deleted_board = response.body.dig("data", "delete_board")
|
|
60
|
+
puts "✓ Deleted board ID: #{deleted_board['id']}"
|
|
61
|
+
else
|
|
62
|
+
puts "✗ Failed to delete board"
|
|
63
|
+
end
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
::: warning <span style="display: inline-flex; align-items: center; gap: 6px;"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>Permanent Deletion</span>
|
|
67
|
+
Deleting a board is permanent and cannot be undone. All items, updates, and files will be lost. Consider archiving instead.
|
|
68
|
+
:::
|
|
69
|
+
|
|
70
|
+
## Delete with Custom Fields
|
|
71
|
+
|
|
72
|
+
Return specific fields from the deleted board:
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
response = client.board.delete(
|
|
76
|
+
board_id,
|
|
77
|
+
select: ["id", "name"]
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
if response.success?
|
|
81
|
+
board = response.body.dig("data", "delete_board")
|
|
82
|
+
puts "✓ Deleted: #{board['name']} (ID: #{board['id']})"
|
|
83
|
+
end
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Archive vs Delete
|
|
87
|
+
|
|
88
|
+
| Operation | Recoverable | Data Preserved | Use Case |
|
|
89
|
+
|-----------|-------------|----------------|----------|
|
|
90
|
+
| Archive | Yes | Yes | Temporarily hide completed projects |
|
|
91
|
+
| Delete | No | No | Permanently remove unwanted boards |
|
|
92
|
+
|
|
93
|
+
## Confirm Before Delete
|
|
94
|
+
|
|
95
|
+
Require user confirmation:
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
def confirm_delete(board_name)
|
|
99
|
+
puts "⚠️ You are about to permanently delete '#{board_name}'"
|
|
100
|
+
print "Type 'DELETE' to confirm: "
|
|
101
|
+
input = gets.chomp
|
|
102
|
+
|
|
103
|
+
input == "DELETE"
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
board_id = 1234567890
|
|
107
|
+
|
|
108
|
+
# Get board name first
|
|
109
|
+
query_response = client.board.query(
|
|
110
|
+
args: { ids: [board_id] },
|
|
111
|
+
select: ["id", "name"]
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
if query_response.success?
|
|
115
|
+
board = query_response.body.dig("data", "boards", 0)
|
|
116
|
+
|
|
117
|
+
if confirm_delete(board['name'])
|
|
118
|
+
delete_response = client.board.delete(board_id)
|
|
119
|
+
|
|
120
|
+
if delete_response.success?
|
|
121
|
+
puts "✓ Board deleted"
|
|
122
|
+
else
|
|
123
|
+
puts "✗ Delete failed"
|
|
124
|
+
end
|
|
125
|
+
else
|
|
126
|
+
puts "❌ Delete cancelled"
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Safe Archive Function
|
|
132
|
+
|
|
133
|
+
Archive with error handling:
|
|
134
|
+
|
|
135
|
+
```ruby
|
|
136
|
+
def safe_archive(client, board_id)
|
|
137
|
+
response = client.board.archive(board_id)
|
|
138
|
+
|
|
139
|
+
if response.success?
|
|
140
|
+
board = response.body.dig("data", "archive_board")
|
|
141
|
+
puts "✓ Archived board: #{board['id']}"
|
|
142
|
+
true
|
|
143
|
+
else
|
|
144
|
+
puts "✗ Archive failed"
|
|
145
|
+
puts " Status: #{response.status}"
|
|
146
|
+
|
|
147
|
+
if response.body["error_message"]
|
|
148
|
+
puts " Error: #{response.body['error_message']}"
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
false
|
|
152
|
+
end
|
|
153
|
+
rescue Monday::AuthorizationError
|
|
154
|
+
puts "✗ Board not found or no permission"
|
|
155
|
+
false
|
|
156
|
+
rescue Monday::Error => e
|
|
157
|
+
puts "✗ API error: #{e.message}"
|
|
158
|
+
false
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Usage
|
|
162
|
+
safe_archive(client, 1234567890)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Safe Delete Function
|
|
166
|
+
|
|
167
|
+
Delete with comprehensive error handling:
|
|
168
|
+
|
|
169
|
+
```ruby
|
|
170
|
+
def safe_delete(client, board_id)
|
|
171
|
+
response = client.board.delete(board_id)
|
|
172
|
+
|
|
173
|
+
if response.success?
|
|
174
|
+
board = response.body.dig("data", "delete_board")
|
|
175
|
+
puts "✓ Deleted board: #{board['id']}"
|
|
176
|
+
true
|
|
177
|
+
else
|
|
178
|
+
puts "✗ Delete failed"
|
|
179
|
+
puts " Status: #{response.status}"
|
|
180
|
+
false
|
|
181
|
+
end
|
|
182
|
+
rescue Monday::InvalidRequestError => e
|
|
183
|
+
if e.message.include?("InvalidBoardIdException")
|
|
184
|
+
puts "✗ Board does not exist"
|
|
185
|
+
else
|
|
186
|
+
puts "✗ Invalid request: #{e.message}"
|
|
187
|
+
end
|
|
188
|
+
false
|
|
189
|
+
rescue Monday::AuthorizationError
|
|
190
|
+
puts "✗ No permission to delete this board"
|
|
191
|
+
false
|
|
192
|
+
rescue Monday::Error => e
|
|
193
|
+
puts "✗ API error: #{e.message}"
|
|
194
|
+
false
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Usage
|
|
198
|
+
safe_delete(client, 1234567890)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Bulk Archive
|
|
202
|
+
|
|
203
|
+
Archive multiple boards:
|
|
204
|
+
|
|
205
|
+
```ruby
|
|
206
|
+
def bulk_archive(client, board_ids)
|
|
207
|
+
results = { success: [], failed: [] }
|
|
208
|
+
|
|
209
|
+
board_ids.each do |board_id|
|
|
210
|
+
response = client.board.archive(board_id)
|
|
211
|
+
|
|
212
|
+
if response.success?
|
|
213
|
+
results[:success] << board_id
|
|
214
|
+
puts "✓ Archived: #{board_id}"
|
|
215
|
+
else
|
|
216
|
+
results[:failed] << board_id
|
|
217
|
+
puts "✗ Failed: #{board_id}"
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
puts "\nResults:"
|
|
222
|
+
puts " Archived: #{results[:success].length}"
|
|
223
|
+
puts " Failed: #{results[:failed].length}"
|
|
224
|
+
|
|
225
|
+
results
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Usage
|
|
229
|
+
board_ids = [1234567890, 2345678901, 3456789012]
|
|
230
|
+
bulk_archive(client, board_ids)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Example output:**
|
|
234
|
+
```
|
|
235
|
+
✓ Archived: 1234567890
|
|
236
|
+
✓ Archived: 2345678901
|
|
237
|
+
✗ Failed: 3456789012
|
|
238
|
+
|
|
239
|
+
Results:
|
|
240
|
+
Archived: 2
|
|
241
|
+
Failed: 1
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Archive Old Boards
|
|
245
|
+
|
|
246
|
+
Archive boards based on criteria:
|
|
247
|
+
|
|
248
|
+
```ruby
|
|
249
|
+
def archive_old_boards(client, days_threshold: 90)
|
|
250
|
+
# Query all boards
|
|
251
|
+
response = client.board.query(
|
|
252
|
+
select: ["id", "name", "updated_at"]
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
return unless response.success?
|
|
256
|
+
|
|
257
|
+
boards = response.body.dig("data", "boards")
|
|
258
|
+
archived_count = 0
|
|
259
|
+
|
|
260
|
+
boards.each do |board|
|
|
261
|
+
# Skip if no updated_at or updated recently
|
|
262
|
+
next unless board["updated_at"]
|
|
263
|
+
|
|
264
|
+
updated_date = Time.parse(board["updated_at"])
|
|
265
|
+
days_old = (Time.now - updated_date) / 86400
|
|
266
|
+
|
|
267
|
+
if days_old > days_threshold
|
|
268
|
+
archive_response = client.board.archive(board["id"])
|
|
269
|
+
|
|
270
|
+
if archive_response.success?
|
|
271
|
+
puts "✓ Archived: #{board['name']} (#{days_old.to_i} days old)"
|
|
272
|
+
archived_count += 1
|
|
273
|
+
else
|
|
274
|
+
puts "✗ Failed to archive: #{board['name']}"
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
puts "\n#{archived_count} boards archived"
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Archive boards not updated in 90 days
|
|
283
|
+
archive_old_boards(client, days_threshold: 90)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Restore Archived Board
|
|
287
|
+
|
|
288
|
+
Query and restore from archive:
|
|
289
|
+
|
|
290
|
+
```ruby
|
|
291
|
+
# First, find archived boards
|
|
292
|
+
response = client.board.query(
|
|
293
|
+
args: { state: :archived },
|
|
294
|
+
select: ["id", "name"]
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
if response.success?
|
|
298
|
+
archived_boards = response.body.dig("data", "boards")
|
|
299
|
+
|
|
300
|
+
puts "Archived boards:"
|
|
301
|
+
archived_boards.each do |board|
|
|
302
|
+
puts " #{board['id']}: #{board['name']}"
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# To restore, update the board state via monday.com UI
|
|
306
|
+
# API doesn't support programmatic restoration
|
|
307
|
+
puts "\nNote: Restore boards via monday.com web interface"
|
|
308
|
+
end
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
::: tip <span style="display: inline-flex; align-items: center; gap: 6px;"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>Restoring Boards</span>
|
|
312
|
+
Archived boards can be restored through the monday.com web interface. The API currently doesn't support programmatic restoration.
|
|
313
|
+
:::
|
|
314
|
+
|
|
315
|
+
## Complete Example
|
|
316
|
+
|
|
317
|
+
Safe board deletion with confirmation:
|
|
318
|
+
|
|
319
|
+
```ruby
|
|
320
|
+
require "monday_ruby"
|
|
321
|
+
require "dotenv/load"
|
|
322
|
+
|
|
323
|
+
Monday.configure do |config|
|
|
324
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
client = Monday::Client.new
|
|
328
|
+
|
|
329
|
+
board_id = 1234567890
|
|
330
|
+
|
|
331
|
+
# Step 1: Get board details
|
|
332
|
+
query_response = client.board.query(
|
|
333
|
+
args: { ids: [board_id] },
|
|
334
|
+
select: ["id", "name", "description", { items: ["id"] }]
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
unless query_response.success?
|
|
338
|
+
puts "❌ Board not found"
|
|
339
|
+
exit
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
board = query_response.body.dig("data", "boards", 0)
|
|
343
|
+
|
|
344
|
+
# Step 2: Show board info
|
|
345
|
+
puts "\n📋 Board Information"
|
|
346
|
+
puts "=" * 50
|
|
347
|
+
puts "Name: #{board['name']}"
|
|
348
|
+
puts "ID: #{board['id']}"
|
|
349
|
+
puts "Items: #{board['items'].length}"
|
|
350
|
+
puts "Description: #{board['description']}" if board['description']
|
|
351
|
+
puts "=" * 50
|
|
352
|
+
|
|
353
|
+
# Step 3: Choose action
|
|
354
|
+
puts "\nWhat would you like to do?"
|
|
355
|
+
puts "1. Archive (reversible)"
|
|
356
|
+
puts "2. Delete (permanent)"
|
|
357
|
+
puts "3. Cancel"
|
|
358
|
+
print "\nChoice: "
|
|
359
|
+
|
|
360
|
+
choice = gets.chomp.to_i
|
|
361
|
+
|
|
362
|
+
case choice
|
|
363
|
+
when 1
|
|
364
|
+
# Archive
|
|
365
|
+
response = client.board.archive(board_id)
|
|
366
|
+
|
|
367
|
+
if response.success?
|
|
368
|
+
puts "\n✓ Board archived successfully"
|
|
369
|
+
puts " You can restore it from the Archive in monday.com"
|
|
370
|
+
else
|
|
371
|
+
puts "\n✗ Archive failed"
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
when 2
|
|
375
|
+
# Delete
|
|
376
|
+
puts "\n⚠️ WARNING: This will permanently delete '#{board['name']}'"
|
|
377
|
+
puts "This action cannot be undone!"
|
|
378
|
+
print "Type 'DELETE' to confirm: "
|
|
379
|
+
|
|
380
|
+
if gets.chomp == "DELETE"
|
|
381
|
+
response = client.board.delete(board_id)
|
|
382
|
+
|
|
383
|
+
if response.success?
|
|
384
|
+
puts "\n✓ Board permanently deleted"
|
|
385
|
+
else
|
|
386
|
+
puts "\n✗ Delete failed"
|
|
387
|
+
end
|
|
388
|
+
else
|
|
389
|
+
puts "\n❌ Delete cancelled"
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
when 3
|
|
393
|
+
puts "\n❌ Operation cancelled"
|
|
394
|
+
|
|
395
|
+
else
|
|
396
|
+
puts "\n❌ Invalid choice"
|
|
397
|
+
end
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Next Steps
|
|
401
|
+
|
|
402
|
+
- [Create new boards](/guides/boards/create)
|
|
403
|
+
- [Duplicate boards](/guides/boards/duplicate)
|
|
404
|
+
- [Query archived boards](/guides/boards/query)
|
|
405
|
+
- [Understand error handling](/guides/advanced/errors)
|