monday_ruby 1.0.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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -1
  3. data/.rspec +0 -1
  4. data/.rubocop.yml +19 -0
  5. data/.simplecov +1 -0
  6. data/CHANGELOG.md +49 -0
  7. data/CONTRIBUTING.md +165 -0
  8. data/README.md +167 -88
  9. data/docs/.vitepress/config.mjs +255 -0
  10. data/docs/.vitepress/theme/index.js +4 -0
  11. data/docs/.vitepress/theme/style.css +43 -0
  12. data/docs/README.md +80 -0
  13. data/docs/explanation/architecture.md +507 -0
  14. data/docs/explanation/best-practices/errors.md +478 -0
  15. data/docs/explanation/best-practices/performance.md +1084 -0
  16. data/docs/explanation/best-practices/rate-limiting.md +630 -0
  17. data/docs/explanation/best-practices/testing.md +820 -0
  18. data/docs/explanation/column-values.md +857 -0
  19. data/docs/explanation/design.md +795 -0
  20. data/docs/explanation/graphql.md +356 -0
  21. data/docs/explanation/migration/v1.md +808 -0
  22. data/docs/explanation/pagination.md +447 -0
  23. data/docs/guides/advanced/batch.md +1274 -0
  24. data/docs/guides/advanced/complex-queries.md +1114 -0
  25. data/docs/guides/advanced/errors.md +818 -0
  26. data/docs/guides/advanced/pagination.md +934 -0
  27. data/docs/guides/advanced/rate-limiting.md +981 -0
  28. data/docs/guides/authentication.md +286 -0
  29. data/docs/guides/boards/create.md +386 -0
  30. data/docs/guides/boards/delete.md +405 -0
  31. data/docs/guides/boards/duplicate.md +511 -0
  32. data/docs/guides/boards/query.md +530 -0
  33. data/docs/guides/boards/update.md +453 -0
  34. data/docs/guides/columns/create.md +452 -0
  35. data/docs/guides/columns/metadata.md +492 -0
  36. data/docs/guides/columns/query.md +455 -0
  37. data/docs/guides/columns/update-multiple.md +459 -0
  38. data/docs/guides/columns/update-values.md +509 -0
  39. data/docs/guides/files/add-to-column.md +40 -0
  40. data/docs/guides/files/add-to-update.md +37 -0
  41. data/docs/guides/files/clear-column.md +33 -0
  42. data/docs/guides/first-request.md +285 -0
  43. data/docs/guides/folders/manage.md +750 -0
  44. data/docs/guides/groups/items.md +626 -0
  45. data/docs/guides/groups/manage.md +501 -0
  46. data/docs/guides/installation.md +169 -0
  47. data/docs/guides/items/create.md +493 -0
  48. data/docs/guides/items/delete.md +514 -0
  49. data/docs/guides/items/query.md +605 -0
  50. data/docs/guides/items/subitems.md +483 -0
  51. data/docs/guides/items/update.md +699 -0
  52. data/docs/guides/updates/manage.md +619 -0
  53. data/docs/guides/use-cases/dashboard.md +1421 -0
  54. data/docs/guides/use-cases/import.md +1962 -0
  55. data/docs/guides/use-cases/task-management.md +1381 -0
  56. data/docs/guides/workspaces/manage.md +502 -0
  57. data/docs/index.md +69 -0
  58. data/docs/package-lock.json +2468 -0
  59. data/docs/package.json +13 -0
  60. data/docs/reference/client.md +540 -0
  61. data/docs/reference/configuration.md +586 -0
  62. data/docs/reference/errors.md +693 -0
  63. data/docs/reference/resources/account.md +208 -0
  64. data/docs/reference/resources/activity-log.md +369 -0
  65. data/docs/reference/resources/board-view.md +359 -0
  66. data/docs/reference/resources/board.md +393 -0
  67. data/docs/reference/resources/column.md +543 -0
  68. data/docs/reference/resources/file.md +236 -0
  69. data/docs/reference/resources/folder.md +386 -0
  70. data/docs/reference/resources/group.md +507 -0
  71. data/docs/reference/resources/item.md +348 -0
  72. data/docs/reference/resources/subitem.md +267 -0
  73. data/docs/reference/resources/update.md +259 -0
  74. data/docs/reference/resources/workspace.md +213 -0
  75. data/docs/reference/response.md +560 -0
  76. data/docs/tutorial/first-integration.md +713 -0
  77. data/lib/monday/client.rb +41 -2
  78. data/lib/monday/configuration.rb +13 -0
  79. data/lib/monday/deprecation.rb +23 -0
  80. data/lib/monday/error.rb +5 -2
  81. data/lib/monday/request.rb +19 -1
  82. data/lib/monday/resources/base.rb +4 -0
  83. data/lib/monday/resources/board.rb +52 -0
  84. data/lib/monday/resources/column.rb +6 -0
  85. data/lib/monday/resources/file.rb +56 -0
  86. data/lib/monday/resources/folder.rb +55 -0
  87. data/lib/monday/resources/group.rb +66 -0
  88. data/lib/monday/resources/item.rb +62 -0
  89. data/lib/monday/util.rb +33 -1
  90. data/lib/monday/version.rb +1 -1
  91. data/lib/monday_ruby.rb +1 -0
  92. metadata +92 -11
  93. data/monday_ruby.gemspec +0 -39
@@ -0,0 +1,492 @@
1
+ # Change Column Metadata
2
+
3
+ Update column settings, titles, and configuration.
4
+
5
+ ## Change Column Title
6
+
7
+ Rename a column:
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
+ response = client.column.change_title(
19
+ args: {
20
+ board_id: 1234567890,
21
+ column_id: "text_1", # The column's ID
22
+ title: "Project Notes" # New title
23
+ }
24
+ )
25
+
26
+ if response.success?
27
+ column = response.body.dig("data", "change_column_title")
28
+ puts "āœ“ Column renamed to: #{column['title']}"
29
+ else
30
+ puts "āœ— Failed to rename column"
31
+ end
32
+ ```
33
+
34
+ **Output:**
35
+ ```
36
+ āœ“ Column renamed to: Project Notes
37
+ ```
38
+
39
+ ## Change Column Metadata
40
+
41
+ Update column settings and configuration:
42
+
43
+ ```ruby
44
+ require "json"
45
+
46
+ # Update column description
47
+ response = client.column.change_metadata(
48
+ args: {
49
+ board_id: 1234567890,
50
+ column_id: "status",
51
+ column_property: "description",
52
+ value: "Current task status (Not Started, In Progress, Done)"
53
+ }
54
+ )
55
+
56
+ if response.success?
57
+ column = response.body.dig("data", "change_column_metadata")
58
+ puts "āœ“ Column metadata updated"
59
+ end
60
+ ```
61
+
62
+ ## Update Column Description
63
+
64
+ Add or update a column's description:
65
+
66
+ ```ruby
67
+ def update_column_description(client, board_id, column_id, description)
68
+ response = client.column.change_metadata(
69
+ args: {
70
+ board_id: board_id,
71
+ column_id: column_id,
72
+ column_property: "description",
73
+ value: description
74
+ }
75
+ )
76
+
77
+ if response.success?
78
+ column = response.body.dig("data", "change_column_metadata")
79
+ puts "āœ“ Description updated for: #{column['title']}"
80
+ true
81
+ else
82
+ puts "āœ— Failed to update description"
83
+ false
84
+ end
85
+ end
86
+
87
+ # Usage
88
+ update_column_description(
89
+ client,
90
+ 1234567890,
91
+ "status",
92
+ "Track task completion status"
93
+ )
94
+ ```
95
+
96
+ ## Update Status Column Labels
97
+
98
+ Configure status (color) column labels:
99
+
100
+ ```ruby
101
+ # First, get current column settings
102
+ query_response = client.column.query(
103
+ args: { ids: [1234567890] },
104
+ select: ["id", "title", "settings_str"]
105
+ )
106
+
107
+ boards = query_response.body.dig("data", "boards")
108
+ columns = boards.first&.dig("columns") || []
109
+ status_column = columns.find { |col| col["id"] == "status" }
110
+
111
+ # Parse current settings
112
+ current_settings = JSON.parse(status_column["settings_str"])
113
+
114
+ # Modify labels
115
+ current_settings["labels"] = {
116
+ "0" => "Not Started",
117
+ "1" => "In Progress",
118
+ "2" => "Review",
119
+ "3" => "Done",
120
+ "4" => "Archived"
121
+ }
122
+
123
+ # Update column metadata
124
+ response = client.column.change_metadata(
125
+ args: {
126
+ board_id: 1234567890,
127
+ column_id: "status",
128
+ column_property: "labels",
129
+ value: JSON.generate(current_settings["labels"])
130
+ }
131
+ )
132
+
133
+ if response.success?
134
+ puts "āœ“ Status labels updated"
135
+ end
136
+ ```
137
+
138
+ ::: 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>Column Settings</span>
139
+ Different column types have different metadata properties. Use `column.query` with `settings_str` to see available options for each column type.
140
+ :::
141
+
142
+ ## Rename Multiple Columns
143
+
144
+ Update titles for several columns:
145
+
146
+ ```ruby
147
+ def rename_columns(client, board_id, renames)
148
+ updated_count = 0
149
+
150
+ renames.each do |column_id, new_title|
151
+ response = client.column.change_title(
152
+ args: {
153
+ board_id: board_id,
154
+ column_id: column_id,
155
+ title: new_title
156
+ }
157
+ )
158
+
159
+ if response.success?
160
+ column = response.body.dig("data", "change_column_title")
161
+ updated_count += 1
162
+ puts "āœ“ Renamed: #{column['title']}"
163
+ else
164
+ puts "āœ— Failed to rename: #{column_id}"
165
+ end
166
+
167
+ sleep(0.3) # Rate limiting
168
+ end
169
+
170
+ updated_count
171
+ end
172
+
173
+ # Usage
174
+ renames = {
175
+ "text" => "Task Description",
176
+ "numbers" => "Estimated Hours",
177
+ "date4" => "Target Completion"
178
+ }
179
+
180
+ count = rename_columns(client, 1234567890, renames)
181
+ puts "\nāœ“ Renamed #{count} columns"
182
+ ```
183
+
184
+ ## Update Dropdown Options
185
+
186
+ Modify dropdown column options:
187
+
188
+ ```ruby
189
+ require "json"
190
+
191
+ # Define new dropdown options
192
+ dropdown_labels = {
193
+ "1" => "High Priority",
194
+ "2" => "Medium Priority",
195
+ "3" => "Low Priority",
196
+ "4" => "No Priority"
197
+ }
198
+
199
+ response = client.column.change_metadata(
200
+ args: {
201
+ board_id: 1234567890,
202
+ column_id: "dropdown",
203
+ column_property: "labels",
204
+ value: JSON.generate(dropdown_labels)
205
+ }
206
+ )
207
+
208
+ if response.success?
209
+ puts "āœ“ Dropdown options updated"
210
+ end
211
+ ```
212
+
213
+ ## Add Column Descriptions in Bulk
214
+
215
+ Add helpful descriptions to all columns:
216
+
217
+ ```ruby
218
+ def add_column_descriptions(client, board_id, descriptions)
219
+ updated_count = 0
220
+
221
+ descriptions.each do |column_id, description|
222
+ response = client.column.change_metadata(
223
+ args: {
224
+ board_id: board_id,
225
+ column_id: column_id,
226
+ column_property: "description",
227
+ value: description
228
+ }
229
+ )
230
+
231
+ if response.success?
232
+ updated_count += 1
233
+ puts "āœ“ Updated: #{column_id}"
234
+ else
235
+ puts "āœ— Failed: #{column_id}"
236
+ end
237
+
238
+ sleep(0.3)
239
+ end
240
+
241
+ updated_count
242
+ end
243
+
244
+ # Usage
245
+ descriptions = {
246
+ "status" => "Current status of the task",
247
+ "people" => "Person responsible for this task",
248
+ "date4" => "When this task is due",
249
+ "numbers" => "Estimated budget in USD"
250
+ }
251
+
252
+ count = add_column_descriptions(client, 1234567890, descriptions)
253
+ puts "\nāœ“ Added descriptions to #{count} columns"
254
+ ```
255
+
256
+ ## Error Handling
257
+
258
+ Handle metadata update errors:
259
+
260
+ ```ruby
261
+ def change_column_title_safe(client, board_id, column_id, new_title)
262
+ response = client.column.change_title(
263
+ args: {
264
+ board_id: board_id,
265
+ column_id: column_id,
266
+ title: new_title
267
+ }
268
+ )
269
+
270
+ if response.success?
271
+ column = response.body.dig("data", "change_column_title")
272
+ puts "āœ“ Renamed to: #{column['title']}"
273
+ true
274
+ else
275
+ puts "āœ— Failed to rename column"
276
+ puts " Status: #{response.status}"
277
+
278
+ if response.body["errors"]
279
+ response.body["errors"].each do |error|
280
+ puts " Error: #{error['message']}"
281
+ end
282
+ end
283
+
284
+ false
285
+ end
286
+ rescue Monday::AuthorizationError
287
+ puts "āœ— Invalid API token"
288
+ false
289
+ rescue Monday::InvalidRequestError => e
290
+ puts "āœ— Invalid request: #{e.message}"
291
+ false
292
+ rescue Monday::Error => e
293
+ puts "āœ— API error: #{e.message}"
294
+ false
295
+ end
296
+
297
+ # Usage
298
+ success = change_column_title_safe(
299
+ client,
300
+ 1234567890,
301
+ "text",
302
+ "New Column Name"
303
+ )
304
+ ```
305
+
306
+ ## Get Updated Column Info
307
+
308
+ Retrieve column details after update:
309
+
310
+ ```ruby
311
+ response = client.column.change_title(
312
+ args: {
313
+ board_id: 1234567890,
314
+ column_id: "text",
315
+ title: "Project Description"
316
+ },
317
+ select: [
318
+ "id",
319
+ "title",
320
+ "description",
321
+ "type",
322
+ "settings_str"
323
+ ]
324
+ )
325
+
326
+ if response.success?
327
+ column = response.body.dig("data", "change_column_title")
328
+
329
+ puts "Column Updated:"
330
+ puts " ID: #{column['id']}"
331
+ puts " Title: #{column['title']}"
332
+ puts " Type: #{column['type']}"
333
+ puts " Description: #{column['description']}" if column['description']
334
+ end
335
+ ```
336
+
337
+ ## Complete Example
338
+
339
+ Set up complete column metadata:
340
+
341
+ ```ruby
342
+ require "monday_ruby"
343
+ require "dotenv/load"
344
+ require "json"
345
+
346
+ Monday.configure do |config|
347
+ config.token = ENV["MONDAY_TOKEN"]
348
+ end
349
+
350
+ client = Monday::Client.new
351
+
352
+ board_id = 1234567890
353
+
354
+ puts "\nšŸ“ Configuring Board Columns\n#{'=' * 50}\n"
355
+
356
+ # 1. Rename columns
357
+ column_renames = {
358
+ "text" => "Task Description",
359
+ "numbers" => "Budget (USD)",
360
+ "status" => "Task Status"
361
+ }
362
+
363
+ puts "Renaming columns..."
364
+ column_renames.each do |column_id, new_title|
365
+ response = client.column.change_title(
366
+ args: {
367
+ board_id: board_id,
368
+ column_id: column_id,
369
+ title: new_title
370
+ }
371
+ )
372
+
373
+ if response.success?
374
+ puts " āœ“ #{column_id} → #{new_title}"
375
+ end
376
+
377
+ sleep(0.3)
378
+ end
379
+
380
+ # 2. Add descriptions
381
+ column_descriptions = {
382
+ "text" => "Detailed description of the task and requirements",
383
+ "numbers" => "Estimated budget in US Dollars",
384
+ "status" => "Current completion status of the task",
385
+ "people" => "Team member assigned to this task",
386
+ "date4" => "Target completion date for this task"
387
+ }
388
+
389
+ puts "\nAdding descriptions..."
390
+ column_descriptions.each do |column_id, description|
391
+ response = client.column.change_metadata(
392
+ args: {
393
+ board_id: board_id,
394
+ column_id: column_id,
395
+ column_property: "description",
396
+ value: description
397
+ }
398
+ )
399
+
400
+ if response.success?
401
+ puts " āœ“ #{column_id}"
402
+ end
403
+
404
+ sleep(0.3)
405
+ end
406
+
407
+ # 3. Configure status labels
408
+ puts "\nConfiguring status labels..."
409
+ status_labels = {
410
+ "0" => "Not Started",
411
+ "1" => "Planning",
412
+ "2" => "In Progress",
413
+ "3" => "Review",
414
+ "4" => "Done"
415
+ }
416
+
417
+ response = client.column.change_metadata(
418
+ args: {
419
+ board_id: board_id,
420
+ column_id: "status",
421
+ column_property: "labels",
422
+ value: JSON.generate(status_labels)
423
+ }
424
+ )
425
+
426
+ if response.success?
427
+ puts " āœ“ Status labels configured"
428
+ end
429
+
430
+ puts "\n#{'=' * 50}"
431
+ puts "āœ“ Column configuration complete"
432
+ puts "#{'=' * 50}"
433
+ ```
434
+
435
+ **Output:**
436
+ ```
437
+ šŸ“ Configuring Board Columns
438
+ ==================================================
439
+
440
+ Renaming columns...
441
+ āœ“ text → Task Description
442
+ āœ“ numbers → Budget (USD)
443
+ āœ“ status → Task Status
444
+
445
+ Adding descriptions...
446
+ āœ“ text
447
+ āœ“ numbers
448
+ āœ“ status
449
+ āœ“ people
450
+ āœ“ date4
451
+
452
+ Configuring status labels...
453
+ āœ“ Status labels configured
454
+
455
+ ==================================================
456
+ āœ“ Column configuration complete
457
+ ==================================================
458
+ ```
459
+
460
+ ## Validate Column Title
461
+
462
+ Check for valid column titles before updating:
463
+
464
+ ```ruby
465
+ def valid_column_title?(title)
466
+ return false if title.nil? || title.empty?
467
+ return false if title.length > 255
468
+
469
+ true
470
+ end
471
+
472
+ new_title = "Updated Column Name"
473
+
474
+ if valid_column_title?(new_title)
475
+ response = client.column.change_title(
476
+ args: {
477
+ board_id: 1234567890,
478
+ column_id: "text",
479
+ title: new_title
480
+ }
481
+ )
482
+ else
483
+ puts "Invalid column title"
484
+ end
485
+ ```
486
+
487
+ ## Next Steps
488
+
489
+ - [Create columns](/guides/columns/create)
490
+ - [Update column values](/guides/columns/update-values)
491
+ - [Query column values](/guides/columns/query)
492
+ - [Query boards](/guides/boards/query)