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.
- checksums.yaml +4 -4
- data/.env +1 -1
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +14 -0
- data/CONTRIBUTING.md +104 -0
- data/README.md +146 -142
- data/docs/.vitepress/config.mjs +255 -0
- data/docs/.vitepress/theme/index.js +4 -0
- data/docs/.vitepress/theme/style.css +43 -0
- data/docs/README.md +80 -0
- data/docs/explanation/architecture.md +507 -0
- data/docs/explanation/best-practices/errors.md +478 -0
- data/docs/explanation/best-practices/performance.md +1084 -0
- data/docs/explanation/best-practices/rate-limiting.md +630 -0
- data/docs/explanation/best-practices/testing.md +820 -0
- data/docs/explanation/column-values.md +857 -0
- data/docs/explanation/design.md +795 -0
- data/docs/explanation/graphql.md +356 -0
- data/docs/explanation/migration/v1.md +808 -0
- data/docs/explanation/pagination.md +447 -0
- data/docs/guides/advanced/batch.md +1274 -0
- data/docs/guides/advanced/complex-queries.md +1114 -0
- data/docs/guides/advanced/errors.md +818 -0
- data/docs/guides/advanced/pagination.md +934 -0
- data/docs/guides/advanced/rate-limiting.md +981 -0
- data/docs/guides/authentication.md +286 -0
- data/docs/guides/boards/create.md +386 -0
- data/docs/guides/boards/delete.md +405 -0
- data/docs/guides/boards/duplicate.md +511 -0
- data/docs/guides/boards/query.md +530 -0
- data/docs/guides/boards/update.md +453 -0
- data/docs/guides/columns/create.md +452 -0
- data/docs/guides/columns/metadata.md +492 -0
- data/docs/guides/columns/query.md +455 -0
- data/docs/guides/columns/update-multiple.md +459 -0
- data/docs/guides/columns/update-values.md +509 -0
- data/docs/guides/files/add-to-column.md +40 -0
- data/docs/guides/files/add-to-update.md +37 -0
- data/docs/guides/files/clear-column.md +33 -0
- data/docs/guides/first-request.md +285 -0
- data/docs/guides/folders/manage.md +750 -0
- data/docs/guides/groups/items.md +626 -0
- data/docs/guides/groups/manage.md +501 -0
- data/docs/guides/installation.md +169 -0
- data/docs/guides/items/create.md +493 -0
- data/docs/guides/items/delete.md +514 -0
- data/docs/guides/items/query.md +605 -0
- data/docs/guides/items/subitems.md +483 -0
- data/docs/guides/items/update.md +699 -0
- data/docs/guides/updates/manage.md +619 -0
- data/docs/guides/use-cases/dashboard.md +1421 -0
- data/docs/guides/use-cases/import.md +1962 -0
- data/docs/guides/use-cases/task-management.md +1381 -0
- data/docs/guides/workspaces/manage.md +502 -0
- data/docs/index.md +69 -0
- data/docs/package-lock.json +2468 -0
- data/docs/package.json +13 -0
- data/docs/reference/client.md +540 -0
- data/docs/reference/configuration.md +586 -0
- data/docs/reference/errors.md +693 -0
- data/docs/reference/resources/account.md +208 -0
- data/docs/reference/resources/activity-log.md +369 -0
- data/docs/reference/resources/board-view.md +359 -0
- data/docs/reference/resources/board.md +393 -0
- data/docs/reference/resources/column.md +543 -0
- data/docs/reference/resources/file.md +236 -0
- data/docs/reference/resources/folder.md +386 -0
- data/docs/reference/resources/group.md +507 -0
- data/docs/reference/resources/item.md +348 -0
- data/docs/reference/resources/subitem.md +267 -0
- data/docs/reference/resources/update.md +259 -0
- data/docs/reference/resources/workspace.md +213 -0
- data/docs/reference/response.md +560 -0
- data/docs/tutorial/first-integration.md +713 -0
- data/lib/monday/client.rb +24 -0
- data/lib/monday/configuration.rb +5 -0
- data/lib/monday/request.rb +15 -0
- data/lib/monday/resources/base.rb +4 -0
- data/lib/monday/resources/file.rb +56 -0
- data/lib/monday/util.rb +1 -0
- data/lib/monday/version.rb +1 -1
- metadata +87 -4
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
# Update Board Settings
|
|
2
|
+
|
|
3
|
+
Modify board properties like name, description, and communication settings.
|
|
4
|
+
|
|
5
|
+
## Update Board Name
|
|
6
|
+
|
|
7
|
+
Change a board's display name:
|
|
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
|
+
board_id = 1234567890
|
|
19
|
+
|
|
20
|
+
response = client.board.update(
|
|
21
|
+
args: {
|
|
22
|
+
board_id: board_id,
|
|
23
|
+
board_attribute: :name,
|
|
24
|
+
new_value: "Updated Board Name"
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
if response.success?
|
|
29
|
+
result = JSON.parse(response.body["data"]["update_board"])
|
|
30
|
+
|
|
31
|
+
if result["success"]
|
|
32
|
+
puts "✓ Board name updated successfully"
|
|
33
|
+
else
|
|
34
|
+
puts "✗ Update failed"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Update Board Description
|
|
40
|
+
|
|
41
|
+
Modify the board's description:
|
|
42
|
+
|
|
43
|
+
```ruby
|
|
44
|
+
board_id = 1234567890
|
|
45
|
+
|
|
46
|
+
response = client.board.update(
|
|
47
|
+
args: {
|
|
48
|
+
board_id: board_id,
|
|
49
|
+
board_attribute: :description,
|
|
50
|
+
new_value: "This board tracks all Q1 2024 marketing campaigns and initiatives"
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
if response.success?
|
|
55
|
+
result = JSON.parse(response.body["data"]["update_board"])
|
|
56
|
+
|
|
57
|
+
if result["success"]
|
|
58
|
+
puts "✓ Description updated"
|
|
59
|
+
else
|
|
60
|
+
puts "✗ Update failed"
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Update Communication Setting
|
|
66
|
+
|
|
67
|
+
Set the board's communication value (typically a meeting link or ID):
|
|
68
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
board_id = 1234567890
|
|
71
|
+
|
|
72
|
+
response = client.board.update(
|
|
73
|
+
args: {
|
|
74
|
+
board_id: board_id,
|
|
75
|
+
board_attribute: :communication,
|
|
76
|
+
new_value: "https://zoom.us/j/123456789"
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
if response.success?
|
|
81
|
+
result = JSON.parse(response.body["data"]["update_board"])
|
|
82
|
+
|
|
83
|
+
if result["success"]
|
|
84
|
+
puts "✓ Communication setting updated"
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Response Structure
|
|
90
|
+
|
|
91
|
+
The update response contains success status and undo data:
|
|
92
|
+
|
|
93
|
+
```ruby
|
|
94
|
+
response = client.board.update(
|
|
95
|
+
args: {
|
|
96
|
+
board_id: 1234567890,
|
|
97
|
+
board_attribute: :name,
|
|
98
|
+
new_value: "New Name"
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
if response.success?
|
|
103
|
+
# Response is JSON string, needs parsing
|
|
104
|
+
result = JSON.parse(response.body["data"]["update_board"])
|
|
105
|
+
|
|
106
|
+
puts "Success: #{result['success']}"
|
|
107
|
+
puts "Undo data: #{result['undo_data']}"
|
|
108
|
+
end
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Example response:**
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"success": true,
|
|
115
|
+
"undo_data": "{\"undo_record_id\":123456,\"action_type\":\"update_board\"}"
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Check Before Update
|
|
120
|
+
|
|
121
|
+
Verify board exists before updating:
|
|
122
|
+
|
|
123
|
+
```ruby
|
|
124
|
+
def board_exists?(client, board_id)
|
|
125
|
+
response = client.board.query(
|
|
126
|
+
args: { ids: [board_id] },
|
|
127
|
+
select: ["id"]
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
return false unless response.success?
|
|
131
|
+
|
|
132
|
+
boards = response.body.dig("data", "boards")
|
|
133
|
+
!boards.empty?
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
board_id = 1234567890
|
|
137
|
+
|
|
138
|
+
if board_exists?(client, board_id)
|
|
139
|
+
response = client.board.update(
|
|
140
|
+
args: {
|
|
141
|
+
board_id: board_id,
|
|
142
|
+
board_attribute: :name,
|
|
143
|
+
new_value: "Updated Name"
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
else
|
|
147
|
+
puts "Board not found"
|
|
148
|
+
end
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Update with Validation
|
|
152
|
+
|
|
153
|
+
Validate input before updating:
|
|
154
|
+
|
|
155
|
+
```ruby
|
|
156
|
+
def update_board_name(client, board_id, new_name)
|
|
157
|
+
# Validate name
|
|
158
|
+
if new_name.nil? || new_name.strip.empty?
|
|
159
|
+
puts "✗ Name cannot be empty"
|
|
160
|
+
return false
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if new_name.length > 255
|
|
164
|
+
puts "✗ Name too long (max 255 characters)"
|
|
165
|
+
return false
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Update
|
|
169
|
+
response = client.board.update(
|
|
170
|
+
args: {
|
|
171
|
+
board_id: board_id,
|
|
172
|
+
board_attribute: :name,
|
|
173
|
+
new_value: new_name
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
if response.success?
|
|
178
|
+
result = JSON.parse(response.body["data"]["update_board"])
|
|
179
|
+
|
|
180
|
+
if result["success"]
|
|
181
|
+
puts "✓ Board renamed to: #{new_name}"
|
|
182
|
+
true
|
|
183
|
+
else
|
|
184
|
+
puts "✗ Update failed"
|
|
185
|
+
false
|
|
186
|
+
end
|
|
187
|
+
else
|
|
188
|
+
puts "✗ Request failed: #{response.status}"
|
|
189
|
+
false
|
|
190
|
+
end
|
|
191
|
+
rescue Monday::AuthorizationError
|
|
192
|
+
puts "✗ Board not found or no permission"
|
|
193
|
+
false
|
|
194
|
+
rescue Monday::Error => e
|
|
195
|
+
puts "✗ API error: #{e.message}"
|
|
196
|
+
false
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Usage
|
|
200
|
+
update_board_name(client, 1234567890, "Q1 Marketing Campaigns")
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Batch Updates
|
|
204
|
+
|
|
205
|
+
Update multiple attributes sequentially:
|
|
206
|
+
|
|
207
|
+
```ruby
|
|
208
|
+
def update_board_details(client, board_id, name: nil, description: nil)
|
|
209
|
+
updates = []
|
|
210
|
+
|
|
211
|
+
if name
|
|
212
|
+
updates << { attribute: :name, value: name }
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
if description
|
|
216
|
+
updates << { attribute: :description, value: description }
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
updates.each do |update|
|
|
220
|
+
response = client.board.update(
|
|
221
|
+
args: {
|
|
222
|
+
board_id: board_id,
|
|
223
|
+
board_attribute: update[:attribute],
|
|
224
|
+
new_value: update[:value]
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
if response.success?
|
|
229
|
+
result = JSON.parse(response.body["data"]["update_board"])
|
|
230
|
+
|
|
231
|
+
if result["success"]
|
|
232
|
+
puts "✓ Updated #{update[:attribute]}"
|
|
233
|
+
else
|
|
234
|
+
puts "✗ Failed to update #{update[:attribute]}"
|
|
235
|
+
end
|
|
236
|
+
else
|
|
237
|
+
puts "✗ Request failed for #{update[:attribute]}"
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# Usage
|
|
243
|
+
update_board_details(
|
|
244
|
+
client,
|
|
245
|
+
1234567890,
|
|
246
|
+
name: "2024 Marketing Strategy",
|
|
247
|
+
description: "Comprehensive marketing plan for fiscal year 2024"
|
|
248
|
+
)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Output:**
|
|
252
|
+
```
|
|
253
|
+
✓ Updated name
|
|
254
|
+
✓ Updated description
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Error Handling
|
|
258
|
+
|
|
259
|
+
Handle common update errors:
|
|
260
|
+
|
|
261
|
+
```ruby
|
|
262
|
+
def safe_update_board(client, board_id, attribute, value)
|
|
263
|
+
response = client.board.update(
|
|
264
|
+
args: {
|
|
265
|
+
board_id: board_id,
|
|
266
|
+
board_attribute: attribute,
|
|
267
|
+
new_value: value
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
if response.success?
|
|
272
|
+
result = JSON.parse(response.body["data"]["update_board"])
|
|
273
|
+
|
|
274
|
+
if result["success"]
|
|
275
|
+
puts "✓ Successfully updated #{attribute}"
|
|
276
|
+
return true
|
|
277
|
+
else
|
|
278
|
+
puts "✗ Update rejected by API"
|
|
279
|
+
return false
|
|
280
|
+
end
|
|
281
|
+
else
|
|
282
|
+
puts "✗ Request failed with status: #{response.status}"
|
|
283
|
+
|
|
284
|
+
if response.body["error_message"]
|
|
285
|
+
puts " Error: #{response.body['error_message']}"
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
return false
|
|
289
|
+
end
|
|
290
|
+
rescue Monday::AuthorizationError
|
|
291
|
+
puts "✗ No permission to update board #{board_id}"
|
|
292
|
+
false
|
|
293
|
+
rescue Monday::InvalidRequestError => e
|
|
294
|
+
puts "✗ Invalid request: #{e.message}"
|
|
295
|
+
false
|
|
296
|
+
rescue Monday::Error => e
|
|
297
|
+
puts "✗ API error: #{e.message}"
|
|
298
|
+
false
|
|
299
|
+
rescue JSON::ParserError
|
|
300
|
+
puts "✗ Failed to parse response"
|
|
301
|
+
false
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# Usage
|
|
305
|
+
safe_update_board(client, 1234567890, :name, "New Board Name")
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Verify Update
|
|
309
|
+
|
|
310
|
+
Confirm the change was applied:
|
|
311
|
+
|
|
312
|
+
```ruby
|
|
313
|
+
def update_and_verify(client, board_id, attribute, new_value)
|
|
314
|
+
# Update
|
|
315
|
+
response = client.board.update(
|
|
316
|
+
args: {
|
|
317
|
+
board_id: board_id,
|
|
318
|
+
board_attribute: attribute,
|
|
319
|
+
new_value: new_value
|
|
320
|
+
}
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
return false unless response.success?
|
|
324
|
+
|
|
325
|
+
result = JSON.parse(response.body["data"]["update_board"])
|
|
326
|
+
return false unless result["success"]
|
|
327
|
+
|
|
328
|
+
# Verify by querying
|
|
329
|
+
verify_response = client.board.query(
|
|
330
|
+
args: { ids: [board_id] },
|
|
331
|
+
select: ["id", attribute.to_s]
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
if verify_response.success?
|
|
335
|
+
board = verify_response.body.dig("data", "boards", 0)
|
|
336
|
+
current_value = board[attribute.to_s]
|
|
337
|
+
|
|
338
|
+
if current_value == new_value
|
|
339
|
+
puts "✓ Update verified: #{attribute} = '#{new_value}'"
|
|
340
|
+
true
|
|
341
|
+
else
|
|
342
|
+
puts "⚠ Update may not have applied correctly"
|
|
343
|
+
puts " Expected: '#{new_value}'"
|
|
344
|
+
puts " Got: '#{current_value}'"
|
|
345
|
+
false
|
|
346
|
+
end
|
|
347
|
+
else
|
|
348
|
+
puts "⚠ Could not verify update"
|
|
349
|
+
false
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# Usage
|
|
354
|
+
update_and_verify(
|
|
355
|
+
client,
|
|
356
|
+
1234567890,
|
|
357
|
+
:name,
|
|
358
|
+
"Verified Board Name"
|
|
359
|
+
)
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Available Attributes
|
|
363
|
+
|
|
364
|
+
| Attribute | Type | Description |
|
|
365
|
+
|-----------|------|-------------|
|
|
366
|
+
| `:name` | String | Board display name |
|
|
367
|
+
| `:description` | String | Board description text |
|
|
368
|
+
| `:communication` | String | Communication link or meeting ID |
|
|
369
|
+
|
|
370
|
+
::: 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>Attribute Values</span>
|
|
371
|
+
Only these three attributes can be updated via the `update_board` mutation. To change other properties (like permissions or workspace), use different methods.
|
|
372
|
+
:::
|
|
373
|
+
|
|
374
|
+
## Complete Example
|
|
375
|
+
|
|
376
|
+
Full update workflow with error handling:
|
|
377
|
+
|
|
378
|
+
```ruby
|
|
379
|
+
require "monday_ruby"
|
|
380
|
+
require "dotenv/load"
|
|
381
|
+
require "json"
|
|
382
|
+
|
|
383
|
+
Monday.configure do |config|
|
|
384
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
client = Monday::Client.new
|
|
388
|
+
|
|
389
|
+
# Board to update
|
|
390
|
+
board_id = 1234567890
|
|
391
|
+
|
|
392
|
+
puts "\n🔧 Updating Board Settings\n#{'=' * 50}\n"
|
|
393
|
+
|
|
394
|
+
# Update name
|
|
395
|
+
print "Updating name... "
|
|
396
|
+
name_response = client.board.update(
|
|
397
|
+
args: {
|
|
398
|
+
board_id: board_id,
|
|
399
|
+
board_attribute: :name,
|
|
400
|
+
new_value: "2024 Q1 Strategy"
|
|
401
|
+
}
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
if name_response.success?
|
|
405
|
+
result = JSON.parse(name_response.body["data"]["update_board"])
|
|
406
|
+
puts result["success"] ? "✓" : "✗"
|
|
407
|
+
else
|
|
408
|
+
puts "✗ (#{name_response.status})"
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
# Update description
|
|
412
|
+
print "Updating description... "
|
|
413
|
+
desc_response = client.board.update(
|
|
414
|
+
args: {
|
|
415
|
+
board_id: board_id,
|
|
416
|
+
board_attribute: :description,
|
|
417
|
+
new_value: "Strategic planning and execution for Q1 2024"
|
|
418
|
+
}
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
if desc_response.success?
|
|
422
|
+
result = JSON.parse(desc_response.body["data"]["update_board"])
|
|
423
|
+
puts result["success"] ? "✓" : "✗"
|
|
424
|
+
else
|
|
425
|
+
puts "✗ (#{desc_response.status})"
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
# Verify changes
|
|
429
|
+
puts "\nVerifying updates..."
|
|
430
|
+
verify_response = client.board.query(
|
|
431
|
+
args: { ids: [board_id] },
|
|
432
|
+
select: ["id", "name", "description"]
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
if verify_response.success?
|
|
436
|
+
board = verify_response.body.dig("data", "boards", 0)
|
|
437
|
+
|
|
438
|
+
puts "\n#{'=' * 50}"
|
|
439
|
+
puts "Updated Board:"
|
|
440
|
+
puts " Name: #{board['name']}"
|
|
441
|
+
puts " Description: #{board['description']}"
|
|
442
|
+
puts "#{'=' * 50}\n"
|
|
443
|
+
else
|
|
444
|
+
puts "✗ Could not verify changes"
|
|
445
|
+
end
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
## Next Steps
|
|
449
|
+
|
|
450
|
+
- [Archive boards](/guides/boards/delete)
|
|
451
|
+
- [Duplicate boards](/guides/boards/duplicate)
|
|
452
|
+
- [Query boards](/guides/boards/query)
|
|
453
|
+
- [Work with columns](/guides/columns/create)
|