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.
- checksums.yaml +4 -4
- data/.env +1 -1
- data/.rspec +0 -1
- data/.rubocop.yml +19 -0
- data/.simplecov +1 -0
- data/CHANGELOG.md +49 -0
- data/CONTRIBUTING.md +165 -0
- data/README.md +167 -88
- 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 +41 -2
- data/lib/monday/configuration.rb +13 -0
- data/lib/monday/deprecation.rb +23 -0
- data/lib/monday/error.rb +5 -2
- data/lib/monday/request.rb +19 -1
- data/lib/monday/resources/base.rb +4 -0
- data/lib/monday/resources/board.rb +52 -0
- data/lib/monday/resources/column.rb +6 -0
- data/lib/monday/resources/file.rb +56 -0
- data/lib/monday/resources/folder.rb +55 -0
- data/lib/monday/resources/group.rb +66 -0
- data/lib/monday/resources/item.rb +62 -0
- data/lib/monday/util.rb +33 -1
- data/lib/monday/version.rb +1 -1
- data/lib/monday_ruby.rb +1 -0
- metadata +92 -11
- data/monday_ruby.gemspec +0 -39
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
Manage global and client-specific configuration for the monday_ruby gem.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The `Monday::Configuration` class controls how the gem connects to the monday.com API. You can set configuration globally for all clients or customize it per-client instance.
|
|
8
|
+
|
|
9
|
+
## Configuration Options
|
|
10
|
+
|
|
11
|
+
All configuration options with their types, defaults, and descriptions:
|
|
12
|
+
|
|
13
|
+
| Option | Type | Default | Description |
|
|
14
|
+
|--------|------|---------|-------------|
|
|
15
|
+
| `token` | String | `nil` | API authentication token (required for all requests) |
|
|
16
|
+
| `host` | String | `"https://api.monday.com/v2"` | monday.com API endpoint URL |
|
|
17
|
+
| `version` | String | `"2023-07"` | API version to use (format: YYYY-MM) |
|
|
18
|
+
| `open_timeout` | Integer | `10` | Seconds to wait for connection to open |
|
|
19
|
+
| `read_timeout` | Integer | `30` | Seconds to wait for response data |
|
|
20
|
+
|
|
21
|
+
## Global Configuration
|
|
22
|
+
|
|
23
|
+
Configure once and use across all clients:
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
require "monday_ruby"
|
|
27
|
+
|
|
28
|
+
Monday.configure do |config|
|
|
29
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
30
|
+
config.version = "2024-10"
|
|
31
|
+
config.open_timeout = 15
|
|
32
|
+
config.read_timeout = 60
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# All clients use global configuration
|
|
36
|
+
client = Monday::Client.new
|
|
37
|
+
response = client.boards
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
::: 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>When to Use Global Configuration</span>
|
|
41
|
+
Use global configuration when your application uses a single monday.com account. This is the most common scenario.
|
|
42
|
+
:::
|
|
43
|
+
|
|
44
|
+
### Accessing Global Config
|
|
45
|
+
|
|
46
|
+
Read global configuration values:
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
Monday.configure do |config|
|
|
50
|
+
config.token = "my_token"
|
|
51
|
+
config.version = "2024-10"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Access global config
|
|
55
|
+
puts Monday.config.token # => "my_token"
|
|
56
|
+
puts Monday.config.version # => "2024-10"
|
|
57
|
+
puts Monday.config.host # => "https://api.monday.com/v2"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Instance Configuration
|
|
61
|
+
|
|
62
|
+
Configure individual clients with different settings:
|
|
63
|
+
|
|
64
|
+
```ruby
|
|
65
|
+
require "monday_ruby"
|
|
66
|
+
|
|
67
|
+
# Client A with token A
|
|
68
|
+
client_a = Monday::Client.new(
|
|
69
|
+
token: ENV["MONDAY_TOKEN_A"],
|
|
70
|
+
version: "2024-10"
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# Client B with token B and longer timeouts
|
|
74
|
+
client_b = Monday::Client.new(
|
|
75
|
+
token: ENV["MONDAY_TOKEN_B"],
|
|
76
|
+
version: "2024-01",
|
|
77
|
+
read_timeout: 120
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# Each client uses its own configuration
|
|
81
|
+
response_a = client_a.boards
|
|
82
|
+
response_b = client_b.boards
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
::: 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>When to Use Instance Configuration</span>
|
|
86
|
+
Use instance configuration for multi-tenant applications or when connecting to multiple monday.com accounts simultaneously.
|
|
87
|
+
:::
|
|
88
|
+
|
|
89
|
+
### Accessing Instance Config
|
|
90
|
+
|
|
91
|
+
Read instance-specific configuration:
|
|
92
|
+
|
|
93
|
+
```ruby
|
|
94
|
+
client = Monday::Client.new(
|
|
95
|
+
token: "my_token",
|
|
96
|
+
version: "2024-10"
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
# Access client's config
|
|
100
|
+
puts client.config.token # => "my_token"
|
|
101
|
+
puts client.config.version # => "2024-10"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Methods
|
|
105
|
+
|
|
106
|
+
### initialize
|
|
107
|
+
|
|
108
|
+
Creates a new configuration instance with optional parameters.
|
|
109
|
+
|
|
110
|
+
```ruby
|
|
111
|
+
config = Monday::Configuration.new(
|
|
112
|
+
token: "your_token",
|
|
113
|
+
version: "2024-10",
|
|
114
|
+
open_timeout: 15,
|
|
115
|
+
read_timeout: 60
|
|
116
|
+
)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Parameters:**
|
|
120
|
+
|
|
121
|
+
- `token` (String, optional) - API authentication token
|
|
122
|
+
- `host` (String, optional) - API endpoint URL
|
|
123
|
+
- `version` (String, optional) - API version
|
|
124
|
+
- `open_timeout` (Integer, optional) - Connection timeout in seconds
|
|
125
|
+
- `read_timeout` (Integer, optional) - Response timeout in seconds
|
|
126
|
+
|
|
127
|
+
**Raises:**
|
|
128
|
+
|
|
129
|
+
- `ArgumentError` - When invalid configuration keys are provided
|
|
130
|
+
|
|
131
|
+
**Example:**
|
|
132
|
+
|
|
133
|
+
```ruby
|
|
134
|
+
# Valid configuration
|
|
135
|
+
config = Monday::Configuration.new(token: "abc123")
|
|
136
|
+
|
|
137
|
+
# Invalid configuration (raises ArgumentError)
|
|
138
|
+
config = Monday::Configuration.new(invalid_key: "value")
|
|
139
|
+
# => ArgumentError: Unknown arguments: [:invalid_key]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### reset
|
|
143
|
+
|
|
144
|
+
Resets all configuration values to their defaults.
|
|
145
|
+
|
|
146
|
+
```ruby
|
|
147
|
+
Monday.configure do |config|
|
|
148
|
+
config.token = "my_token"
|
|
149
|
+
config.version = "2024-10"
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
Monday.config.reset
|
|
153
|
+
|
|
154
|
+
puts Monday.config.token # => nil
|
|
155
|
+
puts Monday.config.version # => "2023-07"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Note:** This method is typically used in test environments to ensure clean state between tests.
|
|
159
|
+
|
|
160
|
+
### Attribute Accessors
|
|
161
|
+
|
|
162
|
+
All configuration fields have getter and setter methods:
|
|
163
|
+
|
|
164
|
+
```ruby
|
|
165
|
+
config = Monday::Configuration.new
|
|
166
|
+
|
|
167
|
+
# Setters
|
|
168
|
+
config.token = "new_token"
|
|
169
|
+
config.version = "2024-10"
|
|
170
|
+
config.host = "https://custom.monday.com/v2"
|
|
171
|
+
config.open_timeout = 20
|
|
172
|
+
config.read_timeout = 90
|
|
173
|
+
|
|
174
|
+
# Getters
|
|
175
|
+
config.token # => "new_token"
|
|
176
|
+
config.version # => "2024-10"
|
|
177
|
+
config.host # => "https://custom.monday.com/v2"
|
|
178
|
+
config.open_timeout # => 20
|
|
179
|
+
config.read_timeout # => 90
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## API Versions
|
|
183
|
+
|
|
184
|
+
The `version` parameter specifies which monday.com API version to use.
|
|
185
|
+
|
|
186
|
+
### Available Versions
|
|
187
|
+
|
|
188
|
+
monday.com uses dated API versions in `YYYY-MM` format:
|
|
189
|
+
|
|
190
|
+
- `"2024-10"` - October 2024 version
|
|
191
|
+
- `"2024-01"` - January 2024 version
|
|
192
|
+
- `"2023-10"` - October 2023 version
|
|
193
|
+
- `"2023-07"` - July 2023 version (default)
|
|
194
|
+
|
|
195
|
+
### Setting API Version
|
|
196
|
+
|
|
197
|
+
**Global:**
|
|
198
|
+
|
|
199
|
+
```ruby
|
|
200
|
+
Monday.configure do |config|
|
|
201
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
202
|
+
config.version = "2024-10"
|
|
203
|
+
end
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Per-Client:**
|
|
207
|
+
|
|
208
|
+
```ruby
|
|
209
|
+
client = Monday::Client.new(
|
|
210
|
+
token: ENV["MONDAY_TOKEN"],
|
|
211
|
+
version: "2024-10"
|
|
212
|
+
)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Version Usage
|
|
216
|
+
|
|
217
|
+
The version is sent in the `API-Version` header with every request:
|
|
218
|
+
|
|
219
|
+
```ruby
|
|
220
|
+
# Internally, requests include:
|
|
221
|
+
# Headers:
|
|
222
|
+
# Authorization: your_token
|
|
223
|
+
# API-Version: 2024-10
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
::: 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>Breaking Changes</span>
|
|
227
|
+
API versions may introduce breaking changes. Test thoroughly before upgrading to a new version.
|
|
228
|
+
:::
|
|
229
|
+
|
|
230
|
+
### Finding Available Versions
|
|
231
|
+
|
|
232
|
+
See [monday.com's API versioning documentation](https://developer.monday.com/api-reference/docs/api-versioning) for the complete list of available versions and their changes.
|
|
233
|
+
|
|
234
|
+
## Timeouts
|
|
235
|
+
|
|
236
|
+
Control how long the gem waits for API responses.
|
|
237
|
+
|
|
238
|
+
### open_timeout
|
|
239
|
+
|
|
240
|
+
Maximum seconds to wait while establishing a connection to monday.com's API.
|
|
241
|
+
|
|
242
|
+
**Default:** `10` seconds
|
|
243
|
+
|
|
244
|
+
**When to Increase:**
|
|
245
|
+
- Slow network connections
|
|
246
|
+
- Connecting through proxies
|
|
247
|
+
- High-latency environments
|
|
248
|
+
|
|
249
|
+
**Example:**
|
|
250
|
+
|
|
251
|
+
```ruby
|
|
252
|
+
Monday.configure do |config|
|
|
253
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
254
|
+
config.open_timeout = 20 # Wait up to 20 seconds to connect
|
|
255
|
+
end
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### read_timeout
|
|
259
|
+
|
|
260
|
+
Maximum seconds to wait for the API to return a response after the connection is established.
|
|
261
|
+
|
|
262
|
+
**Default:** `30` seconds
|
|
263
|
+
|
|
264
|
+
**When to Increase:**
|
|
265
|
+
- Large data exports
|
|
266
|
+
- Complex queries with many boards/items
|
|
267
|
+
- Bulk operations
|
|
268
|
+
- Known slow endpoints
|
|
269
|
+
|
|
270
|
+
**Example:**
|
|
271
|
+
|
|
272
|
+
```ruby
|
|
273
|
+
Monday.configure do |config|
|
|
274
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
275
|
+
config.read_timeout = 120 # Wait up to 2 minutes for response
|
|
276
|
+
end
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Timeout Behavior
|
|
280
|
+
|
|
281
|
+
When a timeout is exceeded, a timeout error is raised:
|
|
282
|
+
|
|
283
|
+
```ruby
|
|
284
|
+
client = Monday::Client.new(
|
|
285
|
+
token: ENV["MONDAY_TOKEN"],
|
|
286
|
+
read_timeout: 5 # Very short timeout
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
begin
|
|
290
|
+
# Large query that takes more than 5 seconds
|
|
291
|
+
response = client.boards.query(
|
|
292
|
+
args: { limit: 1000 },
|
|
293
|
+
select: ["id", "name", "items { id name }"]
|
|
294
|
+
)
|
|
295
|
+
rescue Net::ReadTimeout => e
|
|
296
|
+
puts "Request timed out: #{e.message}"
|
|
297
|
+
# Retry with longer timeout or smaller query
|
|
298
|
+
end
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Usage Examples
|
|
302
|
+
|
|
303
|
+
### Development Environment
|
|
304
|
+
|
|
305
|
+
```ruby
|
|
306
|
+
# config/initializers/monday.rb (Rails)
|
|
307
|
+
# or at the top of your script
|
|
308
|
+
|
|
309
|
+
require "dotenv/load"
|
|
310
|
+
|
|
311
|
+
Monday.configure do |config|
|
|
312
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
313
|
+
config.version = "2024-10"
|
|
314
|
+
config.read_timeout = 60 # Longer timeout for complex queries
|
|
315
|
+
end
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Production Environment
|
|
319
|
+
|
|
320
|
+
**Using Rails Credentials:**
|
|
321
|
+
|
|
322
|
+
```ruby
|
|
323
|
+
# config/initializers/monday.rb
|
|
324
|
+
Monday.configure do |config|
|
|
325
|
+
config.token = Rails.application.credentials.monday[:token]
|
|
326
|
+
config.version = Rails.application.credentials.monday[:version] || "2024-10"
|
|
327
|
+
config.open_timeout = 15
|
|
328
|
+
config.read_timeout = 90
|
|
329
|
+
end
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Using Environment Variables:**
|
|
333
|
+
|
|
334
|
+
```ruby
|
|
335
|
+
Monday.configure do |config|
|
|
336
|
+
config.token = ENV.fetch("MONDAY_TOKEN")
|
|
337
|
+
config.version = ENV.fetch("MONDAY_API_VERSION", "2024-10")
|
|
338
|
+
config.open_timeout = ENV.fetch("MONDAY_OPEN_TIMEOUT", 10).to_i
|
|
339
|
+
config.read_timeout = ENV.fetch("MONDAY_READ_TIMEOUT", 30).to_i
|
|
340
|
+
end
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Multi-Tenant Application
|
|
344
|
+
|
|
345
|
+
Handle multiple monday.com accounts:
|
|
346
|
+
|
|
347
|
+
```ruby
|
|
348
|
+
class MondayService
|
|
349
|
+
def initialize(user)
|
|
350
|
+
@client = Monday::Client.new(
|
|
351
|
+
token: user.monday_token,
|
|
352
|
+
version: user.monday_api_version || "2024-10"
|
|
353
|
+
)
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def fetch_boards
|
|
357
|
+
@client.boards.query(
|
|
358
|
+
select: ["id", "name", "workspace_id"]
|
|
359
|
+
)
|
|
360
|
+
end
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# Usage
|
|
364
|
+
service = MondayService.new(current_user)
|
|
365
|
+
response = service.fetch_boards
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Testing Environment
|
|
369
|
+
|
|
370
|
+
Reset configuration between tests:
|
|
371
|
+
|
|
372
|
+
```ruby
|
|
373
|
+
# spec/spec_helper.rb or test/test_helper.rb
|
|
374
|
+
RSpec.configure do |config|
|
|
375
|
+
config.before(:each) do
|
|
376
|
+
Monday.config.reset
|
|
377
|
+
Monday.configure do |c|
|
|
378
|
+
c.token = "test_token"
|
|
379
|
+
c.version = "2024-10"
|
|
380
|
+
end
|
|
381
|
+
end
|
|
382
|
+
end
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Custom API Host
|
|
386
|
+
|
|
387
|
+
For testing or custom deployments:
|
|
388
|
+
|
|
389
|
+
```ruby
|
|
390
|
+
Monday.configure do |config|
|
|
391
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
392
|
+
config.host = "https://staging.monday.com/v2" # Custom endpoint
|
|
393
|
+
config.version = "2024-10"
|
|
394
|
+
end
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
::: 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>Custom Host Usage</span>
|
|
398
|
+
Changing the `host` is rarely needed. Only modify this if you're connecting to a custom monday.com deployment or testing environment.
|
|
399
|
+
:::
|
|
400
|
+
|
|
401
|
+
### Dynamic Configuration
|
|
402
|
+
|
|
403
|
+
Change configuration at runtime:
|
|
404
|
+
|
|
405
|
+
```ruby
|
|
406
|
+
# Start with default config
|
|
407
|
+
Monday.configure do |config|
|
|
408
|
+
config.token = ENV["MONDAY_TOKEN_DEFAULT"]
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
client = Monday::Client.new
|
|
412
|
+
|
|
413
|
+
# Later, switch to different account
|
|
414
|
+
Monday.configure do |config|
|
|
415
|
+
config.token = ENV["MONDAY_TOKEN_PREMIUM"]
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
# New clients use updated config
|
|
419
|
+
premium_client = Monday::Client.new
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## Best Practices
|
|
423
|
+
|
|
424
|
+
### Store Tokens Securely
|
|
425
|
+
|
|
426
|
+
Never hardcode tokens in your source code:
|
|
427
|
+
|
|
428
|
+
```ruby
|
|
429
|
+
# Bad - Token in code
|
|
430
|
+
Monday.configure do |config|
|
|
431
|
+
config.token = "eyJhbGc..." # Never do this!
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
# Good - Token from environment
|
|
435
|
+
Monday.configure do |config|
|
|
436
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
# Better - Validate token exists
|
|
440
|
+
Monday.configure do |config|
|
|
441
|
+
config.token = ENV.fetch("MONDAY_TOKEN") do
|
|
442
|
+
raise "MONDAY_TOKEN environment variable not set"
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### Use Environment-Specific Configuration
|
|
448
|
+
|
|
449
|
+
Separate configuration by environment:
|
|
450
|
+
|
|
451
|
+
```ruby
|
|
452
|
+
# config/initializers/monday.rb
|
|
453
|
+
Monday.configure do |config|
|
|
454
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
455
|
+
|
|
456
|
+
case Rails.env
|
|
457
|
+
when "development"
|
|
458
|
+
config.read_timeout = 120 # Longer timeout for debugging
|
|
459
|
+
when "test"
|
|
460
|
+
config.token = "test_token"
|
|
461
|
+
when "production"
|
|
462
|
+
config.open_timeout = 10
|
|
463
|
+
config.read_timeout = 60
|
|
464
|
+
config.version = "2024-10"
|
|
465
|
+
end
|
|
466
|
+
end
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### Validate Configuration on Startup
|
|
470
|
+
|
|
471
|
+
Ensure configuration is valid before running:
|
|
472
|
+
|
|
473
|
+
```ruby
|
|
474
|
+
def validate_configuration!
|
|
475
|
+
raise "MONDAY_TOKEN not configured" if Monday.config.token.nil?
|
|
476
|
+
|
|
477
|
+
client = Monday::Client.new
|
|
478
|
+
response = client.account.query(select: ["id"])
|
|
479
|
+
|
|
480
|
+
unless response.success?
|
|
481
|
+
raise "Invalid monday.com configuration: #{response.code}"
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
puts "monday.com configuration valid"
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
# Call during application startup
|
|
488
|
+
validate_configuration!
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### Document Configuration Requirements
|
|
492
|
+
|
|
493
|
+
Add a `.env.example` file to your project:
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
# .env.example
|
|
497
|
+
# monday.com API Configuration
|
|
498
|
+
MONDAY_TOKEN=your_token_here
|
|
499
|
+
MONDAY_API_VERSION=2024-10
|
|
500
|
+
MONDAY_READ_TIMEOUT=60
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
### Use Defaults When Appropriate
|
|
504
|
+
|
|
505
|
+
Only override defaults when necessary:
|
|
506
|
+
|
|
507
|
+
```ruby
|
|
508
|
+
# Minimal configuration (uses defaults for everything else)
|
|
509
|
+
Monday.configure do |config|
|
|
510
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
511
|
+
end
|
|
512
|
+
|
|
513
|
+
# Override only what you need
|
|
514
|
+
Monday.configure do |config|
|
|
515
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
516
|
+
config.read_timeout = 120 # Only change this
|
|
517
|
+
end
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
## Constants
|
|
521
|
+
|
|
522
|
+
### DEFAULT_HOST
|
|
523
|
+
|
|
524
|
+
Default monday.com API endpoint:
|
|
525
|
+
|
|
526
|
+
```ruby
|
|
527
|
+
Monday::Configuration::DEFAULT_HOST
|
|
528
|
+
# => "https://api.monday.com/v2"
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### DEFAULT_TOKEN
|
|
532
|
+
|
|
533
|
+
Default token value (nil):
|
|
534
|
+
|
|
535
|
+
```ruby
|
|
536
|
+
Monday::Configuration::DEFAULT_TOKEN
|
|
537
|
+
# => nil
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
### DEFAULT_VERSION
|
|
541
|
+
|
|
542
|
+
Default API version:
|
|
543
|
+
|
|
544
|
+
```ruby
|
|
545
|
+
Monday::Configuration::DEFAULT_VERSION
|
|
546
|
+
# => "2023-07"
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### DEFAULT_OPEN_TIMEOUT
|
|
550
|
+
|
|
551
|
+
Default connection timeout in seconds:
|
|
552
|
+
|
|
553
|
+
```ruby
|
|
554
|
+
Monday::Configuration::DEFAULT_OPEN_TIMEOUT
|
|
555
|
+
# => 10
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### DEFAULT_READ_TIMEOUT
|
|
559
|
+
|
|
560
|
+
Default read timeout in seconds:
|
|
561
|
+
|
|
562
|
+
```ruby
|
|
563
|
+
Monday::Configuration::DEFAULT_READ_TIMEOUT
|
|
564
|
+
# => 30
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### CONFIGURATION_FIELDS
|
|
568
|
+
|
|
569
|
+
Array of valid configuration field names:
|
|
570
|
+
|
|
571
|
+
```ruby
|
|
572
|
+
Monday::Configuration::CONFIGURATION_FIELDS
|
|
573
|
+
# => [:token, :host, :version, :open_timeout, :read_timeout]
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
## Related Documentation
|
|
577
|
+
|
|
578
|
+
- [Client](/reference/client) - Client initialization and usage
|
|
579
|
+
- [Authentication](/guides/authentication) - Token management and security
|
|
580
|
+
- [Installation](/guides/installation) - Initial setup
|
|
581
|
+
- [Error Handling](/guides/advanced/errors) - Handling configuration errors
|
|
582
|
+
|
|
583
|
+
## External References
|
|
584
|
+
|
|
585
|
+
- [monday.com API Versioning](https://developer.monday.com/api-reference/docs/api-versioning)
|
|
586
|
+
- [monday.com Developer Center](https://developer.monday.com/)
|