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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -1
  3. data/.rubocop.yml +2 -1
  4. data/CHANGELOG.md +14 -0
  5. data/CONTRIBUTING.md +104 -0
  6. data/README.md +146 -142
  7. data/docs/.vitepress/config.mjs +255 -0
  8. data/docs/.vitepress/theme/index.js +4 -0
  9. data/docs/.vitepress/theme/style.css +43 -0
  10. data/docs/README.md +80 -0
  11. data/docs/explanation/architecture.md +507 -0
  12. data/docs/explanation/best-practices/errors.md +478 -0
  13. data/docs/explanation/best-practices/performance.md +1084 -0
  14. data/docs/explanation/best-practices/rate-limiting.md +630 -0
  15. data/docs/explanation/best-practices/testing.md +820 -0
  16. data/docs/explanation/column-values.md +857 -0
  17. data/docs/explanation/design.md +795 -0
  18. data/docs/explanation/graphql.md +356 -0
  19. data/docs/explanation/migration/v1.md +808 -0
  20. data/docs/explanation/pagination.md +447 -0
  21. data/docs/guides/advanced/batch.md +1274 -0
  22. data/docs/guides/advanced/complex-queries.md +1114 -0
  23. data/docs/guides/advanced/errors.md +818 -0
  24. data/docs/guides/advanced/pagination.md +934 -0
  25. data/docs/guides/advanced/rate-limiting.md +981 -0
  26. data/docs/guides/authentication.md +286 -0
  27. data/docs/guides/boards/create.md +386 -0
  28. data/docs/guides/boards/delete.md +405 -0
  29. data/docs/guides/boards/duplicate.md +511 -0
  30. data/docs/guides/boards/query.md +530 -0
  31. data/docs/guides/boards/update.md +453 -0
  32. data/docs/guides/columns/create.md +452 -0
  33. data/docs/guides/columns/metadata.md +492 -0
  34. data/docs/guides/columns/query.md +455 -0
  35. data/docs/guides/columns/update-multiple.md +459 -0
  36. data/docs/guides/columns/update-values.md +509 -0
  37. data/docs/guides/files/add-to-column.md +40 -0
  38. data/docs/guides/files/add-to-update.md +37 -0
  39. data/docs/guides/files/clear-column.md +33 -0
  40. data/docs/guides/first-request.md +285 -0
  41. data/docs/guides/folders/manage.md +750 -0
  42. data/docs/guides/groups/items.md +626 -0
  43. data/docs/guides/groups/manage.md +501 -0
  44. data/docs/guides/installation.md +169 -0
  45. data/docs/guides/items/create.md +493 -0
  46. data/docs/guides/items/delete.md +514 -0
  47. data/docs/guides/items/query.md +605 -0
  48. data/docs/guides/items/subitems.md +483 -0
  49. data/docs/guides/items/update.md +699 -0
  50. data/docs/guides/updates/manage.md +619 -0
  51. data/docs/guides/use-cases/dashboard.md +1421 -0
  52. data/docs/guides/use-cases/import.md +1962 -0
  53. data/docs/guides/use-cases/task-management.md +1381 -0
  54. data/docs/guides/workspaces/manage.md +502 -0
  55. data/docs/index.md +69 -0
  56. data/docs/package-lock.json +2468 -0
  57. data/docs/package.json +13 -0
  58. data/docs/reference/client.md +540 -0
  59. data/docs/reference/configuration.md +586 -0
  60. data/docs/reference/errors.md +693 -0
  61. data/docs/reference/resources/account.md +208 -0
  62. data/docs/reference/resources/activity-log.md +369 -0
  63. data/docs/reference/resources/board-view.md +359 -0
  64. data/docs/reference/resources/board.md +393 -0
  65. data/docs/reference/resources/column.md +543 -0
  66. data/docs/reference/resources/file.md +236 -0
  67. data/docs/reference/resources/folder.md +386 -0
  68. data/docs/reference/resources/group.md +507 -0
  69. data/docs/reference/resources/item.md +348 -0
  70. data/docs/reference/resources/subitem.md +267 -0
  71. data/docs/reference/resources/update.md +259 -0
  72. data/docs/reference/resources/workspace.md +213 -0
  73. data/docs/reference/response.md +560 -0
  74. data/docs/tutorial/first-integration.md +713 -0
  75. data/lib/monday/client.rb +24 -0
  76. data/lib/monday/configuration.rb +5 -0
  77. data/lib/monday/request.rb +15 -0
  78. data/lib/monday/resources/base.rb +4 -0
  79. data/lib/monday/resources/file.rb +56 -0
  80. data/lib/monday/util.rb +1 -0
  81. data/lib/monday/version.rb +1 -1
  82. metadata +87 -4
@@ -0,0 +1,459 @@
1
+ # Update Multiple Column Values
2
+
3
+ Update several column values at once for better performance and efficiency.
4
+
5
+ ## Finding Column IDs
6
+
7
+ ::: 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>Column IDs are Board-Specific</span>
8
+ **Before updating column values, you must find your board's actual column IDs.** See the [Items Create guide](/guides/items/create#finding-column-ids) for how to query column IDs.
9
+ :::
10
+
11
+ ## Basic Multiple Update
12
+
13
+ Update several columns in a single API call:
14
+
15
+ ```ruby
16
+ require "monday_ruby"
17
+ require "json"
18
+
19
+ Monday.configure do |config|
20
+ config.token = ENV["MONDAY_TOKEN"]
21
+ end
22
+
23
+ client = Monday::Client.new
24
+
25
+ # ⚠️ Replace all column IDs with your board's actual column IDs
26
+ column_values = {
27
+ status: { label: "Working on it" }, # Your status column ID
28
+ text: "High priority task", # Your text column ID
29
+ numbers: 85 # Your numbers column ID
30
+ }
31
+
32
+ response = client.column.change_multiple_values(
33
+ args: {
34
+ board_id: 1234567890,
35
+ item_id: 987654321,
36
+ column_values: JSON.generate(column_values)
37
+ }
38
+ )
39
+
40
+ if response.success?
41
+ item = response.body.dig("data", "change_multiple_column_values")
42
+ puts "✓ Updated multiple columns for: #{item['name']}"
43
+ else
44
+ puts "✗ Failed to update columns"
45
+ end
46
+ ```
47
+
48
+ **Output:**
49
+ ```
50
+ ✓ Updated multiple columns for: Marketing Campaign
51
+ ```
52
+
53
+ ::: 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>Performance Benefit</span>
54
+ Updating multiple columns at once is more efficient than making separate API calls for each column. It also ensures atomicity - all updates succeed or fail together.
55
+ :::
56
+
57
+ ## Update Mixed Column Types
58
+
59
+ Combine simple and complex column types:
60
+
61
+ ```ruby
62
+ # ⚠️ Replace all column IDs with your board's actual column IDs
63
+ column_values = {
64
+ status: { # Status column
65
+ label: "Done"
66
+ },
67
+ text: "Completed successfully", # Text column
68
+ date4: { # Date column
69
+ date: "2024-12-31",
70
+ time: "17:00:00"
71
+ },
72
+ people: { # People column
73
+ personsAndTeams: [
74
+ { id: 12345678, kind: "person" } # Replace with actual user ID
75
+ ]
76
+ },
77
+ numbers: 100, # Numbers column
78
+ checkbox: { # Checkbox column
79
+ checked: "true"
80
+ }
81
+ }
82
+
83
+ response = client.column.change_multiple_values(
84
+ args: {
85
+ board_id: 1234567890,
86
+ item_id: 987654321,
87
+ column_values: JSON.generate(column_values)
88
+ }
89
+ )
90
+ ```
91
+
92
+ ## Update Item with Full Details
93
+
94
+ Set all relevant columns when creating or updating an item:
95
+
96
+ ```ruby
97
+ def update_task_complete(client, board_id, item_id)
98
+ # ⚠️ Replace all column IDs with your board's actual column IDs
99
+ column_values = {
100
+ status: {
101
+ label: "Done"
102
+ },
103
+ date4: {
104
+ date: Date.today.to_s
105
+ },
106
+ text: "Task completed on time",
107
+ numbers: 100 # 100% complete
108
+ }
109
+
110
+ response = client.column.change_multiple_values(
111
+ args: {
112
+ board_id: board_id,
113
+ item_id: item_id,
114
+ column_values: JSON.generate(column_values)
115
+ }
116
+ )
117
+
118
+ if response.success?
119
+ item = response.body.dig("data", "change_multiple_column_values")
120
+ puts "✓ Task marked complete: #{item['name']}"
121
+ true
122
+ else
123
+ puts "✗ Failed to update task"
124
+ false
125
+ end
126
+ end
127
+
128
+ # Usage
129
+ update_task_complete(client, 1234567890, 987654321)
130
+ ```
131
+
132
+ ## Bulk Update Multiple Items
133
+
134
+ Update the same columns for multiple items:
135
+
136
+ ```ruby
137
+ def bulk_update_items(client, board_id, item_ids, column_values)
138
+ updated_count = 0
139
+
140
+ item_ids.each do |item_id|
141
+ response = client.column.change_multiple_values(
142
+ args: {
143
+ board_id: board_id,
144
+ item_id: item_id,
145
+ column_values: JSON.generate(column_values)
146
+ }
147
+ )
148
+
149
+ if response.success?
150
+ item = response.body.dig("data", "change_multiple_column_values")
151
+ updated_count += 1
152
+ puts "✓ Updated: #{item['name']}"
153
+ else
154
+ puts "✗ Failed to update item #{item_id}"
155
+ end
156
+
157
+ sleep(0.3) # Rate limiting
158
+ end
159
+
160
+ updated_count
161
+ end
162
+
163
+ # Usage: Mark multiple tasks as complete
164
+ # ⚠️ Replace column IDs with your actual column IDs
165
+ item_ids = [987654321, 987654322, 987654323]
166
+ values = {
167
+ status: { label: "Done" },
168
+ date4: { date: Date.today.to_s },
169
+ text: "Batch completed"
170
+ }
171
+
172
+ count = bulk_update_items(client, 1234567890, item_ids, values)
173
+ puts "\n✓ Updated #{count} items"
174
+ ```
175
+
176
+ ## Update with Conditional Logic
177
+
178
+ Update columns based on current values or conditions:
179
+
180
+ ```ruby
181
+ def update_if_in_progress(client, board_id, item_id)
182
+ # First, get current item
183
+ query_response = client.item.query(
184
+ args: { ids: [item_id] },
185
+ select: [
186
+ "id",
187
+ "name",
188
+ {
189
+ column_values: ["id", "text"]
190
+ }
191
+ ]
192
+ )
193
+
194
+ return false unless query_response.success?
195
+
196
+ item = query_response.body.dig("data", "items", 0)
197
+ status = item["column_values"].find { |cv| cv["id"] == "status" }
198
+
199
+ # Only update if status is "In Progress"
200
+ return false unless status&.dig("text") == "Working on it"
201
+
202
+ # Update to next stage
203
+ # ⚠️ Replace column IDs with your actual column IDs
204
+ column_values = {
205
+ status: { label: "Review" },
206
+ text: "Ready for review",
207
+ date4: { date: Date.today.to_s }
208
+ }
209
+
210
+ update_response = client.column.change_multiple_values(
211
+ args: {
212
+ board_id: board_id,
213
+ item_id: item_id,
214
+ column_values: JSON.generate(column_values)
215
+ }
216
+ )
217
+
218
+ update_response.success?
219
+ end
220
+
221
+ # Usage
222
+ if update_if_in_progress(client, 1234567890, 987654321)
223
+ puts "✓ Task moved to review"
224
+ else
225
+ puts "Task not in progress or update failed"
226
+ end
227
+ ```
228
+
229
+ ## Get Updated Column Values
230
+
231
+ Retrieve updated values after the change:
232
+
233
+ ```ruby
234
+ response = client.column.change_multiple_values(
235
+ args: {
236
+ board_id: 1234567890,
237
+ item_id: 987654321,
238
+ column_values: JSON.generate({
239
+ status: { label: "Done" }, # ⚠️ Your column IDs
240
+ text: "Completed",
241
+ numbers: 100
242
+ })
243
+ },
244
+ select: [
245
+ "id",
246
+ "name",
247
+ "state",
248
+ {
249
+ column_values: ["id", "text", "type", "value"]
250
+ }
251
+ ]
252
+ )
253
+
254
+ if response.success?
255
+ item = response.body.dig("data", "change_multiple_column_values")
256
+
257
+ puts "Updated: #{item['name']}"
258
+ puts "\nColumn Values:"
259
+
260
+ item["column_values"].each do |col_val|
261
+ next if col_val["text"].nil? || col_val["text"].empty?
262
+ puts " • #{col_val['id']}: #{col_val['text']} (#{col_val['type']})"
263
+ end
264
+ end
265
+ ```
266
+
267
+ ## Error Handling
268
+
269
+ Handle update errors gracefully:
270
+
271
+ ```ruby
272
+ def update_columns_safe(client, board_id, item_id, column_values)
273
+ response = client.column.change_multiple_values(
274
+ args: {
275
+ board_id: board_id,
276
+ item_id: item_id,
277
+ column_values: JSON.generate(column_values)
278
+ }
279
+ )
280
+
281
+ if response.success?
282
+ item = response.body.dig("data", "change_multiple_column_values")
283
+ puts "✓ Updated: #{item['name']}"
284
+ true
285
+ else
286
+ puts "✗ Failed to update columns"
287
+ puts " Status: #{response.status}"
288
+
289
+ if response.body["errors"]
290
+ response.body["errors"].each do |error|
291
+ puts " Error: #{error['message']}"
292
+ end
293
+ end
294
+
295
+ false
296
+ end
297
+ rescue Monday::AuthorizationError
298
+ puts "✗ Invalid API token"
299
+ false
300
+ rescue Monday::InvalidRequestError => e
301
+ puts "✗ Invalid request: #{e.message}"
302
+ false
303
+ rescue Monday::Error => e
304
+ puts "✗ API error: #{e.message}"
305
+ false
306
+ end
307
+
308
+ # Usage
309
+ values = {
310
+ status: { label: "Done" },
311
+ text: "Task complete"
312
+ }
313
+
314
+ success = update_columns_safe(client, 1234567890, 987654321, values)
315
+ ```
316
+
317
+ ## Clear Multiple Columns
318
+
319
+ Remove values from several columns at once:
320
+
321
+ ```ruby
322
+ # ⚠️ Replace column IDs with your actual column IDs
323
+ column_values = {
324
+ status: {}, # Empty object clears the value
325
+ text: "", # Empty string for text columns
326
+ date4: {},
327
+ people: {}
328
+ }
329
+
330
+ response = client.column.change_multiple_values(
331
+ args: {
332
+ board_id: 1234567890,
333
+ item_id: 987654321,
334
+ column_values: JSON.generate(column_values)
335
+ }
336
+ )
337
+
338
+ if response.success?
339
+ puts "✓ Multiple columns cleared"
340
+ end
341
+ ```
342
+
343
+ ## Complete Example
344
+
345
+ Update item with full workflow transition:
346
+
347
+ ```ruby
348
+ require "monday_ruby"
349
+ require "dotenv/load"
350
+ require "json"
351
+ require "date"
352
+
353
+ Monday.configure do |config|
354
+ config.token = ENV["MONDAY_TOKEN"]
355
+ end
356
+
357
+ client = Monday::Client.new
358
+
359
+ def transition_to_qa(client, board_id, item_id, assignee_id)
360
+ # IMPORTANT: Replace all column IDs with your board's actual column IDs
361
+
362
+ column_values = {
363
+ status: { # ⚠️ Your status column ID
364
+ label: "QA Testing"
365
+ },
366
+ people: { # ⚠️ Your people column ID
367
+ personsAndTeams: [
368
+ { id: assignee_id, kind: "person" }
369
+ ]
370
+ },
371
+ date4: { # ⚠️ Your date column ID
372
+ date: (Date.today + 3).to_s # Due in 3 days
373
+ },
374
+ text: "Moved to QA for testing", # ⚠️ Your text column ID
375
+ numbers: 80 # ⚠️ Your numbers column ID (80% complete)
376
+ }
377
+
378
+ response = client.column.change_multiple_values(
379
+ args: {
380
+ board_id: board_id,
381
+ item_id: item_id,
382
+ column_values: JSON.generate(column_values)
383
+ },
384
+ select: [
385
+ "id",
386
+ "name",
387
+ {
388
+ column_values: ["id", "text"]
389
+ }
390
+ ]
391
+ )
392
+
393
+ if response.success?
394
+ item = response.body.dig("data", "change_multiple_column_values")
395
+
396
+ puts "\n✓ Item Transitioned to QA\n#{'=' * 50}"
397
+ puts "Item: #{item['name']}"
398
+ puts "Updated Values:"
399
+
400
+ item["column_values"].each do |col|
401
+ next if col["text"].nil? || col["text"].empty?
402
+ puts " • #{col['id']}: #{col['text']}"
403
+ end
404
+
405
+ puts "#{'=' * 50}"
406
+ true
407
+ else
408
+ puts "✗ Failed to transition item"
409
+ false
410
+ end
411
+ end
412
+
413
+ # Usage
414
+ success = transition_to_qa(
415
+ client,
416
+ 1234567890, # board_id
417
+ 987654321, # item_id
418
+ 12345678 # assignee_id - replace with actual user ID
419
+ )
420
+ ```
421
+
422
+ **Output:**
423
+ ```
424
+ ✓ Item Transitioned to QA
425
+ ==================================================
426
+ Item: Feature Development
427
+ Updated Values:
428
+ • status: QA Testing
429
+ • people: John Doe
430
+ • date4: 2024-12-15
431
+ • text: Moved to QA for testing
432
+ • numbers: 80
433
+ ==================================================
434
+ ```
435
+
436
+ ## Best Practices
437
+
438
+ ### Do's
439
+
440
+ - ✅ Update multiple related columns together
441
+ - ✅ Use JSON.generate for all column values
442
+ - ✅ Include rate limiting delays in loops
443
+ - ✅ Verify column IDs before updating
444
+ - ✅ Handle errors appropriately
445
+
446
+ ### Don'ts
447
+
448
+ - ❌ Update columns one-by-one when you can batch them
449
+ - ❌ Hardcode column IDs without verification
450
+ - ❌ Skip error handling
451
+ - ❌ Update too many items without rate limiting
452
+ - ❌ Mix up column IDs between boards
453
+
454
+ ## Next Steps
455
+
456
+ - [Update single column value](/guides/columns/update-values)
457
+ - [Query column values](/guides/columns/query)
458
+ - [Create columns](/guides/columns/create)
459
+ - [Batch operations](/guides/advanced/batch)