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,208 @@
1
+ # Account
2
+
3
+ Access your monday.com account information via the `client.account` 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 is an Account?</span>
6
+ Your monday.com account represents your organization's account with billing, subscription, and account-level settings.
7
+ :::
8
+
9
+ ## Methods
10
+
11
+ ### query
12
+
13
+ Retrieves your monday.com account information.
14
+
15
+ ```ruby
16
+ client.account.query(select: DEFAULT_SELECT)
17
+ ```
18
+
19
+ **Parameters:**
20
+
21
+ | Name | Type | Default | Description |
22
+ |------|------|---------|-------------|
23
+ | `select` | Array | `["id", "name"]` | Fields to retrieve |
24
+
25
+ **Returns:** `Monday::Response`
26
+
27
+ **Response Structure:**
28
+
29
+ The account is nested under users:
30
+
31
+ ```ruby
32
+ users = response.body.dig("data", "users")
33
+ account = users.first&.dig("account")
34
+ ```
35
+
36
+ **Available Fields:**
37
+
38
+ - `id` - Account ID
39
+ - `name` - Account name
40
+ - `slug` - Account URL slug
41
+ - `plan` - Subscription plan information
42
+ - `tier` - Account tier
43
+ - `country_code` - Account country code
44
+ - `first_day_of_the_week` - Week start day preference
45
+
46
+ **Example:**
47
+
48
+ ```ruby
49
+ require "monday_ruby"
50
+
51
+ Monday.configure do |config|
52
+ config.token = ENV["MONDAY_TOKEN"]
53
+ end
54
+
55
+ client = Monday::Client.new
56
+
57
+ response = client.account.query(
58
+ select: ["id", "name", "slug", "country_code"]
59
+ )
60
+
61
+ if response.success?
62
+ users = response.body.dig("data", "users")
63
+ account = users.first&.dig("account")
64
+
65
+ puts "Account: #{account['name']}"
66
+ puts " ID: #{account['id']}"
67
+ puts " Slug: #{account['slug']}"
68
+ puts " Country: #{account['country_code']}"
69
+ end
70
+ ```
71
+
72
+ **Output:**
73
+ ```
74
+ Account: test-account
75
+ ID: 17545454
76
+ Slug: test-account-slug
77
+ Country: US
78
+ ```
79
+
80
+ **GraphQL:** `query { users { account { ... } } }`
81
+
82
+ **See:** [monday.com account query](https://developer.monday.com/api-reference/reference/account)
83
+
84
+ ## Response Structure
85
+
86
+ All methods return a `Monday::Response` object. Access data using:
87
+
88
+ ```ruby
89
+ response.success? # => true/false
90
+ response.status # => 200
91
+ response.body # => Hash with GraphQL response
92
+ ```
93
+
94
+ ### Typical Response Pattern
95
+
96
+ ```ruby
97
+ response = client.account.query(
98
+ select: ["id", "name", "plan"]
99
+ )
100
+
101
+ if response.success?
102
+ users = response.body.dig("data", "users")
103
+ account = users.first&.dig("account")
104
+
105
+ puts "Account: #{account['name']}"
106
+ puts "Plan: #{account['plan']['tier']}"
107
+ else
108
+ # Handle error
109
+ end
110
+ ```
111
+
112
+ ## Constants
113
+
114
+ ### DEFAULT_SELECT
115
+
116
+ Default fields returned by the account query:
117
+
118
+ ```ruby
119
+ ["id", "name"]
120
+ ```
121
+
122
+ ## Error Handling
123
+
124
+ Common errors when working with accounts:
125
+
126
+ - `Monday::AuthorizationError` - Invalid or missing API token
127
+ - `Monday::Error` - Invalid field requested
128
+
129
+ **Example:**
130
+
131
+ ```ruby
132
+ begin
133
+ response = client.account.query(
134
+ select: ["id", "name", "invalid_field"]
135
+ )
136
+ rescue Monday::Error => e
137
+ puts "Error: #{e.message}"
138
+ end
139
+ ```
140
+
141
+ See the [Error Handling guide](/guides/advanced/errors) for more details.
142
+
143
+ ## Use Cases
144
+
145
+ ### Check Account Information
146
+
147
+ ```ruby
148
+ response = client.account.query(
149
+ select: ["id", "name", "slug"]
150
+ )
151
+
152
+ if response.success?
153
+ users = response.body.dig("data", "users")
154
+ account = users.first&.dig("account")
155
+
156
+ puts "Connected to: #{account['name']}"
157
+ end
158
+ ```
159
+
160
+ ### Verify Account Tier
161
+
162
+ ```ruby
163
+ response = client.account.query(
164
+ select: ["id", "name", "tier"]
165
+ )
166
+
167
+ if response.success?
168
+ users = response.body.dig("data", "users")
169
+ account = users.first&.dig("account")
170
+
171
+ if account["tier"] == "enterprise"
172
+ puts "Enterprise account detected"
173
+ end
174
+ end
175
+ ```
176
+
177
+ ### Get Account Settings
178
+
179
+ ```ruby
180
+ response = client.account.query(
181
+ select: [
182
+ "id",
183
+ "name",
184
+ "country_code",
185
+ "first_day_of_the_week"
186
+ ]
187
+ )
188
+
189
+ if response.success?
190
+ users = response.body.dig("data", "users")
191
+ account = users.first&.dig("account")
192
+
193
+ puts "Settings:"
194
+ puts " Country: #{account['country_code']}"
195
+ puts " Week starts: #{account['first_day_of_the_week']}"
196
+ end
197
+ ```
198
+
199
+ ## Related Resources
200
+
201
+ - [Workspace](/reference/resources/workspace) - Workspaces within your account
202
+ - [Board](/reference/resources/board) - Boards in your account
203
+ - [Client](/reference/client) - Client authentication
204
+
205
+ ## External References
206
+
207
+ - [monday.com Account API](https://developer.monday.com/api-reference/reference/account)
208
+ - [GraphQL API Overview](https://developer.monday.com/api-reference/docs/introduction-to-graphql)
@@ -0,0 +1,369 @@
1
+ # Activity Log
2
+
3
+ Access board activity logs via the `client.activity_log` 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 Activity Logs?</span>
6
+ Activity logs track all changes and events that occur on a board, including item creation, column changes, updates, and more.
7
+ :::
8
+
9
+ ## Methods
10
+
11
+ ### query
12
+
13
+ Retrieves activity logs for one or more boards.
14
+
15
+ ```ruby
16
+ client.activity_log.query(board_ids, args: {}, select: DEFAULT_SELECT)
17
+ ```
18
+
19
+ **Parameters:**
20
+
21
+ | Name | Type | Default | Description |
22
+ |------|------|---------|-------------|
23
+ | `board_ids` | Integer or Array | - | Board ID(s) to retrieve logs for (required) |
24
+ | `args` | Hash | `{}` | Query arguments for filtering |
25
+ | `select` | Array | `["id", "event", "data"]` | Fields to retrieve |
26
+
27
+ **Returns:** `Monday::Response`
28
+
29
+ **Common args:**
30
+ - `limit` - Integer - Maximum number of logs to return (default: 25, max: 100)
31
+ - `page` - Integer - Page number for pagination
32
+ - `from` - String - ISO 8601 timestamp to start from
33
+ - `to` - String - ISO 8601 timestamp to end at
34
+ - `user_ids` - Array - Filter by specific user IDs
35
+
36
+ **Available Fields:**
37
+
38
+ - `id` - Activity log ID (UUID)
39
+ - `event` - Event type (e.g., "create_pulse", "update_board_name", "create_column")
40
+ - `data` - JSON string with event details
41
+ - `created_at` - When the event occurred
42
+ - `entity` - Entity type (e.g., "pulse", "board", "column")
43
+ - `user_id` - ID of user who performed the action
44
+ - `account_id` - Account ID
45
+
46
+ **Response Structure:**
47
+
48
+ Activity logs are nested under boards:
49
+
50
+ ```ruby
51
+ boards = response.body.dig("data", "boards")
52
+ logs = boards.first&.dig("activity_logs") || []
53
+ ```
54
+
55
+ **Event Types:**
56
+
57
+ Common event types include:
58
+
59
+ - `create_pulse` - Item created
60
+ - `update_name` - Item name changed
61
+ - `create_column` - Column created
62
+ - `update_column_value` - Column value updated
63
+ - `create_group` - Group created
64
+ - `update_board_name` - Board name changed
65
+ - `archive_pulse` - Item archived
66
+ - `delete_pulse` - Item deleted
67
+ - `move_pulse_to_group` - Item moved to different group
68
+
69
+ **Example:**
70
+
71
+ ```ruby
72
+ require "monday_ruby"
73
+
74
+ Monday.configure do |config|
75
+ config.token = ENV["MONDAY_TOKEN"]
76
+ end
77
+
78
+ client = Monday::Client.new
79
+
80
+ response = client.activity_log.query(
81
+ 1234567890, # board_id
82
+ args: { limit: 50 }
83
+ )
84
+
85
+ if response.success?
86
+ boards = response.body.dig("data", "boards")
87
+ logs = boards.first&.dig("activity_logs") || []
88
+
89
+ puts "Found #{logs.length} activity logs"
90
+ logs.each do |log|
91
+ puts " • #{log['event']}: #{log['id']}"
92
+ end
93
+ end
94
+ ```
95
+
96
+ **Output:**
97
+ ```
98
+ Found 5 activity logs
99
+ • create_pulse: 3d4cf392-99d5-44ed-a4ed-9cdf1bf80e3f
100
+ • board_workspace_id_changed: f77e1ec3-f425-40da-ba71-7cc3a711c7f1
101
+ • update_board_name: 25b65ed3-f3ff-49bd-bc53-62617d6a18d5
102
+ • create_column: e8850206-aad9-46ee-8b05-ce1c5d57f9f8
103
+ • create_group: ed844d08-093a-46e6-ab41-e8700c530d83
104
+ ```
105
+
106
+ **GraphQL:** `query { boards { activity_logs { ... } } }`
107
+
108
+ **See:** [monday.com activity_logs query](https://developer.monday.com/api-reference/reference/activity-logs)
109
+
110
+ ## Parse Activity Data
111
+
112
+ Activity log data is returned as a JSON string. Parse it to access details:
113
+
114
+ ```ruby
115
+ require "json"
116
+
117
+ response = client.activity_log.query(
118
+ 1234567890,
119
+ args: { limit: 10 },
120
+ select: ["id", "event", "data", "created_at"]
121
+ )
122
+
123
+ if response.success?
124
+ boards = response.body.dig("data", "boards")
125
+ logs = boards.first&.dig("activity_logs") || []
126
+
127
+ logs.each do |log|
128
+ data = JSON.parse(log["data"])
129
+
130
+ case log["event"]
131
+ when "create_pulse"
132
+ puts "Item created: #{data['pulse_name']} (ID: #{data['pulse_id']})"
133
+ when "update_column_value"
134
+ puts "Column updated: #{data['column_id']} on item #{data['pulse_id']}"
135
+ when "create_group"
136
+ puts "Group created: #{data['group_title']}"
137
+ end
138
+ end
139
+ end
140
+ ```
141
+
142
+ ## Filter by Time Range
143
+
144
+ Retrieve logs for a specific time period:
145
+
146
+ ```ruby
147
+ response = client.activity_log.query(
148
+ 1234567890,
149
+ args: {
150
+ from: "2024-01-01T00:00:00Z",
151
+ to: "2024-12-31T23:59:59Z",
152
+ limit: 100
153
+ },
154
+ select: ["id", "event", "created_at"]
155
+ )
156
+
157
+ if response.success?
158
+ boards = response.body.dig("data", "boards")
159
+ logs = boards.first&.dig("activity_logs") || []
160
+
161
+ puts "Activity from Jan 1 to Dec 31, 2024: #{logs.length} events"
162
+ end
163
+ ```
164
+
165
+ ## Filter by User
166
+
167
+ Get activity logs for specific users:
168
+
169
+ ```ruby
170
+ response = client.activity_log.query(
171
+ 1234567890,
172
+ args: {
173
+ user_ids: [12345678, 87654321],
174
+ limit: 50
175
+ },
176
+ select: ["id", "event", "user_id", "created_at"]
177
+ )
178
+
179
+ if response.success?
180
+ boards = response.body.dig("data", "boards")
181
+ logs = boards.first&.dig("activity_logs") || []
182
+
183
+ puts "User activity: #{logs.length} events"
184
+ end
185
+ ```
186
+
187
+ ## Multiple Boards
188
+
189
+ Query logs from multiple boards:
190
+
191
+ ```ruby
192
+ response = client.activity_log.query(
193
+ [1234567890, 2345678901], # Multiple board IDs
194
+ args: { limit: 25 },
195
+ select: ["id", "event", "created_at"]
196
+ )
197
+
198
+ if response.success?
199
+ boards = response.body.dig("data", "boards")
200
+
201
+ boards.each do |board|
202
+ logs = board["activity_logs"] || []
203
+ puts "Board #{board['id']}: #{logs.length} recent events"
204
+ end
205
+ end
206
+ ```
207
+
208
+ ## Response Structure
209
+
210
+ All methods return a `Monday::Response` object. Access data using:
211
+
212
+ ```ruby
213
+ response.success? # => true/false
214
+ response.status # => 200
215
+ response.body # => Hash with GraphQL response
216
+ ```
217
+
218
+ ### Typical Response Pattern
219
+
220
+ ```ruby
221
+ response = client.activity_log.query(
222
+ 1234567890,
223
+ args: { limit: 10 }
224
+ )
225
+
226
+ if response.success?
227
+ boards = response.body.dig("data", "boards")
228
+ logs = boards.first&.dig("activity_logs") || []
229
+
230
+ # Work with logs
231
+ else
232
+ # Handle error
233
+ end
234
+ ```
235
+
236
+ ## Constants
237
+
238
+ ### DEFAULT_SELECT
239
+
240
+ Default fields returned by the activity log query:
241
+
242
+ ```ruby
243
+ ["id", "event", "data"]
244
+ ```
245
+
246
+ ## Error Handling
247
+
248
+ Common errors when working with activity logs:
249
+
250
+ - `Monday::AuthorizationError` - Invalid or missing API token
251
+ - `Monday::InvalidRequestError` - Invalid board ID
252
+ - `Monday::Error` - Invalid field or other API errors
253
+
254
+ **Example:**
255
+
256
+ ```ruby
257
+ begin
258
+ response = client.activity_log.query(
259
+ 123, # Invalid ID
260
+ args: { limit: 10 }
261
+ )
262
+ rescue Monday::InvalidRequestError => e
263
+ puts "Error: #{e.message}"
264
+ end
265
+ ```
266
+
267
+ See the [Error Handling guide](/guides/advanced/errors) for more details.
268
+
269
+ ## Use Cases
270
+
271
+ ### Audit Trail
272
+
273
+ Track all changes on a board:
274
+
275
+ ```ruby
276
+ require "json"
277
+
278
+ response = client.activity_log.query(
279
+ 1234567890,
280
+ args: {
281
+ from: "2024-01-01T00:00:00Z",
282
+ limit: 100
283
+ },
284
+ select: ["id", "event", "data", "created_at", "user_id"]
285
+ )
286
+
287
+ if response.success?
288
+ boards = response.body.dig("data", "boards")
289
+ logs = boards.first&.dig("activity_logs") || []
290
+
291
+ puts "Audit Trail"
292
+ puts "=" * 60
293
+
294
+ logs.each do |log|
295
+ data = JSON.parse(log["data"])
296
+ timestamp = log["created_at"]
297
+ user_id = log["user_id"]
298
+
299
+ puts "\n[#{timestamp}] User #{user_id}"
300
+ puts " Event: #{log['event']}"
301
+ puts " Details: #{data.inspect}"
302
+ end
303
+ end
304
+ ```
305
+
306
+ ### Monitor Item Creation
307
+
308
+ Track when new items are created:
309
+
310
+ ```ruby
311
+ require "json"
312
+
313
+ response = client.activity_log.query(
314
+ 1234567890,
315
+ args: { limit: 100 },
316
+ select: ["id", "event", "data", "created_at"]
317
+ )
318
+
319
+ if response.success?
320
+ boards = response.body.dig("data", "boards")
321
+ logs = boards.first&.dig("activity_logs") || []
322
+
323
+ created_items = logs.select { |log| log["event"] == "create_pulse" }
324
+
325
+ puts "Recently Created Items:"
326
+ created_items.each do |log|
327
+ data = JSON.parse(log["data"])
328
+ puts " • #{data['pulse_name']} (ID: #{data['pulse_id']})"
329
+ end
330
+ end
331
+ ```
332
+
333
+ ### Track Column Changes
334
+
335
+ Monitor column value updates:
336
+
337
+ ```ruby
338
+ require "json"
339
+
340
+ response = client.activity_log.query(
341
+ 1234567890,
342
+ args: { limit: 50 },
343
+ select: ["id", "event", "data"]
344
+ )
345
+
346
+ if response.success?
347
+ boards = response.body.dig("data", "boards")
348
+ logs = boards.first&.dig("activity_logs") || []
349
+
350
+ column_updates = logs.select { |log| log["event"] == "update_column_value" }
351
+
352
+ puts "Column Updates: #{column_updates.length}"
353
+ column_updates.each do |log|
354
+ data = JSON.parse(log["data"])
355
+ puts " • Column '#{data['column_id']}' updated on item #{data['pulse_id']}"
356
+ end
357
+ end
358
+ ```
359
+
360
+ ## Related Resources
361
+
362
+ - [Board](/reference/resources/board) - Boards containing activity logs
363
+ - [Item](/reference/resources/item) - Items tracked in activity logs
364
+ - [Update](/reference/resources/update) - Updates/comments on items
365
+
366
+ ## External References
367
+
368
+ - [monday.com Activity Logs API](https://developer.monday.com/api-reference/reference/activity-logs)
369
+ - [GraphQL API Overview](https://developer.monday.com/api-reference/docs/introduction-to-graphql)