monday_ruby 1.2.0 → 1.2.1

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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/lib/monday/version.rb +1 -1
  4. metadata +3 -79
  5. data/.env +0 -1
  6. data/.rspec +0 -2
  7. data/.rubocop.yml +0 -41
  8. data/.simplecov +0 -4
  9. data/.vscode/settings.json +0 -4
  10. data/CODE_OF_CONDUCT.md +0 -84
  11. data/CONTRIBUTING.md +0 -190
  12. data/Rakefile +0 -11
  13. data/docs/.vitepress/config.mjs +0 -255
  14. data/docs/.vitepress/theme/index.js +0 -4
  15. data/docs/.vitepress/theme/style.css +0 -43
  16. data/docs/README.md +0 -80
  17. data/docs/explanation/architecture.md +0 -507
  18. data/docs/explanation/best-practices/errors.md +0 -478
  19. data/docs/explanation/best-practices/performance.md +0 -1084
  20. data/docs/explanation/best-practices/rate-limiting.md +0 -630
  21. data/docs/explanation/best-practices/testing.md +0 -820
  22. data/docs/explanation/column-values.md +0 -857
  23. data/docs/explanation/design.md +0 -795
  24. data/docs/explanation/graphql.md +0 -356
  25. data/docs/explanation/migration/v1.md +0 -808
  26. data/docs/explanation/pagination.md +0 -447
  27. data/docs/guides/advanced/batch.md +0 -1274
  28. data/docs/guides/advanced/complex-queries.md +0 -1114
  29. data/docs/guides/advanced/errors.md +0 -818
  30. data/docs/guides/advanced/pagination.md +0 -934
  31. data/docs/guides/advanced/rate-limiting.md +0 -981
  32. data/docs/guides/authentication.md +0 -286
  33. data/docs/guides/boards/create.md +0 -386
  34. data/docs/guides/boards/delete.md +0 -405
  35. data/docs/guides/boards/duplicate.md +0 -511
  36. data/docs/guides/boards/query.md +0 -530
  37. data/docs/guides/boards/update.md +0 -453
  38. data/docs/guides/columns/create.md +0 -452
  39. data/docs/guides/columns/metadata.md +0 -492
  40. data/docs/guides/columns/query.md +0 -455
  41. data/docs/guides/columns/update-multiple.md +0 -459
  42. data/docs/guides/columns/update-values.md +0 -509
  43. data/docs/guides/files/add-to-column.md +0 -40
  44. data/docs/guides/files/add-to-update.md +0 -37
  45. data/docs/guides/files/clear-column.md +0 -33
  46. data/docs/guides/first-request.md +0 -285
  47. data/docs/guides/folders/manage.md +0 -750
  48. data/docs/guides/groups/items.md +0 -626
  49. data/docs/guides/groups/manage.md +0 -501
  50. data/docs/guides/installation.md +0 -169
  51. data/docs/guides/items/create.md +0 -493
  52. data/docs/guides/items/delete.md +0 -514
  53. data/docs/guides/items/query.md +0 -605
  54. data/docs/guides/items/subitems.md +0 -483
  55. data/docs/guides/items/update.md +0 -699
  56. data/docs/guides/updates/manage.md +0 -619
  57. data/docs/guides/use-cases/dashboard.md +0 -1421
  58. data/docs/guides/use-cases/import.md +0 -1962
  59. data/docs/guides/use-cases/task-management.md +0 -1381
  60. data/docs/guides/workspaces/manage.md +0 -502
  61. data/docs/index.md +0 -69
  62. data/docs/package-lock.json +0 -2468
  63. data/docs/package.json +0 -13
  64. data/docs/reference/client.md +0 -540
  65. data/docs/reference/configuration.md +0 -586
  66. data/docs/reference/errors.md +0 -693
  67. data/docs/reference/resources/account.md +0 -208
  68. data/docs/reference/resources/activity-log.md +0 -369
  69. data/docs/reference/resources/board-view.md +0 -359
  70. data/docs/reference/resources/board.md +0 -393
  71. data/docs/reference/resources/column.md +0 -543
  72. data/docs/reference/resources/file.md +0 -236
  73. data/docs/reference/resources/folder.md +0 -386
  74. data/docs/reference/resources/group.md +0 -507
  75. data/docs/reference/resources/item.md +0 -348
  76. data/docs/reference/resources/subitem.md +0 -267
  77. data/docs/reference/resources/update.md +0 -259
  78. data/docs/reference/resources/workspace.md +0 -213
  79. data/docs/reference/response.md +0 -560
  80. data/docs/tutorial/first-integration.md +0 -713
@@ -1,493 +0,0 @@
1
- # Create Items
2
-
3
- Add items (tasks, rows) to boards programmatically.
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 setting column values, you must find your board's actual column IDs.** Column IDs like `status`, `text`, or `date` in these examples are placeholders - replace them with your board's real column IDs.
9
- :::
10
-
11
- Query your board to get column IDs:
12
-
13
- ```ruby
14
- response = client.board.query(
15
- args: { ids: [1234567890] }, # Replace with your board ID
16
- select: [
17
- "id",
18
- "name",
19
- {
20
- columns: ["id", "title", "type"]
21
- }
22
- ]
23
- )
24
-
25
- if response.success?
26
- board = response.body.dig("data", "boards", 0)
27
-
28
- puts "Columns for board '#{board['name']}':"
29
- board["columns"].each do |column|
30
- puts " • #{column['title']}: '#{column['id']}' (#{column['type']})"
31
- end
32
- end
33
- ```
34
-
35
- **Example output:**
36
- ```
37
- Columns for board 'Marketing Campaigns':
38
- • Name: 'name' (name)
39
- • Status: 'status' (color)
40
- • Owner: 'people' (people)
41
- • Due Date: 'date4' (date)
42
- • Priority: 'status_1' (color)
43
- • Text: 'text' (text)
44
- ```
45
-
46
- Use these exact column IDs (e.g., `date4`, `status_1`) in your code, not the column titles.
47
-
48
- ## Basic Item Creation
49
-
50
- Create an item with just a name:
51
-
52
- ```ruby
53
- require "monday_ruby"
54
-
55
- Monday.configure do |config|
56
- config.token = ENV["MONDAY_TOKEN"]
57
- end
58
-
59
- client = Monday::Client.new
60
-
61
- response = client.item.create(
62
- args: {
63
- board_id: 1234567890,
64
- item_name: "New Task"
65
- }
66
- )
67
-
68
- if response.success?
69
- item = response.body.dig("data", "create_item")
70
- puts "✓ Created item: #{item['name']}"
71
- puts " ID: #{item['id']}"
72
- else
73
- puts "✗ Failed to create item"
74
- end
75
- ```
76
-
77
- **Output:**
78
- ```
79
- ✓ Created item: New Task
80
- ID: 987654321
81
- ```
82
-
83
- ## Create with Column Values
84
-
85
- Set column values when creating an item:
86
-
87
- ### Status Column
88
-
89
- ```ruby
90
- # Replace 'status' with your actual column ID from the query above
91
- response = client.item.create(
92
- args: {
93
- board_id: 1234567890,
94
- item_name: "Task with Status",
95
- column_values: {
96
- status: { # ⚠️ Replace 'status' with your board's status column ID
97
- label: "Done"
98
- }
99
- }
100
- }
101
- )
102
-
103
- if response.success?
104
- item = response.body.dig("data", "create_item")
105
- puts "Created: #{item['name']}"
106
- end
107
- ```
108
-
109
- ### Multiple Columns
110
-
111
- Set multiple column values at once:
112
-
113
- ```ruby
114
- # ⚠️ Replace column IDs with your board's actual column IDs
115
- response = client.item.create(
116
- args: {
117
- board_id: 1234567890,
118
- item_name: "Complete Task Setup",
119
- column_values: {
120
- status: { # Your status column ID
121
- label: "Working on it"
122
- },
123
- text: "High priority task", # Your text column ID
124
- date4: { # Your date column ID (e.g., 'date4', 'date', etc.)
125
- date: "2024-12-31",
126
- time: "14:00:00"
127
- },
128
- people: { # Your people column ID
129
- personsAndTeams: [
130
- { id: 12345678, kind: "person" } # Replace with actual user ID
131
- ]
132
- }
133
- }
134
- }
135
- )
136
- ```
137
-
138
- ## Create in Specific Group
139
-
140
- Add item to a particular group (section) on the board:
141
-
142
- ```ruby
143
- # First, get the group ID
144
- board_response = client.board.query(
145
- args: { ids: [1234567890] },
146
- select: [
147
- "id",
148
- {
149
- groups: ["id", "title"]
150
- }
151
- ]
152
- )
153
-
154
- board = board_response.body.dig("data", "boards", 0)
155
- group_id = board.dig("groups", 0, "id")
156
-
157
- # Create item in that group
158
- response = client.item.create(
159
- args: {
160
- board_id: 1234567890,
161
- group_id: group_id,
162
- item_name: "Task in Specific Group"
163
- }
164
- )
165
-
166
- if response.success?
167
- item = response.body.dig("data", "create_item")
168
- puts "✓ Item created in group #{group_id}"
169
- end
170
- ```
171
-
172
- ## Auto-Create Status Labels
173
-
174
- Automatically create new status labels if they don't exist:
175
-
176
- ```ruby
177
- response = client.item.create(
178
- args: {
179
- board_id: 1234567890,
180
- item_name: "Task with New Label",
181
- column_values: {
182
- status__1: {
183
- label: "Custom Status"
184
- }
185
- },
186
- create_labels_if_missing: true
187
- }
188
- )
189
-
190
- if response.success?
191
- puts "✓ Item created with custom status label"
192
- end
193
- ```
194
-
195
- ::: 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>Status Labels</span>
196
- Without `create_labels_if_missing: true`, attempting to use non-existent status labels will cause an error.
197
- :::
198
-
199
- ## Customize Response Fields
200
-
201
- Choose which fields to return:
202
-
203
- ```ruby
204
- response = client.item.create(
205
- args: {
206
- board_id: 1234567890,
207
- item_name: "Detailed Item"
208
- },
209
- select: [
210
- "id",
211
- "name",
212
- "created_at",
213
- "state",
214
- "board { id name }",
215
- "group { id title }"
216
- ]
217
- )
218
-
219
- if response.success?
220
- item = response.body.dig("data", "create_item")
221
-
222
- puts "Item Details:"
223
- puts " ID: #{item['id']}"
224
- puts " Name: #{item['name']}"
225
- puts " Created: #{item['created_at']}"
226
- puts " Board: #{item.dig('board', 'name')}"
227
- puts " Group: #{item.dig('group', 'title')}"
228
- end
229
- ```
230
-
231
- ## Bulk Create Items
232
-
233
- Create multiple items efficiently:
234
-
235
- ```ruby
236
- def create_items_bulk(client, board_id, item_names)
237
- created_items = []
238
-
239
- item_names.each do |name|
240
- response = client.item.create(
241
- args: {
242
- board_id: board_id,
243
- item_name: name
244
- }
245
- )
246
-
247
- if response.success?
248
- item = response.body.dig("data", "create_item")
249
- created_items << item
250
- puts "✓ Created: #{item['name']}"
251
- else
252
- puts "✗ Failed to create: #{name}"
253
- end
254
-
255
- # Rate limiting: pause between requests
256
- sleep(0.5)
257
- end
258
-
259
- created_items
260
- end
261
-
262
- # Usage
263
- tasks = [
264
- "Design mockups",
265
- "Implement feature",
266
- "Write tests",
267
- "Deploy to staging",
268
- "QA review"
269
- ]
270
-
271
- items = create_items_bulk(client, 1234567890, tasks)
272
- puts "\nCreated #{items.length} items"
273
- ```
274
-
275
- ## Create with JSON Column Values
276
-
277
- For complex column types, use JSON strings:
278
-
279
- ```ruby
280
- require "json"
281
-
282
- column_values = {
283
- status__1: { label: "Done" },
284
- date: { date: "2024-12-31" }
285
- }
286
-
287
- response = client.item.create(
288
- args: {
289
- board_id: 1234567890,
290
- item_name: "Task with JSON Values",
291
- column_values: JSON.generate(column_values)
292
- }
293
- )
294
- ```
295
-
296
- ::: 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>Hash vs JSON</span>
297
- The gem automatically converts Hash column values to JSON. You can pass either format.
298
- :::
299
-
300
- ## Error Handling
301
-
302
- Handle common creation errors:
303
-
304
- ```ruby
305
- def create_item_safe(client, board_id, name, columns = {})
306
- response = client.item.create(
307
- args: {
308
- board_id: board_id,
309
- item_name: name,
310
- column_values: columns
311
- }
312
- )
313
-
314
- if response.success?
315
- item = response.body.dig("data", "create_item")
316
- puts "✓ Created: #{item['name']} (ID: #{item['id']})"
317
- item['id']
318
- else
319
- puts "✗ Failed to create item: #{name}"
320
- puts " Status: #{response.status}"
321
-
322
- if response.body["errors"]
323
- response.body["errors"].each do |error|
324
- puts " Error: #{error['message']}"
325
- end
326
- end
327
-
328
- nil
329
- end
330
- rescue Monday::AuthorizationError
331
- puts "✗ Invalid API token"
332
- nil
333
- rescue Monday::InvalidRequestError => e
334
- puts "✗ Invalid request: #{e.message}"
335
- nil
336
- rescue Monday::Error => e
337
- puts "✗ API error: #{e.message}"
338
- nil
339
- end
340
-
341
- # Usage
342
- item_id = create_item_safe(
343
- client,
344
- 1234567890,
345
- "Safe Task",
346
- { status__1: { label: "Done" } }
347
- )
348
- ```
349
-
350
- ## Validate Item Names
351
-
352
- Check for valid item names before creating:
353
-
354
- ```ruby
355
- def valid_item_name?(name)
356
- return false if name.nil? || name.empty?
357
- return false if name.length > 255
358
-
359
- true
360
- end
361
-
362
- item_name = "My New Task"
363
-
364
- if valid_item_name?(item_name)
365
- response = client.item.create(
366
- args: {
367
- board_id: 1234567890,
368
- item_name: item_name
369
- }
370
- )
371
- else
372
- puts "Invalid item name"
373
- end
374
- ```
375
-
376
- ## Complete Example
377
-
378
- Create a fully configured item:
379
-
380
- ```ruby
381
- require "monday_ruby"
382
- require "dotenv/load"
383
-
384
- Monday.configure do |config|
385
- config.token = ENV["MONDAY_TOKEN"]
386
- end
387
-
388
- client = Monday::Client.new
389
-
390
- # IMPORTANT: First, get your board's column IDs:
391
- # See "Finding Column IDs" section at the top of this guide
392
-
393
- # Create item with all options
394
- response = client.item.create(
395
- args: {
396
- board_id: 1234567890, # Your board ID
397
- group_id: "topics", # Your group ID
398
- item_name: "Q1 2024 Marketing Campaign",
399
- column_values: {
400
- status: { # ⚠️ Replace with your status column ID
401
- label: "Working on it"
402
- },
403
- date4: { # ⚠️ Replace with your date column ID
404
- date: "2024-03-31",
405
- time: "17:00:00"
406
- },
407
- people: { # ⚠️ Replace with your people column ID
408
- personsAndTeams: [
409
- { id: 12345678, kind: "person" } # Replace with actual user ID
410
- ]
411
- },
412
- text: "Launch new product marketing campaign" # ⚠️ Replace with your text column ID
413
- },
414
- create_labels_if_missing: true
415
- },
416
- select: [
417
- "id",
418
- "name",
419
- "created_at",
420
- "state",
421
- {
422
- board: ["id", "name"],
423
- group: ["id", "title"],
424
- column_values: ["id", "text", "type"]
425
- }
426
- ]
427
- )
428
-
429
- if response.success?
430
- item = response.body.dig("data", "create_item")
431
-
432
- puts "\n✓ Item Created Successfully\n"
433
- puts "#{'=' * 50}"
434
- puts "Name: #{item['name']}"
435
- puts "ID: #{item['id']}"
436
- puts "Created: #{item['created_at']}"
437
- puts "Board: #{item.dig('board', 'name')}"
438
- puts "Group: #{item.dig('group', 'title')}"
439
- puts "\nColumn Values:"
440
-
441
- item["column_values"].each do |col_val|
442
- next if col_val["text"].nil? || col_val["text"].empty?
443
- puts " • #{col_val['id']}: #{col_val['text']}"
444
- end
445
-
446
- puts "#{'=' * 50}"
447
- else
448
- puts "\n✗ Failed to create item"
449
- puts "Status code: #{response.status}"
450
-
451
- if response.body["error_message"]
452
- puts "Error: #{response.body['error_message']}"
453
- end
454
- end
455
- ```
456
-
457
- ## Create from Template
458
-
459
- Copy an existing item structure:
460
-
461
- ```ruby
462
- # Get the original item's structure
463
- template_response = client.item.query(
464
- args: { ids: [987654321] },
465
- select: [
466
- "id",
467
- "name",
468
- {
469
- column_values: ["id", "text"]
470
- }
471
- ]
472
- )
473
-
474
- template_item = template_response.body.dig("data", "items", 0)
475
-
476
- # Create new item with same column structure
477
- # (You'll need to parse and reconstruct column values appropriately)
478
- response = client.item.create(
479
- args: {
480
- board_id: 1234567890,
481
- item_name: "New Item from Template"
482
- # Add column_values based on template
483
- }
484
- )
485
- ```
486
-
487
- ## Next Steps
488
-
489
- - [Query items](/guides/items/query)
490
- - [Update item values](/guides/items/update)
491
- - [Work with subitems](/guides/items/subitems)
492
- - [Update column values](/guides/columns/update-values)
493
- - [Archive and delete items](/guides/items/delete)