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,507 @@
1
+ # Group
2
+
3
+ Access and manage groups via the `client.group` resource.
4
+
5
+ ::: 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>What are Groups?</span>
6
+ Groups are sections within boards that organize related items together. Think of them like folders or categories that help structure your board's content. Each board can have multiple groups, and items can be moved between groups.
7
+ :::
8
+
9
+ ## Methods
10
+
11
+ ### query
12
+
13
+ Retrieves groups from boards.
14
+
15
+ ```ruby
16
+ client.group.query(args: {}, select: DEFAULT_SELECT)
17
+ ```
18
+
19
+ **Parameters:**
20
+
21
+ | Name | Type | Default | Description |
22
+ |------|------|---------|-------------|
23
+ | `args` | Hash | `{}` | Query arguments (board IDs, filters) |
24
+ | `select` | Array | `["id", "title"]` | Fields to retrieve |
25
+
26
+ **Returns:** `Monday::Response`
27
+
28
+ **Common args:**
29
+ - `ids` - Array of board IDs to query groups from
30
+
31
+ **Example:**
32
+
33
+ ```ruby
34
+ response = client.group.query(
35
+ args: { ids: [123, 456] },
36
+ select: ["id", "title", "color", "position"]
37
+ )
38
+
39
+ boards = response.body.dig("data", "boards")
40
+ boards.each do |board|
41
+ board["groups"].each do |group|
42
+ puts "#{group['title']} (#{group['id']})"
43
+ end
44
+ end
45
+ ```
46
+
47
+ **GraphQL:** `query { boards { groups { ... } } }`
48
+
49
+ **See:** [monday.com groups query](https://developer.monday.com/api-reference/reference/groups)
50
+
51
+ ### create
52
+
53
+ Creates a new group on a board.
54
+
55
+ ```ruby
56
+ client.group.create(args: {}, select: DEFAULT_SELECT)
57
+ ```
58
+
59
+ **Parameters:**
60
+
61
+ | Name | Type | Default | Description |
62
+ |------|------|---------|-------------|
63
+ | `args` | Hash | `{}` | Creation arguments (required) |
64
+ | `select` | Array | `["id", "title"]` | Fields to retrieve |
65
+
66
+ **Required args:**
67
+ - `board_id` - String or Integer - Board ID
68
+ - `group_name` - String - Name for the new group
69
+
70
+ **Optional args:**
71
+ - `position` - String - Position relative to other groups (`:first`, `:last`, or after a specific group ID)
72
+ - `position_relative_method` - Symbol - `:before_at` or `:after_at` when using position with group ID
73
+ - `relative_to` - String - Group ID to position relative to
74
+
75
+ **Returns:** `Monday::Response`
76
+
77
+ **Example:**
78
+
79
+ ```ruby
80
+ response = client.group.create(
81
+ args: {
82
+ board_id: 123,
83
+ group_name: "Returned Orders"
84
+ }
85
+ )
86
+
87
+ group = response.body.dig("data", "create_group")
88
+ puts "Created group: #{group['title']} (#{group['id']})"
89
+ ```
90
+
91
+ **GraphQL:** `mutation { create_group { ... } }`
92
+
93
+ **See:** [monday.com create_group](https://developer.monday.com/api-reference/reference/groups#create-group)
94
+
95
+ ### update
96
+
97
+ Updates a group's attributes.
98
+
99
+ ```ruby
100
+ client.group.update(args: {}, select: ["id"])
101
+ ```
102
+
103
+ **Parameters:**
104
+
105
+ | Name | Type | Default | Description |
106
+ |------|------|---------|-------------|
107
+ | `args` | Hash | `{}` | Update arguments (required) |
108
+ | `select` | Array | `["id"]` | Fields to retrieve |
109
+
110
+ **Required args:**
111
+ - `board_id` - String or Integer - Board ID
112
+ - `group_id` - String - Group ID
113
+ - `group_attribute` - Symbol - Attribute to update (`:title`, `:color`, `:position`)
114
+ - `new_value` - String - New value for the attribute
115
+
116
+ **Returns:** `Monday::Response`
117
+
118
+ **Example:**
119
+
120
+ ```ruby
121
+ response = client.group.update(
122
+ args: {
123
+ board_id: 123,
124
+ group_id: "group_mkx1yn2n",
125
+ group_attribute: :title,
126
+ new_value: "Completed Orders"
127
+ }
128
+ )
129
+
130
+ group = response.body.dig("data", "update_group")
131
+ ```
132
+
133
+ **GraphQL:** `mutation { update_group { ... } }`
134
+
135
+ **See:** [monday.com update_group](https://developer.monday.com/api-reference/reference/groups#update-group)
136
+
137
+ ### delete
138
+
139
+ Permanently deletes a group.
140
+
141
+ ```ruby
142
+ client.group.delete(args: {}, select: ["id"])
143
+ ```
144
+
145
+ **Parameters:**
146
+
147
+ | Name | Type | Default | Description |
148
+ |------|------|---------|-------------|
149
+ | `args` | Hash | `{}` | Deletion arguments (required) |
150
+ | `select` | Array | `["id"]` | Fields to retrieve |
151
+
152
+ **Required args:**
153
+ - `board_id` - String or Integer - Board ID
154
+ - `group_id` - String - Group ID to delete
155
+
156
+ **Returns:** `Monday::Response`
157
+
158
+ ::: 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>
159
+ Deleting a group permanently removes all items within it. This operation cannot be undone. Consider archiving instead to preserve data.
160
+ :::
161
+
162
+ **Example:**
163
+
164
+ ```ruby
165
+ response = client.group.delete(
166
+ args: {
167
+ board_id: 123,
168
+ group_id: "group_mkx1yn2n"
169
+ }
170
+ )
171
+
172
+ deleted_group = response.body.dig("data", "delete_group")
173
+ ```
174
+
175
+ **GraphQL:** `mutation { delete_group { ... } }`
176
+
177
+ **See:** [monday.com delete_group](https://developer.monday.com/api-reference/reference/groups#delete-group)
178
+
179
+ ### archive
180
+
181
+ Archives a group (soft delete).
182
+
183
+ ```ruby
184
+ client.group.archive(args: {}, select: ["id"])
185
+ ```
186
+
187
+ **Parameters:**
188
+
189
+ | Name | Type | Default | Description |
190
+ |------|------|---------|-------------|
191
+ | `args` | Hash | `{}` | Archive arguments (required) |
192
+ | `select` | Array | `["id"]` | Fields to retrieve |
193
+
194
+ **Required args:**
195
+ - `board_id` - String or Integer - Board ID
196
+ - `group_id` - String - Group ID to archive
197
+
198
+ **Returns:** `Monday::Response`
199
+
200
+ **Example:**
201
+
202
+ ```ruby
203
+ response = client.group.archive(
204
+ args: {
205
+ board_id: 123,
206
+ group_id: "group_mkx1yn2n"
207
+ }
208
+ )
209
+
210
+ archived_group = response.body.dig("data", "archive_group")
211
+ ```
212
+
213
+ **GraphQL:** `mutation { archive_group { ... } }`
214
+
215
+ **See:** [monday.com archive_group](https://developer.monday.com/api-reference/reference/groups#archive-group)
216
+
217
+ ### duplicate
218
+
219
+ Duplicates an existing group.
220
+
221
+ ```ruby
222
+ client.group.duplicate(args: {}, select: DEFAULT_SELECT)
223
+ ```
224
+
225
+ **Parameters:**
226
+
227
+ | Name | Type | Default | Description |
228
+ |------|------|---------|-------------|
229
+ | `args` | Hash | `{}` | Duplication arguments (required) |
230
+ | `select` | Array | `["id", "title"]` | Fields to retrieve |
231
+
232
+ **Required args:**
233
+ - `board_id` - String or Integer - Board ID
234
+ - `group_id` - String - Group ID to duplicate
235
+
236
+ **Optional args:**
237
+ - `add_to_top` - Boolean - Add duplicated group to top of board (default: false)
238
+ - `group_title` - String - Custom title for duplicated group
239
+
240
+ **Returns:** `Monday::Response`
241
+
242
+ **Example:**
243
+
244
+ ```ruby
245
+ response = client.group.duplicate(
246
+ args: {
247
+ board_id: 123,
248
+ group_id: "group_mkx1yn2n",
249
+ group_title: "Copy of Returned Orders",
250
+ add_to_top: true
251
+ }
252
+ )
253
+
254
+ duplicated_group = response.body.dig("data", "duplicate_group")
255
+ puts "Duplicated: #{duplicated_group['title']}"
256
+ ```
257
+
258
+ **GraphQL:** `mutation { duplicate_group { ... } }`
259
+
260
+ **See:** [monday.com duplicate_group](https://developer.monday.com/api-reference/reference/groups#duplicate-group)
261
+
262
+ ### move_item
263
+
264
+ Moves an item to a different group.
265
+
266
+ ```ruby
267
+ client.group.move_item(args: {}, select: ["id"])
268
+ ```
269
+
270
+ **Parameters:**
271
+
272
+ | Name | Type | Default | Description |
273
+ |------|------|---------|-------------|
274
+ | `args` | Hash | `{}` | Move arguments (required) |
275
+ | `select` | Array | `["id"]` | Item fields to retrieve |
276
+
277
+ **Required args:**
278
+ - `item_id` - String or Integer - Item ID to move
279
+ - `group_id` - String - Destination group ID
280
+
281
+ **Returns:** `Monday::Response`
282
+
283
+ **Example:**
284
+
285
+ ```ruby
286
+ response = client.group.move_item(
287
+ args: {
288
+ item_id: 987654321,
289
+ group_id: "group_mkx1yn2n"
290
+ },
291
+ select: ["id", "name", "group { id title }"]
292
+ )
293
+
294
+ moved_item = response.body.dig("data", "move_item_to_group")
295
+ ```
296
+
297
+ **GraphQL:** `mutation { move_item_to_group { ... } }`
298
+
299
+ **See:** [monday.com move_item_to_group](https://developer.monday.com/api-reference/reference/groups#move-item-to-group)
300
+
301
+ ### items_page
302
+
303
+ Retrieves paginated items from groups using cursor-based pagination.
304
+
305
+ ```ruby
306
+ client.group.items_page(
307
+ board_ids:,
308
+ group_ids:,
309
+ limit: 25,
310
+ cursor: nil,
311
+ query_params: nil,
312
+ select: DEFAULT_PAGINATED_SELECT
313
+ )
314
+ ```
315
+
316
+ **Parameters:**
317
+
318
+ | Name | Type | Default | Description |
319
+ |------|------|---------|-------------|
320
+ | `board_ids` | Integer or Array | - | Board ID(s) to query (required) |
321
+ | `group_ids` | String or Array | - | Group ID(s) to query (required) |
322
+ | `limit` | Integer | `25` | Items per page (max: 500) |
323
+ | `cursor` | String | `nil` | Pagination cursor from previous response |
324
+ | `query_params` | Hash | `nil` | Filter items with rules and operators |
325
+ | `select` | Array | `["id", "name"]` | Item fields to retrieve |
326
+
327
+ **Returns:** `Monday::Response`
328
+
329
+ The response contains items and cursor for pagination:
330
+
331
+ ```ruby
332
+ items_page = response.body.dig("data", "boards", 0, "groups", 0, "items_page")
333
+ items = items_page["items"]
334
+ cursor = items_page["cursor"] # Use for next page, nil if no more pages
335
+ ```
336
+
337
+ **Pagination:**
338
+
339
+ Cursors are temporary tokens that expire after 60 minutes. They mark your position in the result set and enable efficient pagination through large datasets.
340
+
341
+ **Query Params Structure:**
342
+
343
+ ```ruby
344
+ {
345
+ rules: [
346
+ {
347
+ column_id: "status",
348
+ compare_value: [1, 2], # Array of acceptable values
349
+ operator: :any_of # Optional: :any_of, :not_any_of, etc.
350
+ }
351
+ ],
352
+ operator: :and # Combines multiple rules: :and or :or
353
+ }
354
+ ```
355
+
356
+ **Example - Basic Pagination:**
357
+
358
+ ```ruby
359
+ # First page
360
+ response = client.group.items_page(
361
+ board_ids: 123,
362
+ group_ids: "group_mkx1yn2n",
363
+ limit: 50
364
+ )
365
+
366
+ items_page = response.body.dig("data", "boards", 0, "groups", 0, "items_page")
367
+ items = items_page["items"]
368
+ cursor = items_page["cursor"]
369
+
370
+ # Next page
371
+ if cursor
372
+ response = client.group.items_page(
373
+ board_ids: 123,
374
+ group_ids: "group_mkx1yn2n",
375
+ cursor: cursor
376
+ )
377
+ end
378
+ ```
379
+
380
+ **Example - Multiple Boards and Groups:**
381
+
382
+ ```ruby
383
+ response = client.group.items_page(
384
+ board_ids: [123, 456],
385
+ group_ids: ["group_1", "group_2"],
386
+ limit: 100
387
+ )
388
+
389
+ boards = response.body.dig("data", "boards")
390
+ boards.each do |board|
391
+ board["groups"].each do |group|
392
+ items = group["items_page"]["items"]
393
+ puts "Group #{group['items_page']['items'].length} items"
394
+ end
395
+ end
396
+ ```
397
+
398
+ **Example - Filtered Query:**
399
+
400
+ ```ruby
401
+ response = client.group.items_page(
402
+ board_ids: 123,
403
+ group_ids: "group_mkx1yn2n",
404
+ limit: 100,
405
+ query_params: {
406
+ rules: [
407
+ { column_id: "status", compare_value: [1] }
408
+ ],
409
+ operator: :and
410
+ }
411
+ )
412
+
413
+ # Only items matching the filter are returned
414
+ items = response.body.dig("data", "boards", 0, "groups", 0, "items_page", "items")
415
+ ```
416
+
417
+ **Example - Custom Fields:**
418
+
419
+ ```ruby
420
+ response = client.group.items_page(
421
+ board_ids: 123,
422
+ group_ids: "group_mkx1yn2n",
423
+ limit: 50,
424
+ select: [
425
+ "id",
426
+ "name",
427
+ "created_at",
428
+ "updated_at",
429
+ {
430
+ column_values: ["id", "text", "value"]
431
+ }
432
+ ]
433
+ )
434
+ ```
435
+
436
+ **GraphQL:** `query { boards { groups { items_page { ... } } } }`
437
+
438
+ **See:**
439
+ - [monday.com items_page](https://developer.monday.com/api-reference/reference/items-page)
440
+ - [Pagination guide](/guides/advanced/pagination)
441
+ - [Query params filtering](https://developer.monday.com/api-reference/reference/items-page#query-params)
442
+
443
+ ## Response Structure
444
+
445
+ All methods return a `Monday::Response` object. Access data using:
446
+
447
+ ```ruby
448
+ response.success? # => true/false
449
+ response.status # => 200
450
+ response.body # => Hash with GraphQL response
451
+ ```
452
+
453
+ ### Typical Response Pattern
454
+
455
+ ```ruby
456
+ response = client.group.query(args: { ids: [123] })
457
+
458
+ if response.success?
459
+ boards = response.body.dig("data", "boards")
460
+ boards.each do |board|
461
+ board["groups"].each do |group|
462
+ puts group["title"]
463
+ end
464
+ end
465
+ else
466
+ # Handle error
467
+ end
468
+ ```
469
+
470
+ ## Constants
471
+
472
+ ### DEFAULT_SELECT
473
+
474
+ Default fields returned by `query`, `create`, `duplicate`:
475
+
476
+ ```ruby
477
+ ["id", "title"]
478
+ ```
479
+
480
+ ### DEFAULT_PAGINATED_SELECT
481
+
482
+ Default fields returned by `items_page`:
483
+
484
+ ```ruby
485
+ ["id", "name"]
486
+ ```
487
+
488
+ ## Error Handling
489
+
490
+ See the [Error Handling guide](/guides/advanced/errors) for common errors and how to handle them.
491
+
492
+ **Common errors:**
493
+ - `Monday::ResourceNotFoundError` - Group or board not found
494
+ - `Monday::AuthorizationError` - Invalid permissions or token
495
+ - `Monday::InvalidRequestError` - Invalid arguments
496
+
497
+ ## Related Resources
498
+
499
+ - [Item](/reference/resources/item) - Items within groups
500
+ - [Board](/reference/resources/board) - Boards containing groups
501
+ - [Column](/reference/resources/column) - Columns in groups
502
+
503
+ ## External References
504
+
505
+ - [monday.com Groups API](https://developer.monday.com/api-reference/reference/groups)
506
+ - [monday.com items_page](https://developer.monday.com/api-reference/reference/items-page)
507
+ - [GraphQL API Overview](https://developer.monday.com/api-reference/docs/introduction-to-graphql)