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,502 @@
1
+ # Manage Workspaces
2
+
3
+ Learn how to create, query, and delete workspaces programmatically to organize your boards and teams.
4
+
5
+ ## What are Workspaces?
6
+
7
+ Workspaces are the top-level organizational structure in monday.com. They help you:
8
+ - Group related boards together (e.g., Marketing, Engineering, Sales)
9
+ - Control access permissions at the team or department level
10
+ - Organize projects by purpose, team, or initiative
11
+
12
+ ## Query Workspaces
13
+
14
+ Retrieve all workspaces in your account:
15
+
16
+ ```ruby
17
+ require "monday_ruby"
18
+
19
+ Monday.configure do |config|
20
+ config.token = ENV["MONDAY_TOKEN"]
21
+ end
22
+
23
+ client = Monday::Client.new
24
+
25
+ response = client.workspace.query
26
+
27
+ if response.success?
28
+ workspaces = response.body.dig("data", "workspaces")
29
+
30
+ puts "Your Workspaces:"
31
+ workspaces.each do |workspace|
32
+ puts " • #{workspace['name']} (ID: #{workspace['id']})"
33
+ end
34
+ end
35
+ ```
36
+
37
+ **Output:**
38
+ ```
39
+ Your Workspaces:
40
+ • Product Team (ID: 7451845)
41
+ • Marketing (ID: 7450850)
42
+ • Main workspace (ID: 7217155)
43
+ ```
44
+
45
+ ### Query with Additional Fields
46
+
47
+ Get more details about your workspaces:
48
+
49
+ ```ruby
50
+ response = client.workspace.query(
51
+ select: [
52
+ "id",
53
+ "name",
54
+ "description",
55
+ "kind",
56
+ "state",
57
+ {
58
+ owners_subscribers: ["id", "name", "email"]
59
+ }
60
+ ]
61
+ )
62
+
63
+ if response.success?
64
+ workspaces = response.body.dig("data", "workspaces")
65
+
66
+ workspaces.each do |workspace|
67
+ puts "\n#{workspace['name']}"
68
+ puts " Description: #{workspace['description'] || 'None'}"
69
+ puts " Type: #{workspace['kind']}"
70
+ puts " State: #{workspace['state']}"
71
+ end
72
+ end
73
+ ```
74
+
75
+ ### Query Specific Workspaces
76
+
77
+ Filter by workspace IDs:
78
+
79
+ ```ruby
80
+ response = client.workspace.query(
81
+ args: { ids: [7451845, 7450850] },
82
+ select: ["id", "name", "description"]
83
+ )
84
+
85
+ if response.success?
86
+ workspaces = response.body.dig("data", "workspaces")
87
+ puts "Found #{workspaces.length} workspace(s)"
88
+ end
89
+ ```
90
+
91
+ ## Create a Workspace
92
+
93
+ ### Basic Workspace Creation
94
+
95
+ Create an open workspace visible to all account members:
96
+
97
+ ```ruby
98
+ response = client.workspace.create(
99
+ args: {
100
+ name: "Product Team",
101
+ kind: :open
102
+ }
103
+ )
104
+
105
+ if response.success?
106
+ workspace = response.body.dig("data", "create_workspace")
107
+ puts "Created workspace: #{workspace['name']}"
108
+ puts "Workspace ID: #{workspace['id']}"
109
+ end
110
+ ```
111
+
112
+ **Output:**
113
+ ```
114
+ Created workspace: Product Team
115
+ Workspace ID: 7451865
116
+ ```
117
+
118
+ ### Create with Description
119
+
120
+ Add context to your workspace:
121
+
122
+ ```ruby
123
+ response = client.workspace.create(
124
+ args: {
125
+ name: "Engineering",
126
+ kind: :open,
127
+ description: "All engineering projects and infrastructure boards"
128
+ }
129
+ )
130
+
131
+ if response.success?
132
+ workspace = response.body.dig("data", "create_workspace")
133
+ puts "Created: #{workspace['name']}"
134
+ puts "Description: #{workspace['description']}"
135
+ end
136
+ ```
137
+
138
+ ### Create a Closed Workspace
139
+
140
+ Create a private workspace for specific teams:
141
+
142
+ ```ruby
143
+ response = client.workspace.create(
144
+ args: {
145
+ name: "Executive Leadership",
146
+ kind: :closed,
147
+ description: "Strategic planning and executive decisions"
148
+ }
149
+ )
150
+
151
+ if response.success?
152
+ workspace = response.body.dig("data", "create_workspace")
153
+ puts "Created closed workspace: #{workspace['name']}"
154
+ puts "ID: #{workspace['id']}"
155
+ end
156
+ ```
157
+
158
+ ::: 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>Workspace Kinds</span>
159
+ - **`:open`** - Visible to all account members
160
+ - **`:closed`** - Visible only to explicitly added members
161
+ :::
162
+
163
+ ## Organize Boards in Workspaces
164
+
165
+ Create boards within a specific workspace:
166
+
167
+ ```ruby
168
+ # First, create a workspace
169
+ workspace_response = client.workspace.create(
170
+ args: {
171
+ name: "Marketing Campaigns",
172
+ kind: :open,
173
+ description: "All marketing projects and campaigns"
174
+ }
175
+ )
176
+
177
+ workspace_id = workspace_response.body.dig("data", "create_workspace", "id")
178
+
179
+ # Create a board in that workspace
180
+ board_response = client.board.create(
181
+ args: {
182
+ board_name: "Q1 2024 Campaign",
183
+ board_kind: :public,
184
+ workspace_id: workspace_id.to_i
185
+ }
186
+ )
187
+
188
+ if board_response.success?
189
+ board = board_response.body.dig("data", "create_board")
190
+ puts "Created board '#{board['name']}' in workspace #{workspace_id}"
191
+ end
192
+ ```
193
+
194
+ ### Query Boards by Workspace
195
+
196
+ Find all boards in a specific workspace:
197
+
198
+ ```ruby
199
+ workspace_id = 7451865
200
+
201
+ response = client.board.query(
202
+ args: { workspace_ids: [workspace_id] },
203
+ select: ["id", "name", "workspace_id"]
204
+ )
205
+
206
+ if response.success?
207
+ boards = response.body.dig("data", "boards")
208
+
209
+ puts "Boards in workspace #{workspace_id}:"
210
+ boards.each do |board|
211
+ puts " • #{board['name']} (ID: #{board['id']})"
212
+ end
213
+ end
214
+ ```
215
+
216
+ ## Delete a Workspace
217
+
218
+ ::: 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>
219
+ Deleting a workspace is irreversible. All boards within the workspace will also be deleted. Always confirm before deletion.
220
+ :::
221
+
222
+ ### Basic Deletion
223
+
224
+ ```ruby
225
+ workspace_id = 7451868
226
+
227
+ response = client.workspace.delete(workspace_id)
228
+
229
+ if response.success?
230
+ deleted = response.body.dig("data", "delete_workspace")
231
+ puts "Deleted workspace ID: #{deleted['id']}"
232
+ end
233
+ ```
234
+
235
+ ### Safe Deletion with Confirmation
236
+
237
+ Implement a confirmation check before deletion:
238
+
239
+ ```ruby
240
+ def delete_workspace_safe(client, workspace_id)
241
+ # First, check if workspace exists
242
+ query_response = client.workspace.query(
243
+ args: { ids: [workspace_id] },
244
+ select: ["id", "name"]
245
+ )
246
+
247
+ workspaces = query_response.body.dig("data", "workspaces")
248
+
249
+ if workspaces.empty?
250
+ puts "Workspace #{workspace_id} not found"
251
+ return false
252
+ end
253
+
254
+ workspace = workspaces.first
255
+ puts "About to delete workspace: #{workspace['name']}"
256
+ print "Type 'DELETE' to confirm: "
257
+
258
+ confirmation = gets.chomp
259
+
260
+ if confirmation == "DELETE"
261
+ response = client.workspace.delete(workspace_id)
262
+
263
+ if response.success?
264
+ puts "Workspace deleted successfully"
265
+ true
266
+ else
267
+ puts "Failed to delete workspace"
268
+ false
269
+ end
270
+ else
271
+ puts "Deletion cancelled"
272
+ false
273
+ end
274
+ end
275
+
276
+ # Usage
277
+ delete_workspace_safe(client, 7451868)
278
+ ```
279
+
280
+ ## Error Handling
281
+
282
+ Handle common workspace errors:
283
+
284
+ ```ruby
285
+ def create_workspace_safe(client, name, kind, description = nil)
286
+ response = client.workspace.create(
287
+ args: {
288
+ name: name,
289
+ kind: kind,
290
+ description: description
291
+ }.compact
292
+ )
293
+
294
+ if response.success?
295
+ workspace = response.body.dig("data", "create_workspace")
296
+ puts "Created workspace: #{workspace['name']}"
297
+ workspace['id']
298
+ else
299
+ puts "Failed to create workspace"
300
+
301
+ if response.body["errors"]
302
+ response.body["errors"].each do |error|
303
+ puts " Error: #{error['message']}"
304
+ end
305
+ end
306
+
307
+ nil
308
+ end
309
+ rescue Monday::AuthorizationError
310
+ puts "Invalid API token"
311
+ nil
312
+ rescue Monday::InvalidRequestError => e
313
+ puts "Invalid request: #{e.message}"
314
+ nil
315
+ rescue Monday::Error => e
316
+ puts "API error: #{e.message}"
317
+ nil
318
+ end
319
+
320
+ # Usage
321
+ workspace_id = create_workspace_safe(client, "New Workspace", :open, "Description")
322
+ ```
323
+
324
+ ### Handle Invalid Workspace ID
325
+
326
+ ```ruby
327
+ workspace_id = 123 # Non-existent workspace
328
+
329
+ begin
330
+ response = client.workspace.delete(workspace_id)
331
+ rescue Monday::InvalidRequestError => e
332
+ if e.message.include?("InvalidWorkspaceIdException")
333
+ puts "Workspace #{workspace_id} does not exist"
334
+ else
335
+ puts "Error: #{e.message}"
336
+ end
337
+ end
338
+ ```
339
+
340
+ ## Complete Example
341
+
342
+ Full workflow for managing workspaces:
343
+
344
+ ```ruby
345
+ require "monday_ruby"
346
+ require "dotenv/load"
347
+
348
+ Monday.configure do |config|
349
+ config.token = ENV["MONDAY_TOKEN"]
350
+ end
351
+
352
+ client = Monday::Client.new
353
+
354
+ # 1. Create a new workspace
355
+ puts "1. Creating workspace..."
356
+ create_response = client.workspace.create(
357
+ args: {
358
+ name: "Product Development",
359
+ kind: :open,
360
+ description: "All product engineering and design work"
361
+ }
362
+ )
363
+
364
+ if create_response.success?
365
+ workspace = create_response.body.dig("data", "create_workspace")
366
+ workspace_id = workspace["id"]
367
+
368
+ puts " Created: #{workspace['name']}"
369
+ puts " ID: #{workspace_id}"
370
+ puts " Description: #{workspace['description']}"
371
+
372
+ # 2. Create boards in the workspace
373
+ puts "\n2. Creating boards in workspace..."
374
+
375
+ ["Backend API", "Frontend App", "Design System"].each do |board_name|
376
+ board_response = client.board.create(
377
+ args: {
378
+ board_name: board_name,
379
+ board_kind: :public,
380
+ workspace_id: workspace_id.to_i
381
+ }
382
+ )
383
+
384
+ if board_response.success?
385
+ board = board_response.body.dig("data", "create_board")
386
+ puts " Created board: #{board['name']}"
387
+ end
388
+ end
389
+
390
+ # 3. Query all workspaces
391
+ puts "\n3. Listing all workspaces..."
392
+ list_response = client.workspace.query(
393
+ select: ["id", "name", "description"]
394
+ )
395
+
396
+ if list_response.success?
397
+ workspaces = list_response.body.dig("data", "workspaces")
398
+ workspaces.each do |ws|
399
+ puts " • #{ws['name']} (#{ws['id']})"
400
+ end
401
+ end
402
+
403
+ # 4. Query boards in the workspace
404
+ puts "\n4. Boards in #{workspace['name']}:"
405
+ boards_response = client.board.query(
406
+ args: { workspace_ids: [workspace_id.to_i] },
407
+ select: ["id", "name"]
408
+ )
409
+
410
+ if boards_response.success?
411
+ boards = boards_response.body.dig("data", "boards")
412
+ boards.each do |board|
413
+ puts " • #{board['name']}"
414
+ end
415
+ end
416
+
417
+ puts "\nWorkspace setup complete!"
418
+ else
419
+ puts "Failed to create workspace"
420
+ end
421
+ ```
422
+
423
+ ## Best Practices
424
+
425
+ ### 1. Use Descriptive Names
426
+
427
+ Choose clear, meaningful workspace names:
428
+
429
+ ```ruby
430
+ # Good
431
+ client.workspace.create(args: { name: "Marketing - Q1 2024", kind: :open })
432
+ client.workspace.create(args: { name: "Engineering - Infrastructure", kind: :open })
433
+
434
+ # Avoid
435
+ client.workspace.create(args: { name: "Workspace 1", kind: :open })
436
+ client.workspace.create(args: { name: "Misc", kind: :open })
437
+ ```
438
+
439
+ ### 2. Add Descriptions
440
+
441
+ Always include descriptions for clarity:
442
+
443
+ ```ruby
444
+ client.workspace.create(
445
+ args: {
446
+ name: "Customer Success",
447
+ kind: :open,
448
+ description: "Customer onboarding, support, and success initiatives"
449
+ }
450
+ )
451
+ ```
452
+
453
+ ### 3. Choose Appropriate Privacy
454
+
455
+ Select the right workspace kind:
456
+
457
+ ```ruby
458
+ # Public projects - use :open
459
+ client.workspace.create(
460
+ args: { name: "Company Events", kind: :open }
461
+ )
462
+
463
+ # Sensitive information - use :closed
464
+ client.workspace.create(
465
+ args: { name: "HR & Recruiting", kind: :closed }
466
+ )
467
+ ```
468
+
469
+ ### 4. Organize Logically
470
+
471
+ Group related boards:
472
+
473
+ ```ruby
474
+ # Create workspace for a specific team
475
+ workspace = client.workspace.create(
476
+ args: {
477
+ name: "Sales Team",
478
+ kind: :open,
479
+ description: "Sales pipeline, accounts, and opportunities"
480
+ }
481
+ )
482
+
483
+ workspace_id = workspace.body.dig("data", "create_workspace", "id").to_i
484
+
485
+ # Add related boards
486
+ ["Pipeline", "Accounts", "Opportunities", "Reports"].each do |name|
487
+ client.board.create(
488
+ args: {
489
+ board_name: name,
490
+ board_kind: :public,
491
+ workspace_id: workspace_id
492
+ }
493
+ )
494
+ end
495
+ ```
496
+
497
+ ## Next Steps
498
+
499
+ - [Create boards](/guides/boards/create) in your workspaces
500
+ - [Query boards](/guides/boards/query) by workspace
501
+ - [Manage folders](/guides/folders/manage) within workspaces
502
+ - [Organize groups](/guides/groups/manage) across boards
data/docs/index.md ADDED
@@ -0,0 +1,69 @@
1
+ # monday_ruby
2
+
3
+ A Ruby client library for the monday.com GraphQL API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ gem install monday_ruby
9
+ ```
10
+
11
+ Or add to your Gemfile:
12
+
13
+ ```ruby
14
+ gem 'monday_ruby'
15
+ ```
16
+
17
+ ## Quick Example
18
+
19
+ ```ruby
20
+ require "monday_ruby"
21
+
22
+ Monday.configure do |config|
23
+ config.token = ENV["MONDAY_TOKEN"]
24
+ end
25
+
26
+ client = Monday::Client.new
27
+ response = client.boards
28
+
29
+ boards = response.body.dig("data", "boards")
30
+ ```
31
+
32
+ ## Documentation
33
+
34
+ ### New to monday_ruby?
35
+
36
+ **[Start with the tutorial →](/tutorial/first-integration)**
37
+
38
+ Learn by building your first monday.com integration. Takes about 15 minutes.
39
+
40
+ ### Looking for specific solutions?
41
+
42
+ **[Browse how-to guides →](/guides/installation)**
43
+
44
+ Task-based guides for common scenarios: creating boards, managing items, handling pagination, and more.
45
+
46
+ ### Need API details?
47
+
48
+ **[Check the API reference →](/reference/client)**
49
+
50
+ Complete documentation for all resources, methods, parameters, and return values.
51
+
52
+ ---
53
+
54
+ ## Requirements
55
+
56
+ - Ruby 2.7 or higher
57
+ - A monday.com account with API access
58
+ - A monday.com API token
59
+
60
+ ## Resources
61
+
62
+ - [GitHub Repository](https://github.com/sanifhimani/monday_ruby)
63
+ - [RubyGems Package](https://rubygems.org/gems/monday_ruby)
64
+ - [monday.com API Documentation](https://developer.monday.com/api-reference/docs)
65
+ - [Report an Issue](https://github.com/sanifhimani/monday_ruby/issues)
66
+
67
+ ## Support
68
+
69
+ Need help? Check the [how-to guides](/guides/installation) or [open an issue](https://github.com/sanifhimani/monday_ruby/issues) on GitHub.