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,455 @@
1
+ # Query Column Values
2
+
3
+ Retrieve column information and values from your boards.
4
+
5
+ ## Query Board Columns
6
+
7
+ Get all columns for a board:
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.query(
19
+ args: { ids: [1234567890] } # Board ID
20
+ )
21
+
22
+ if response.success?
23
+ boards = response.body.dig("data", "boards")
24
+ columns = boards.first&.dig("columns") || []
25
+
26
+ puts "Found #{columns.length} columns:"
27
+ columns.each do |column|
28
+ puts " • #{column['title']}: '#{column['id']}' (#{column['type']})"
29
+ end
30
+ end
31
+ ```
32
+
33
+ **Output:**
34
+ ```
35
+ Found 7 columns:
36
+ • Name: 'name' (name)
37
+ • Status: 'status' (color)
38
+ • Owner: 'people' (people)
39
+ • Due Date: 'date4' (date)
40
+ • Priority: 'status_1' (color)
41
+ • Text: 'text' (text)
42
+ • Budget: 'numbers' (numbers)
43
+ ```
44
+
45
+ ## Query Column Details
46
+
47
+ Get detailed column information:
48
+
49
+ ```ruby
50
+ response = client.column.query(
51
+ args: { ids: [1234567890] },
52
+ select: [
53
+ "id",
54
+ "title",
55
+ "description",
56
+ "type",
57
+ "width",
58
+ "settings_str",
59
+ "archived"
60
+ ]
61
+ )
62
+
63
+ if response.success?
64
+ boards = response.body.dig("data", "boards")
65
+ columns = boards.first&.dig("columns") || []
66
+
67
+ columns.each do |column|
68
+ puts "\n#{column['title']}"
69
+ puts " ID: #{column['id']}"
70
+ puts " Type: #{column['type']}"
71
+ puts " Width: #{column['width']}"
72
+ puts " Archived: #{column['archived']}"
73
+ puts " Description: #{column['description']}" if column['description']
74
+ end
75
+ end
76
+ ```
77
+
78
+ ## Query Multiple Boards
79
+
80
+ Get columns for multiple boards:
81
+
82
+ ```ruby
83
+ response = client.column.query(
84
+ args: { ids: [1234567890, 2345678901] },
85
+ select: ["id", "title", "type"]
86
+ )
87
+
88
+ if response.success?
89
+ boards = response.body.dig("data", "boards")
90
+
91
+ boards.each do |board|
92
+ columns = board["columns"] || []
93
+ puts "\nBoard #{board['id']} has #{columns.length} columns"
94
+
95
+ columns.each do |column|
96
+ puts " • #{column['title']} (#{column['type']})"
97
+ end
98
+ end
99
+ end
100
+ ```
101
+
102
+ ## Find Column by Title
103
+
104
+ Search for a column by its title:
105
+
106
+ ```ruby
107
+ def find_column_by_title(client, board_id, title)
108
+ response = client.column.query(
109
+ args: { ids: [board_id] },
110
+ select: ["id", "title", "type"]
111
+ )
112
+
113
+ return nil unless response.success?
114
+
115
+ boards = response.body.dig("data", "boards")
116
+ columns = boards.first&.dig("columns") || []
117
+
118
+ columns.find { |col| col["title"].downcase == title.downcase }
119
+ end
120
+
121
+ # Usage
122
+ column = find_column_by_title(client, 1234567890, "Status")
123
+
124
+ if column
125
+ puts "Found: #{column['title']}"
126
+ puts " ID: #{column['id']}"
127
+ puts " Type: #{column['type']}"
128
+ else
129
+ puts "Column not found"
130
+ end
131
+ ```
132
+
133
+ ## Get Column ID by Title
134
+
135
+ Quickly get a column's ID:
136
+
137
+ ```ruby
138
+ def get_column_id(client, board_id, title)
139
+ column = find_column_by_title(client, board_id, title)
140
+ column&.dig("id")
141
+ end
142
+
143
+ # Usage
144
+ column_id = get_column_id(client, 1234567890, "Status")
145
+ puts "Status column ID: #{column_id}" # => status
146
+ ```
147
+
148
+ ## Filter Columns by Type
149
+
150
+ Find all columns of a specific type:
151
+
152
+ ```ruby
153
+ def find_columns_by_type(client, board_id, column_type)
154
+ response = client.column.query(
155
+ args: { ids: [board_id] },
156
+ select: ["id", "title", "type"]
157
+ )
158
+
159
+ return [] unless response.success?
160
+
161
+ boards = response.body.dig("data", "boards")
162
+ columns = boards.first&.dig("columns") || []
163
+
164
+ columns.select { |col| col["type"] == column_type }
165
+ end
166
+
167
+ # Find all status columns
168
+ status_columns = find_columns_by_type(client, 1234567890, "color")
169
+
170
+ puts "Found #{status_columns.length} status columns:"
171
+ status_columns.each do |col|
172
+ puts " • #{col['title']} (#{col['id']})"
173
+ end
174
+ ```
175
+
176
+ ## Query Column Values for Items
177
+
178
+ Get column values for specific items:
179
+
180
+ ```ruby
181
+ # Query items with their column values
182
+ response = client.item.query(
183
+ args: { ids: [987654321, 987654322] },
184
+ select: [
185
+ "id",
186
+ "name",
187
+ {
188
+ column_values: ["id", "text", "type", "value"]
189
+ }
190
+ ]
191
+ )
192
+
193
+ if response.success?
194
+ items = response.body.dig("data", "items")
195
+
196
+ items.each do |item|
197
+ puts "\n#{item['name']}"
198
+ puts "Column Values:"
199
+
200
+ item["column_values"].each do |col_val|
201
+ next if col_val["text"].nil? || col_val["text"].empty?
202
+ puts " • #{col_val['id']}: #{col_val['text']} (#{col_val['type']})"
203
+ end
204
+ end
205
+ end
206
+ ```
207
+
208
+ ## Parse Column Settings
209
+
210
+ Extract column settings (e.g., status labels):
211
+
212
+ ```ruby
213
+ require "json"
214
+
215
+ response = client.column.query(
216
+ args: { ids: [1234567890] },
217
+ select: ["id", "title", "type", "settings_str"]
218
+ )
219
+
220
+ if response.success?
221
+ boards = response.body.dig("data", "boards")
222
+ columns = boards.first&.dig("columns") || []
223
+
224
+ columns.each do |column|
225
+ next unless column["settings_str"]
226
+
227
+ settings = JSON.parse(column["settings_str"])
228
+
229
+ puts "\n#{column['title']} (#{column['type']})"
230
+ puts " Settings: #{settings.keys.join(', ')}"
231
+
232
+ # For status columns, show labels
233
+ if column["type"] == "color" && settings["labels"]
234
+ puts " Labels:"
235
+ settings["labels"].each do |id, label|
236
+ puts " #{id}: #{label}"
237
+ end
238
+ end
239
+ end
240
+ end
241
+ ```
242
+
243
+ ## Get Column Structure
244
+
245
+ Build a map of column IDs to titles:
246
+
247
+ ```ruby
248
+ def get_column_map(client, board_id)
249
+ response = client.column.query(
250
+ args: { ids: [board_id] },
251
+ select: ["id", "title", "type"]
252
+ )
253
+
254
+ return {} unless response.success?
255
+
256
+ boards = response.body.dig("data", "boards")
257
+ columns = boards.first&.dig("columns") || []
258
+
259
+ columns.each_with_object({}) do |col, hash|
260
+ hash[col["id"]] = {
261
+ title: col["title"],
262
+ type: col["type"]
263
+ }
264
+ end
265
+ end
266
+
267
+ # Usage
268
+ column_map = get_column_map(client, 1234567890)
269
+
270
+ puts "Column Map:"
271
+ column_map.each do |id, info|
272
+ puts " #{id} => #{info[:title]} (#{info[:type]})"
273
+ end
274
+ ```
275
+
276
+ ## Query Archived Columns
277
+
278
+ Find archived columns:
279
+
280
+ ```ruby
281
+ response = client.column.query(
282
+ args: { ids: [1234567890] },
283
+ select: ["id", "title", "type", "archived"]
284
+ )
285
+
286
+ if response.success?
287
+ boards = response.body.dig("data", "boards")
288
+ columns = boards.first&.dig("columns") || []
289
+
290
+ archived = columns.select { |col| col["archived"] }
291
+
292
+ if archived.any?
293
+ puts "Archived columns:"
294
+ archived.each do |col|
295
+ puts " • #{col['title']} (#{col['id']})"
296
+ end
297
+ else
298
+ puts "No archived columns"
299
+ end
300
+ end
301
+ ```
302
+
303
+ ## Export Column Structure to CSV
304
+
305
+ Export column information:
306
+
307
+ ```ruby
308
+ require "csv"
309
+
310
+ def export_columns_to_csv(client, board_id, filename)
311
+ response = client.column.query(
312
+ args: { ids: [board_id] },
313
+ select: ["id", "title", "type", "description", "width"]
314
+ )
315
+
316
+ return unless response.success?
317
+
318
+ boards = response.body.dig("data", "boards")
319
+ columns = boards.first&.dig("columns") || []
320
+
321
+ CSV.open(filename, "w") do |csv|
322
+ # Header
323
+ csv << ["ID", "Title", "Type", "Description", "Width"]
324
+
325
+ # Data
326
+ columns.each do |column|
327
+ csv << [
328
+ column["id"],
329
+ column["title"],
330
+ column["type"],
331
+ column["description"] || "",
332
+ column["width"]
333
+ ]
334
+ end
335
+ end
336
+
337
+ puts "āœ“ Exported #{columns.length} columns to #{filename}"
338
+ end
339
+
340
+ # Usage
341
+ export_columns_to_csv(client, 1234567890, "board_columns.csv")
342
+ ```
343
+
344
+ ## Complete Example
345
+
346
+ Comprehensive column querying:
347
+
348
+ ```ruby
349
+ require "monday_ruby"
350
+ require "dotenv/load"
351
+
352
+ Monday.configure do |config|
353
+ config.token = ENV["MONDAY_TOKEN"]
354
+ end
355
+
356
+ client = Monday::Client.new
357
+
358
+ board_id = 1234567890
359
+
360
+ response = client.column.query(
361
+ args: { ids: [board_id] },
362
+ select: [
363
+ "id",
364
+ "title",
365
+ "description",
366
+ "type",
367
+ "width",
368
+ "archived"
369
+ ]
370
+ )
371
+
372
+ if response.success?
373
+ boards = response.body.dig("data", "boards")
374
+ columns = boards.first&.dig("columns") || []
375
+
376
+ puts "\nšŸ“Š Board Column Structure\n#{'=' * 60}\n"
377
+ puts "Total columns: #{columns.length}"
378
+
379
+ # Group by type
380
+ by_type = columns.group_by { |col| col["type"] }
381
+
382
+ puts "\nColumns by Type:"
383
+ by_type.each do |type, cols|
384
+ puts " #{type}: #{cols.length} column(s)"
385
+ end
386
+
387
+ puts "\n#{'=' * 60}\n"
388
+ puts "Column Details:\n"
389
+
390
+ columns.each_with_index do |column, index|
391
+ puts "\n#{index + 1}. #{column['title']}"
392
+ puts " ID: #{column['id']}"
393
+ puts " Type: #{column['type']}"
394
+ puts " Width: #{column['width']}"
395
+ puts " Archived: #{column['archived']}"
396
+ puts " Description: #{column['description']}" if column['description']
397
+ end
398
+
399
+ puts "\n#{'=' * 60}"
400
+ else
401
+ puts "āŒ Failed to query columns"
402
+ puts "Status: #{response.status}"
403
+ end
404
+ ```
405
+
406
+ **Output:**
407
+ ```
408
+ šŸ“Š Board Column Structure
409
+ ============================================================
410
+
411
+ Total columns: 8
412
+
413
+ Columns by Type:
414
+ name: 1 column(s)
415
+ color: 2 column(s)
416
+ people: 1 column(s)
417
+ date: 1 column(s)
418
+ text: 1 column(s)
419
+ numbers: 1 column(s)
420
+ long-text: 1 column(s)
421
+
422
+ ============================================================
423
+
424
+ Column Details:
425
+
426
+ 1. Name
427
+ ID: name
428
+ Type: name
429
+ Width: 250
430
+ Archived: false
431
+
432
+ 2. Status
433
+ ID: status
434
+ Type: color
435
+ Width: 120
436
+ Archived: false
437
+ Description: Current status of the task
438
+
439
+ 3. Owner
440
+ ID: people
441
+ Type: people
442
+ Width: 150
443
+ Archived: false
444
+
445
+ ...
446
+
447
+ ============================================================
448
+ ```
449
+
450
+ ## Next Steps
451
+
452
+ - [Create columns](/guides/columns/create)
453
+ - [Update column values](/guides/columns/update-values)
454
+ - [Change column metadata](/guides/columns/metadata)
455
+ - [Query items](/guides/items/query)