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,285 @@
1
+ # Make Your First Request
2
+
3
+ Query boards from your monday.com account using the Ruby client.
4
+
5
+ ## Prerequisites
6
+
7
+ - [Installed and configured](/guides/installation) monday_ruby
8
+ - [Set up authentication](/guides/authentication) with your API token
9
+
10
+ ## Basic Query
11
+
12
+ The simplest request fetches all boards you have access to:
13
+
14
+ ```ruby
15
+ require "monday_ruby"
16
+
17
+ Monday.configure do |config|
18
+ config.token = ENV["MONDAY_TOKEN"]
19
+ end
20
+
21
+ client = Monday::Client.new
22
+ response = client.board.query
23
+ ```
24
+
25
+ This returns all boards with their ID, name, and description.
26
+
27
+ ## Check Response Status
28
+
29
+ Always verify the request succeeded:
30
+
31
+ ```ruby
32
+ client = Monday::Client.new
33
+ response = client.board.query
34
+
35
+ if response.success?
36
+ puts "Request succeeded!"
37
+ puts "Status code: #{response.status}"
38
+ else
39
+ puts "Request failed: #{response.status}"
40
+ end
41
+ ```
42
+
43
+ The `success?` method returns `true` for 2xx status codes and when there are no API errors.
44
+
45
+ ## Access Response Data
46
+
47
+ Extract data from the response body:
48
+
49
+ ```ruby
50
+ response = client.board.query
51
+
52
+ if response.success?
53
+ boards = response.body["data"]["boards"]
54
+
55
+ puts "Found #{boards.length} boards:\n"
56
+
57
+ boards.each do |board|
58
+ puts " • #{board['name']} (ID: #{board['id']})"
59
+ end
60
+ end
61
+ ```
62
+
63
+ **Example output:**
64
+ ```
65
+ Found 3 boards:
66
+ • Marketing Campaigns (ID: 1234567890)
67
+ • Product Roadmap (ID: 2345678901)
68
+ • Team Tasks (ID: 3456789012)
69
+ ```
70
+
71
+ ## Using dig for Safe Access
72
+
73
+ Use `dig` to safely navigate nested hashes:
74
+
75
+ ```ruby
76
+ response = client.board.query
77
+
78
+ boards = response.body.dig("data", "boards")
79
+
80
+ if boards
81
+ first_board = boards.first
82
+ board_name = first_board.dig("name")
83
+
84
+ puts "First board: #{board_name}"
85
+ else
86
+ puts "No boards found"
87
+ end
88
+ ```
89
+
90
+ This prevents `NoMethodError` if keys don't exist.
91
+
92
+ ## Filter Results
93
+
94
+ Query specific boards by ID:
95
+
96
+ ```ruby
97
+ response = client.board.query(
98
+ args: { ids: [1234567890, 2345678901] }
99
+ )
100
+
101
+ if response.success?
102
+ boards = response.body.dig("data", "boards")
103
+ puts "Retrieved #{boards.length} specific boards"
104
+ end
105
+ ```
106
+
107
+ ## Customize Fields
108
+
109
+ Select only the fields you need:
110
+
111
+ ```ruby
112
+ response = client.board.query(
113
+ select: ["id", "name"] # Skip description
114
+ )
115
+
116
+ if response.success?
117
+ boards = response.body.dig("data", "boards")
118
+
119
+ boards.each do |board|
120
+ # Only id and name are present
121
+ puts "#{board['id']}: #{board['name']}"
122
+ end
123
+ end
124
+ ```
125
+
126
+ ::: 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>Performance Tip</span>
127
+ Only request fields you need. Smaller responses are faster and use less bandwidth.
128
+ :::
129
+
130
+ ## Query Nested Data
131
+
132
+ Fetch boards with their items:
133
+
134
+ ```ruby
135
+ response = client.board.query(
136
+ args: { ids: [1234567890] },
137
+ select: [
138
+ "id",
139
+ "name",
140
+ {
141
+ items: ["id", "name"]
142
+ }
143
+ ]
144
+ )
145
+
146
+ if response.success?
147
+ board = response.body.dig("data", "boards", 0)
148
+
149
+ puts "Board: #{board['name']}"
150
+ puts "Items:"
151
+
152
+ board["items"].each do |item|
153
+ puts " • #{item['name']}"
154
+ end
155
+ end
156
+ ```
157
+
158
+ **Example output:**
159
+ ```
160
+ Board: Marketing Campaigns
161
+ Items:
162
+ • Q1 Campaign Plan
163
+ • Social Media Strategy
164
+ • Email Newsletter Design
165
+ ```
166
+
167
+ ## Response Structure
168
+
169
+ All responses follow this structure:
170
+
171
+ ```ruby
172
+ {
173
+ "data" => {
174
+ "boards" => [
175
+ {
176
+ "id" => "1234567890",
177
+ "name" => "Board Name",
178
+ "description" => "Board description"
179
+ }
180
+ ]
181
+ }
182
+ }
183
+ ```
184
+
185
+ The root `data` key contains the query results. Resource arrays (like `boards`) are always arrays, even for single items.
186
+
187
+ ## Handle Errors
188
+
189
+ Check for specific error conditions:
190
+
191
+ ```ruby
192
+ response = client.board.query
193
+
194
+ if response.success?
195
+ boards = response.body.dig("data", "boards")
196
+ puts "Success! Found #{boards.length} boards"
197
+ else
198
+ puts "Request failed with status: #{response.status}"
199
+
200
+ # Check for API errors
201
+ if response.body["errors"]
202
+ puts "API Errors:"
203
+ response.body["errors"].each do |error|
204
+ puts " • #{error['message']}"
205
+ end
206
+ end
207
+ end
208
+ ```
209
+
210
+ ## Common Response Codes
211
+
212
+ | Code | Meaning | Action |
213
+ |------|---------|--------|
214
+ | 200 | Success | Process the data |
215
+ | 401 | Unauthorized | Check your API token |
216
+ | 429 | Rate limited | Wait and retry |
217
+ | 500 | Server error | Retry with backoff |
218
+
219
+ ::: 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>200 Doesn't Always Mean Success</span>
220
+ monday.com returns status 200 even for some errors. Always check `response.success?` which also validates the response body for error fields.
221
+ :::
222
+
223
+ ## Complete Example
224
+
225
+ Put it all together:
226
+
227
+ ```ruby
228
+ require "monday_ruby"
229
+ require "dotenv/load"
230
+
231
+ Monday.configure do |config|
232
+ config.token = ENV["MONDAY_TOKEN"]
233
+ end
234
+
235
+ client = Monday::Client.new
236
+
237
+ # Query boards with items
238
+ response = client.board.query(
239
+ args: { limit: 5 },
240
+ select: [
241
+ "id",
242
+ "name",
243
+ "description",
244
+ {
245
+ items: ["id", "name"]
246
+ }
247
+ ]
248
+ )
249
+
250
+ if response.success?
251
+ boards = response.body.dig("data", "boards")
252
+
253
+ puts "\n📋 Your Boards\n#{'=' * 50}\n"
254
+
255
+ boards.each do |board|
256
+ puts "\n#{board['name']}"
257
+ puts " ID: #{board['id']}"
258
+ puts " Items: #{board['items']&.length || 0}"
259
+
260
+ if board['description'] && !board['description'].empty?
261
+ puts " Description: #{board['description']}"
262
+ end
263
+ end
264
+
265
+ puts "\n#{'=' * 50}"
266
+ puts "Total: #{boards.length} boards"
267
+ else
268
+ puts "❌ Request failed"
269
+ puts "Status: #{response.status}"
270
+
271
+ if response.body["errors"]
272
+ puts "\nErrors:"
273
+ response.body["errors"].each do |error|
274
+ puts " • #{error['message']}"
275
+ end
276
+ end
277
+ end
278
+ ```
279
+
280
+ ## Next Steps
281
+
282
+ - [Create a board](/guides/boards/create)
283
+ - [Query boards with advanced filters](/guides/boards/query)
284
+ - [Work with items](/guides/items/create)
285
+ - [Handle errors properly](/guides/advanced/errors)