monday_ruby 1.1.0 → 1.2.1
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/CHANGELOG.md +24 -0
- data/README.md +146 -142
- 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 +20 -13
- data/.env +0 -1
- data/.rspec +0 -2
- data/.rubocop.yml +0 -40
- data/.simplecov +0 -4
- data/.vscode/settings.json +0 -4
- data/CODE_OF_CONDUCT.md +0 -84
- data/CONTRIBUTING.md +0 -86
- data/Rakefile +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3837300eeee4b5c5fc64a1c69eccc897cbbf57dc05acfaba3163bd67d1d1beb8
|
|
4
|
+
data.tar.gz: c0164784b3ec5b9780e735082e47f5f6381d8b115a11310addb707c046b84f0d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb6897aa4cb9810db87e09f0d70a9614d01cc5685c1cd5992780c0838e6f5a84444d430ad20454dd1a144d897a037fb84dc40b2cc9fb88289222f3a5cad7860a
|
|
7
|
+
data.tar.gz: 5642bf287741d7d3464142e5a4c78ce8d9da29be8ded5f9849820e6b6112258e8f3a8273618388c656649b89ba9d426106b91595e9f188c8ea1fb9d89c54f895
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## v1.2.1 (January 23, 2026)
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- Fixed issue where any string containing a dollar sign was incorrectly treated as a GraphQL variable.
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Updated `base64` dependency requirement from `~> 0.2.0` to `>= 0.2, < 0.4` for broader compatibility.
|
|
10
|
+
|
|
11
|
+
## v1.2.0 (November 18, 2025)
|
|
12
|
+
|
|
13
|
+
#### Added
|
|
14
|
+
|
|
15
|
+
- Added support for adding Files (Assets) to a File column.
|
|
16
|
+
- Added support for adding Files (Assets) to an Update (Comments).
|
|
17
|
+
- Added helper method for clearing a Files column.
|
|
18
|
+
|
|
19
|
+
#### Changed
|
|
20
|
+
|
|
21
|
+
- Updated gemspec dependency to use multipart-post (~> 2.4.0)
|
|
22
|
+
- Updated rubocop RSpec/MultipleMemoizedHelpers from 10 to 11.
|
|
23
|
+
- Updated Utils to allow GraphQL variables in queries.
|
|
24
|
+
|
|
1
25
|
## v1.1.0 (October 27, 2025)
|
|
2
26
|
|
|
3
27
|
### Added
|
data/README.md
CHANGED
|
@@ -1,240 +1,244 @@
|
|
|
1
|
-
#
|
|
1
|
+
# monday_ruby
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
[](https://badge.fury.io/rb/monday_ruby)
|
|
5
5
|
[](https://coveralls.io/github/sanifhimani/monday_ruby?branch=main)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A Ruby client library for the [monday.com GraphQL API](https://developer.monday.com/api-reference). Build integrations with boards, items, columns, and more using idiomatic Ruby.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Features
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
- **Resource-based API** - Clean, intuitive interface (`client.board.query`, `client.item.create`)
|
|
12
|
+
- **Flexible configuration** - Global or per-client setup
|
|
13
|
+
- **Comprehensive error handling** - Typed exceptions for different error scenarios
|
|
14
|
+
- **Cursor-based pagination** - Efficiently handle large datasets
|
|
15
|
+
- **Fully tested** - 100% test coverage with VCR-recorded fixtures
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
## Documentation
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
**[Complete Documentation →](https://sanifhimani.github.io/monday_ruby/)**
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
- [Getting Started Tutorial](https://sanifhimani.github.io/monday_ruby/tutorial/first-integration)
|
|
22
|
+
- [How-to Guides](https://sanifhimani.github.io/monday_ruby/guides/installation)
|
|
23
|
+
- [API Reference](https://sanifhimani.github.io/monday_ruby/reference/client)
|
|
24
|
+
- [Best Practices](https://sanifhimani.github.io/monday_ruby/explanation/best-practices/errors)
|
|
22
25
|
|
|
23
|
-
##
|
|
26
|
+
## Installation
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
Add to your Gemfile:
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
```ruby
|
|
31
|
+
gem "monday_ruby"
|
|
32
|
+
```
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
Or install directly:
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
```bash
|
|
37
|
+
gem install monday_ruby
|
|
38
|
+
```
|
|
32
39
|
|
|
33
|
-
|
|
40
|
+
## Quick Start
|
|
34
41
|
|
|
35
42
|
```ruby
|
|
36
43
|
require "monday_ruby"
|
|
37
44
|
|
|
45
|
+
# Configure with your API token
|
|
38
46
|
Monday.configure do |config|
|
|
39
|
-
config.token = "
|
|
47
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
40
48
|
end
|
|
41
|
-
```
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
require "monday_ruby"
|
|
50
|
+
# Create a client
|
|
51
|
+
client = Monday::Client.new
|
|
46
52
|
|
|
47
|
-
|
|
53
|
+
# Query boards
|
|
54
|
+
response = client.board.query(args: { limit: 5 })
|
|
55
|
+
|
|
56
|
+
if response.success?
|
|
57
|
+
boards = response.body.dig("data", "boards")
|
|
58
|
+
boards.each { |board| puts board["name"] }
|
|
59
|
+
end
|
|
48
60
|
```
|
|
49
61
|
|
|
50
|
-
|
|
62
|
+
Get your API token from your [monday.com Admin settings](https://support.monday.com/hc/en-us/articles/360005144659-Does-monday-com-have-an-API).
|
|
51
63
|
|
|
52
|
-
|
|
53
|
-
require "monday_ruby"
|
|
64
|
+
## Usage
|
|
54
65
|
|
|
55
|
-
|
|
56
|
-
config.token = "<AUTH_TOKEN>"
|
|
57
|
-
config.version = "2023-07"
|
|
58
|
-
end
|
|
59
|
-
```
|
|
66
|
+
### Configuration
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
**Global configuration** (recommended):
|
|
62
69
|
|
|
63
70
|
```ruby
|
|
64
|
-
require "monday_ruby"
|
|
65
|
-
|
|
66
71
|
Monday.configure do |config|
|
|
67
|
-
config.token = "
|
|
68
|
-
config.
|
|
69
|
-
config.read_timeout = 30 # seconds (default: 30)
|
|
72
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
73
|
+
config.version = "2024-01" # API version (optional)
|
|
70
74
|
end
|
|
71
75
|
|
|
72
|
-
|
|
73
|
-
client = Monday::Client.new(
|
|
74
|
-
token: "<AUTH_TOKEN>",
|
|
75
|
-
open_timeout: 15,
|
|
76
|
-
read_timeout: 45
|
|
77
|
-
)
|
|
76
|
+
client = Monday::Client.new
|
|
78
77
|
```
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Get access to response objects by initializing a client and using the appropriate action you want to perform:
|
|
79
|
+
**Per-client configuration**:
|
|
83
80
|
|
|
84
81
|
```ruby
|
|
85
|
-
client = Monday::Client.new(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
puts response.body
|
|
82
|
+
client = Monday::Client.new(
|
|
83
|
+
token: ENV["MONDAY_TOKEN"],
|
|
84
|
+
version: "2024-01"
|
|
85
|
+
)
|
|
90
86
|
```
|
|
91
87
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Here are some common use cases for the API client.
|
|
95
|
-
|
|
96
|
-
#### Fetching all the boards
|
|
97
|
-
|
|
98
|
-
Initialize the client with the auth token and call the `boards` method.
|
|
88
|
+
**Configure timeouts**:
|
|
99
89
|
|
|
100
90
|
```ruby
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
response.success? # => true
|
|
107
|
-
|
|
108
|
-
# To get the boards from the response
|
|
109
|
-
response.body.dig("data", "boards") # => [...]
|
|
91
|
+
Monday.configure do |config|
|
|
92
|
+
config.token = ENV["MONDAY_TOKEN"]
|
|
93
|
+
config.open_timeout = 10 # seconds (default: 10)
|
|
94
|
+
config.read_timeout = 30 # seconds (default: 30)
|
|
95
|
+
end
|
|
110
96
|
```
|
|
111
97
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
Initialize the client with the auth token and call the `create_board` method.
|
|
98
|
+
### Working with Boards
|
|
115
99
|
|
|
116
100
|
```ruby
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
args
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
description: "Test board description"
|
|
123
|
-
}
|
|
101
|
+
# Query boards
|
|
102
|
+
response = client.board.query(
|
|
103
|
+
args: { ids: [1234567890] },
|
|
104
|
+
select: ["id", "name", "description"]
|
|
105
|
+
)
|
|
124
106
|
|
|
125
|
-
|
|
126
|
-
response = client.create_board(args: args)
|
|
107
|
+
boards = response.body.dig("data", "boards")
|
|
127
108
|
|
|
128
|
-
#
|
|
129
|
-
response
|
|
109
|
+
# Create a board
|
|
110
|
+
response = client.board.create(
|
|
111
|
+
args: {
|
|
112
|
+
board_name: "Project Tasks",
|
|
113
|
+
board_kind: "public",
|
|
114
|
+
description: "Track project deliverables"
|
|
115
|
+
}
|
|
116
|
+
)
|
|
130
117
|
|
|
131
|
-
|
|
132
|
-
response.body.dig("data", "create_board") # => { ... }
|
|
118
|
+
board = response.body.dig("data", "create_board")
|
|
133
119
|
```
|
|
134
120
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
Initialize the client with the auth token and call the `create_item` method.
|
|
121
|
+
### Working with Items
|
|
138
122
|
|
|
139
123
|
```ruby
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
args
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
keywords: {
|
|
150
|
-
labels: ["Tech team", "DevOps team"]
|
|
124
|
+
# Create an item
|
|
125
|
+
response = client.item.create(
|
|
126
|
+
args: {
|
|
127
|
+
board_id: 1234567890,
|
|
128
|
+
item_name: "Implement authentication",
|
|
129
|
+
column_values: {
|
|
130
|
+
status: { label: "Working on it" },
|
|
131
|
+
date4: { date: "2024-12-31" }
|
|
151
132
|
}
|
|
152
133
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
# => <Monday::Response ...>
|
|
156
|
-
response = client.create_item(args: args)
|
|
134
|
+
)
|
|
157
135
|
|
|
158
|
-
#
|
|
159
|
-
response
|
|
136
|
+
# Query items
|
|
137
|
+
response = client.item.query(
|
|
138
|
+
args: { ids: [987654321] },
|
|
139
|
+
select: ["id", "name", { column_values: ["id", "text"] }]
|
|
140
|
+
)
|
|
160
141
|
|
|
161
|
-
|
|
162
|
-
response.body.dig("data", "create_item") # => { ... }
|
|
142
|
+
items = response.body.dig("data", "items")
|
|
163
143
|
```
|
|
164
144
|
|
|
165
|
-
|
|
145
|
+
### Pagination
|
|
166
146
|
|
|
167
|
-
|
|
147
|
+
Handle large datasets efficiently with cursor-based pagination:
|
|
168
148
|
|
|
169
149
|
```ruby
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
# Fetch first page of items from a board (up to 500 items per page)
|
|
150
|
+
# Fetch first page
|
|
173
151
|
response = client.board.items_page(
|
|
174
|
-
board_ids:
|
|
152
|
+
board_ids: 1234567890,
|
|
175
153
|
limit: 100
|
|
176
154
|
)
|
|
177
155
|
|
|
178
|
-
# Extract items and cursor from response
|
|
179
156
|
items = response.body.dig("data", "boards", 0, "items_page", "items")
|
|
180
157
|
cursor = response.body.dig("data", "boards", 0, "items_page", "cursor")
|
|
181
158
|
|
|
182
|
-
# Fetch next page
|
|
159
|
+
# Fetch next page
|
|
183
160
|
if cursor
|
|
184
161
|
next_response = client.board.items_page(
|
|
185
|
-
board_ids:
|
|
162
|
+
board_ids: 1234567890,
|
|
186
163
|
limit: 100,
|
|
187
164
|
cursor: cursor
|
|
188
165
|
)
|
|
189
166
|
end
|
|
190
|
-
|
|
191
|
-
# You can also filter items using query_params
|
|
192
|
-
response = client.board.items_page(
|
|
193
|
-
board_ids: <BOARD_ID>,
|
|
194
|
-
limit: 50,
|
|
195
|
-
query_params: {
|
|
196
|
-
rules: [{ column_id: "status", compare_value: [1] }],
|
|
197
|
-
operator: :and
|
|
198
|
-
}
|
|
199
|
-
)
|
|
200
167
|
```
|
|
201
168
|
|
|
202
|
-
|
|
169
|
+
See the [Pagination Guide](https://sanifhimani.github.io/monday_ruby/guides/advanced/pagination) for more details.
|
|
203
170
|
|
|
204
|
-
|
|
205
|
-
# Fetch paginated items from a group
|
|
206
|
-
response = client.group.items_page(
|
|
207
|
-
board_ids: <BOARD_ID>,
|
|
208
|
-
group_ids: "group_id",
|
|
209
|
-
limit: 100
|
|
210
|
-
)
|
|
171
|
+
### Error Handling
|
|
211
172
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
173
|
+
The library provides typed exceptions for different error scenarios:
|
|
174
|
+
|
|
175
|
+
```ruby
|
|
176
|
+
begin
|
|
177
|
+
response = client.board.query(args: { ids: [123] })
|
|
178
|
+
rescue Monday::AuthorizationError => e
|
|
179
|
+
puts "Invalid API token: #{e.message}"
|
|
180
|
+
rescue Monday::InvalidRequestError => e
|
|
181
|
+
puts "Invalid request: #{e.message}"
|
|
182
|
+
rescue Monday::RateLimitError => e
|
|
183
|
+
puts "Rate limit exceeded: #{e.message}"
|
|
184
|
+
rescue Monday::Error => e
|
|
185
|
+
puts "API error: #{e.message}"
|
|
186
|
+
end
|
|
219
187
|
```
|
|
220
188
|
|
|
189
|
+
See the [Error Handling Guide](https://sanifhimani.github.io/monday_ruby/guides/advanced/errors) for best practices.
|
|
190
|
+
|
|
191
|
+
## Available Resources
|
|
192
|
+
|
|
193
|
+
The client provides access to all monday.com resources:
|
|
194
|
+
|
|
195
|
+
- **Boards** - `client.board`
|
|
196
|
+
- **Items** - `client.item`
|
|
197
|
+
- **Columns** - `client.column`
|
|
198
|
+
- **Files** - `client.file`
|
|
199
|
+
- **Groups** - `client.group`
|
|
200
|
+
- **Updates** - `client.update`
|
|
201
|
+
- **Subitems** - `client.subitem`
|
|
202
|
+
- **Workspaces** - `client.workspace`
|
|
203
|
+
- **Folders** - `client.folder`
|
|
204
|
+
- **Account** - `client.account`
|
|
205
|
+
- **Activity Logs** - `client.activity_log`
|
|
206
|
+
- **Board Views** - `client.board_view`
|
|
207
|
+
|
|
208
|
+
For complete API documentation, see the [API Reference](https://sanifhimani.github.io/monday_ruby/reference/client).
|
|
209
|
+
|
|
221
210
|
## Development
|
|
222
211
|
|
|
223
|
-
|
|
212
|
+
### Running Tests
|
|
224
213
|
|
|
225
214
|
```bash
|
|
226
215
|
bundle exec rake spec
|
|
227
216
|
```
|
|
228
217
|
|
|
229
|
-
|
|
218
|
+
Tests use [VCR](https://github.com/vcr/vcr) to record HTTP interactions, so you don't need a monday.com API token to run them.
|
|
219
|
+
|
|
220
|
+
### Linting
|
|
230
221
|
|
|
231
222
|
```bash
|
|
232
223
|
bundle exec rake rubocop
|
|
233
224
|
```
|
|
234
225
|
|
|
226
|
+
### All Checks
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
bundle exec rake # Runs both tests and linter
|
|
230
|
+
```
|
|
231
|
+
|
|
235
232
|
## Contributing
|
|
236
233
|
|
|
237
|
-
Bug reports and pull requests are welcome on [GitHub](https://github.com/sanifhimani/monday_ruby).
|
|
234
|
+
Bug reports and pull requests are welcome on [GitHub](https://github.com/sanifhimani/monday_ruby).
|
|
235
|
+
|
|
236
|
+
Please read our [Contributing Guide](CONTRIBUTING.md) for details on:
|
|
237
|
+
- Development setup and testing
|
|
238
|
+
- Documentation guidelines
|
|
239
|
+
- Code style and commit conventions
|
|
240
|
+
|
|
241
|
+
This project follows the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).
|
|
238
242
|
|
|
239
243
|
## License
|
|
240
244
|
|
data/lib/monday/client.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "uri"
|
|
4
4
|
require "net/http"
|
|
5
|
+
require "net/http/post/multipart"
|
|
5
6
|
require "json"
|
|
6
7
|
|
|
7
8
|
require_relative "configuration"
|
|
@@ -37,6 +38,18 @@ module Monday
|
|
|
37
38
|
handle_response(Response.new(response))
|
|
38
39
|
end
|
|
39
40
|
|
|
41
|
+
def make_file_request(query, variables)
|
|
42
|
+
response = Request.post_multipart(
|
|
43
|
+
files_uri,
|
|
44
|
+
{ query: query, variables: variables },
|
|
45
|
+
request_multipart_headers,
|
|
46
|
+
open_timeout: @config.open_timeout,
|
|
47
|
+
read_timeout: @config.read_timeout
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
handle_response(Response.new(response))
|
|
51
|
+
end
|
|
52
|
+
|
|
40
53
|
private
|
|
41
54
|
|
|
42
55
|
def configure(config_args)
|
|
@@ -49,6 +62,10 @@ module Monday
|
|
|
49
62
|
URI(@config.host)
|
|
50
63
|
end
|
|
51
64
|
|
|
65
|
+
def files_uri
|
|
66
|
+
URI(@config.files_host)
|
|
67
|
+
end
|
|
68
|
+
|
|
52
69
|
def request_headers
|
|
53
70
|
{
|
|
54
71
|
"Content-Type": "application/json",
|
|
@@ -56,6 +73,13 @@ module Monday
|
|
|
56
73
|
}
|
|
57
74
|
end
|
|
58
75
|
|
|
76
|
+
def request_multipart_headers
|
|
77
|
+
{
|
|
78
|
+
"Content-Type": "multipart/form-data",
|
|
79
|
+
Authorization: @config.token
|
|
80
|
+
}
|
|
81
|
+
end
|
|
82
|
+
|
|
59
83
|
def handle_response(response)
|
|
60
84
|
return response if response.success?
|
|
61
85
|
|
data/lib/monday/configuration.rb
CHANGED
|
@@ -7,8 +7,10 @@ module Monday
|
|
|
7
7
|
#
|
|
8
8
|
# token: used to authenticate the requests
|
|
9
9
|
# host: defaults to https://api.monday.com/v2
|
|
10
|
+
# files_host: defaults to https://api.monday.com/v2/files
|
|
10
11
|
class Configuration
|
|
11
12
|
DEFAULT_HOST = "https://api.monday.com/v2"
|
|
13
|
+
DEFAULT_FILES_HOST = "#{DEFAULT_HOST}/file"
|
|
12
14
|
DEFAULT_TOKEN = nil
|
|
13
15
|
DEFAULT_VERSION = "2023-07"
|
|
14
16
|
DEFAULT_OPEN_TIMEOUT = 10
|
|
@@ -17,6 +19,7 @@ module Monday
|
|
|
17
19
|
CONFIGURATION_FIELDS = %i[
|
|
18
20
|
token
|
|
19
21
|
host
|
|
22
|
+
files_host
|
|
20
23
|
version
|
|
21
24
|
open_timeout
|
|
22
25
|
read_timeout
|
|
@@ -29,6 +32,7 @@ module Monday
|
|
|
29
32
|
raise ArgumentError, "Unknown arguments: #{invalid_keys}" unless invalid_keys.empty?
|
|
30
33
|
|
|
31
34
|
@host = DEFAULT_HOST
|
|
35
|
+
@files_host = DEFAULT_FILES_HOST
|
|
32
36
|
@token = DEFAULT_TOKEN
|
|
33
37
|
@version = DEFAULT_VERSION
|
|
34
38
|
@open_timeout = DEFAULT_OPEN_TIMEOUT
|
|
@@ -42,6 +46,7 @@ module Monday
|
|
|
42
46
|
def reset
|
|
43
47
|
@token = DEFAULT_TOKEN
|
|
44
48
|
@host = DEFAULT_HOST
|
|
49
|
+
@files_host = DEFAULT_FILES_HOST
|
|
45
50
|
@version = DEFAULT_VERSION
|
|
46
51
|
@open_timeout = DEFAULT_OPEN_TIMEOUT
|
|
47
52
|
@read_timeout = DEFAULT_READ_TIMEOUT
|
data/lib/monday/request.rb
CHANGED
|
@@ -18,5 +18,20 @@ module Monday
|
|
|
18
18
|
|
|
19
19
|
http.request(request)
|
|
20
20
|
end
|
|
21
|
+
|
|
22
|
+
def self.post_multipart(uri, body, headers, open_timeout: 10, read_timeout: 30)
|
|
23
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
24
|
+
http.use_ssl = true
|
|
25
|
+
http.open_timeout = open_timeout
|
|
26
|
+
http.read_timeout = read_timeout
|
|
27
|
+
|
|
28
|
+
params = {
|
|
29
|
+
"query" => body[:query],
|
|
30
|
+
"variables[file]" => body[:variables][:file]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
request = Net::HTTP::Post::Multipart.new(uri.request_uri, params, headers)
|
|
34
|
+
http.request(request)
|
|
35
|
+
end
|
|
21
36
|
end
|
|
22
37
|
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Monday
|
|
4
|
+
module Resources
|
|
5
|
+
# Represents Monday.com's file asset resource.
|
|
6
|
+
class File < Base
|
|
7
|
+
DEFAULT_SELECT = %w[id].freeze
|
|
8
|
+
|
|
9
|
+
# Adds a file to a file type column for an item.
|
|
10
|
+
#
|
|
11
|
+
# Allows customizing the column update using the args option.
|
|
12
|
+
# Allows customizing the values to retrieve using the select option.
|
|
13
|
+
# By default, The ID is retrieved.
|
|
14
|
+
def add_file_to_column(args: {}, select: DEFAULT_SELECT)
|
|
15
|
+
cloned_args = args.clone
|
|
16
|
+
variables = { file: cloned_args.delete(:file) }
|
|
17
|
+
cloned_args.merge!(file: "$file")
|
|
18
|
+
query = <<~QUERY
|
|
19
|
+
mutation add_file($file: File!) {
|
|
20
|
+
add_file_to_column#{Util.format_args(cloned_args)} {#{Util.format_select(select)}}
|
|
21
|
+
}
|
|
22
|
+
QUERY
|
|
23
|
+
make_file_request(query, variables)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Adds a file to an update for an item.
|
|
27
|
+
#
|
|
28
|
+
# Allows customizing the update creation using the args option.
|
|
29
|
+
# Allows customizing the values to retrieve using the select option.
|
|
30
|
+
# By default, The ID is retrieved.
|
|
31
|
+
def add_file_to_update(args: {}, select: DEFAULT_SELECT)
|
|
32
|
+
cloned_args = args.clone
|
|
33
|
+
variables = { file: cloned_args.delete(:file) }
|
|
34
|
+
cloned_args.merge!(file: "$file")
|
|
35
|
+
query = <<~QUERY
|
|
36
|
+
mutation ($file: File!) {
|
|
37
|
+
add_file_to_update#{Util.format_args(cloned_args)} {#{Util.format_select(select)}}
|
|
38
|
+
}
|
|
39
|
+
QUERY
|
|
40
|
+
make_file_request(query, variables)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Clear an item's files column. This is a helper method for files
|
|
44
|
+
# and you could also use the column.change_value to clear the column as well.
|
|
45
|
+
#
|
|
46
|
+
# Allows customizing the update creation using the args option.
|
|
47
|
+
# Allows customizing the values to retrieve using the select option.
|
|
48
|
+
# By default, ID is retrieved.
|
|
49
|
+
def clear_file_column(args: {}, select: DEFAULT_SELECT)
|
|
50
|
+
merged_args = args.merge(value: '{\"clear_all\": true}')
|
|
51
|
+
query = "mutation { change_column_value#{Util.format_args(merged_args)} {#{Util.format_select(select)}}}"
|
|
52
|
+
make_request(query)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
data/lib/monday/util.rb
CHANGED
|
@@ -108,6 +108,7 @@ module Monday
|
|
|
108
108
|
|
|
109
109
|
def formatted_args_value(value)
|
|
110
110
|
return value if value.is_a?(Symbol)
|
|
111
|
+
return value if value.to_s.include?("$") # GraphQL query variable
|
|
111
112
|
return value.to_json.to_json if value.is_a?(Hash)
|
|
112
113
|
return value if integer?(value)
|
|
113
114
|
return "[#{value.map { |v| formatted_args_value(v) }.join(", ")}]" if value.is_a?(Array)
|
data/lib/monday/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: monday_ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sanif Himani
|
|
@@ -24,7 +24,21 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: 0.3.0
|
|
27
|
-
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: multipart-post
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2.4'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '2.4'
|
|
41
|
+
description: A Ruby gem for interacting with monday.com's API
|
|
28
42
|
email:
|
|
29
43
|
- sanifhimani92@gmail.com
|
|
30
44
|
- weshays@gmail.com
|
|
@@ -32,17 +46,9 @@ executables: []
|
|
|
32
46
|
extensions: []
|
|
33
47
|
extra_rdoc_files: []
|
|
34
48
|
files:
|
|
35
|
-
- ".env"
|
|
36
|
-
- ".rspec"
|
|
37
|
-
- ".rubocop.yml"
|
|
38
|
-
- ".simplecov"
|
|
39
|
-
- ".vscode/settings.json"
|
|
40
49
|
- CHANGELOG.md
|
|
41
|
-
- CODE_OF_CONDUCT.md
|
|
42
|
-
- CONTRIBUTING.md
|
|
43
50
|
- LICENSE
|
|
44
51
|
- README.md
|
|
45
|
-
- Rakefile
|
|
46
52
|
- lib/monday/client.rb
|
|
47
53
|
- lib/monday/configuration.rb
|
|
48
54
|
- lib/monday/deprecation.rb
|
|
@@ -55,6 +61,7 @@ files:
|
|
|
55
61
|
- lib/monday/resources/board.rb
|
|
56
62
|
- lib/monday/resources/board_view.rb
|
|
57
63
|
- lib/monday/resources/column.rb
|
|
64
|
+
- lib/monday/resources/file.rb
|
|
58
65
|
- lib/monday/resources/folder.rb
|
|
59
66
|
- lib/monday/resources/group.rb
|
|
60
67
|
- lib/monday/resources/item.rb
|
|
@@ -70,8 +77,8 @@ licenses:
|
|
|
70
77
|
- MIT
|
|
71
78
|
metadata:
|
|
72
79
|
homepage_uri: https://github.com/sanifhimani/monday_ruby
|
|
73
|
-
documentation_uri: https://
|
|
74
|
-
changelog_uri: https://github.com/sanifhimani/monday_ruby/blob/v1.1
|
|
80
|
+
documentation_uri: https://sanifhimani.github.io/monday_ruby/
|
|
81
|
+
changelog_uri: https://github.com/sanifhimani/monday_ruby/blob/v1.2.1/CHANGELOG.md
|
|
75
82
|
rubygems_mfa_required: 'true'
|
|
76
83
|
rdoc_options: []
|
|
77
84
|
require_paths:
|
|
@@ -87,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
87
94
|
- !ruby/object:Gem::Version
|
|
88
95
|
version: '0'
|
|
89
96
|
requirements: []
|
|
90
|
-
rubygems_version: 3.
|
|
97
|
+
rubygems_version: 3.7.2
|
|
91
98
|
specification_version: 4
|
|
92
99
|
summary: Ruby bindings to use the monday.com API
|
|
93
100
|
test_files: []
|
data/.env
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
token="eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjU3ODczMzkyMiwiYWFpIjoxMSwidWlkIjo5NDg5NDgxMywiaWFkIjoiMjAyNS0xMC0yN1QwMToyMToxMy44NDFaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MzIxODc3OTQsInJnbiI6InVzZTEifQ.SgPS-m2FEMHjitKC0SYTYsiQ8vAHZ7ynjDmMwQInneE"
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
plugins:
|
|
2
|
-
- rubocop-rake
|
|
3
|
-
- rubocop-rspec
|
|
4
|
-
|
|
5
|
-
AllCops:
|
|
6
|
-
TargetRubyVersion: 2.7
|
|
7
|
-
NewCops: enable
|
|
8
|
-
SuggestExtensions: false
|
|
9
|
-
Exclude:
|
|
10
|
-
- "spec/support/**/*.rb"
|
|
11
|
-
- "vendor/**/*"
|
|
12
|
-
|
|
13
|
-
Style/StringLiterals:
|
|
14
|
-
Enabled: true
|
|
15
|
-
EnforcedStyle: double_quotes
|
|
16
|
-
|
|
17
|
-
Style/StringLiteralsInInterpolation:
|
|
18
|
-
Enabled: true
|
|
19
|
-
EnforcedStyle: double_quotes
|
|
20
|
-
|
|
21
|
-
Layout/LineLength:
|
|
22
|
-
Max: 120
|
|
23
|
-
|
|
24
|
-
Metrics/BlockLength:
|
|
25
|
-
Exclude:
|
|
26
|
-
- "spec/**/*_spec.rb"
|
|
27
|
-
|
|
28
|
-
Metrics/MethodLength:
|
|
29
|
-
Exclude:
|
|
30
|
-
- "lib/monday/util.rb"
|
|
31
|
-
|
|
32
|
-
Metrics/ParameterLists:
|
|
33
|
-
Exclude:
|
|
34
|
-
- "lib/monday/resources/group.rb"
|
|
35
|
-
|
|
36
|
-
RSpec/NestedGroups:
|
|
37
|
-
Max: 5
|
|
38
|
-
|
|
39
|
-
RSpec/MultipleMemoizedHelpers:
|
|
40
|
-
Max: 10
|
data/.simplecov
DELETED
data/.vscode/settings.json
DELETED
data/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
-
|
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
-
|
|
9
|
-
## Our Standards
|
|
10
|
-
|
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
-
|
|
13
|
-
* Demonstrating empathy and kindness toward other people
|
|
14
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
-
* Giving and gracefully accepting constructive feedback
|
|
16
|
-
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
-
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
-
|
|
19
|
-
Examples of unacceptable behavior include:
|
|
20
|
-
|
|
21
|
-
* The use of sexualized language or imagery, and sexual attention or
|
|
22
|
-
advances of any kind
|
|
23
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
-
* Public or private harassment
|
|
25
|
-
* Publishing others' private information, such as a physical or email
|
|
26
|
-
address, without their explicit permission
|
|
27
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
28
|
-
professional setting
|
|
29
|
-
|
|
30
|
-
## Enforcement Responsibilities
|
|
31
|
-
|
|
32
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
33
|
-
|
|
34
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
35
|
-
|
|
36
|
-
## Scope
|
|
37
|
-
|
|
38
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
39
|
-
|
|
40
|
-
## Enforcement
|
|
41
|
-
|
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at sanifhimani92@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
|
43
|
-
|
|
44
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
45
|
-
|
|
46
|
-
## Enforcement Guidelines
|
|
47
|
-
|
|
48
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
49
|
-
|
|
50
|
-
### 1. Correction
|
|
51
|
-
|
|
52
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
53
|
-
|
|
54
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
55
|
-
|
|
56
|
-
### 2. Warning
|
|
57
|
-
|
|
58
|
-
**Community Impact**: A violation through a single incident or series of actions.
|
|
59
|
-
|
|
60
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
61
|
-
|
|
62
|
-
### 3. Temporary Ban
|
|
63
|
-
|
|
64
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
65
|
-
|
|
66
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
67
|
-
|
|
68
|
-
### 4. Permanent Ban
|
|
69
|
-
|
|
70
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
71
|
-
|
|
72
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
73
|
-
|
|
74
|
-
## Attribution
|
|
75
|
-
|
|
76
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
|
77
|
-
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
78
|
-
|
|
79
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
|
80
|
-
|
|
81
|
-
[homepage]: https://www.contributor-covenant.org
|
|
82
|
-
|
|
83
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
|
84
|
-
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/CONTRIBUTING.md
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# Contributing
|
|
2
|
-
|
|
3
|
-
Thanks for taking the time to contribute!
|
|
4
|
-
|
|
5
|
-
The following is a set of guidelines for contributing to `monday_ruby`. These are mostly guidelines, not rules. Use your best judgment, and feel to propose changes to this document in a pull request.
|
|
6
|
-
|
|
7
|
-
## Your first code contribution
|
|
8
|
-
|
|
9
|
-
Unsure where to begin contributing? You can start by looking through `good first issue` and `help wanted` issues.
|
|
10
|
-
|
|
11
|
-
### Pull request
|
|
12
|
-
|
|
13
|
-
Please follow these steps to have your contribution considered:
|
|
14
|
-
|
|
15
|
-
1. Follow the [pull request template](PULL_REQUEST_TEMPLATE.md).
|
|
16
|
-
2. Follow the [commit guidelines](#commit-message-guidelines).
|
|
17
|
-
3. After you submit your pull request, verify that all the status checks are passing.
|
|
18
|
-
|
|
19
|
-
## Testing Guidelines
|
|
20
|
-
|
|
21
|
-
This project uses [VCR](https://github.com/vcr/vcr) to record HTTP interactions for tests. This means you **do not need a Monday.com API token** to run most tests or contribute to the project.
|
|
22
|
-
|
|
23
|
-
### Running Tests
|
|
24
|
-
|
|
25
|
-
To run the test suite:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
bundle exec rake spec
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
All tests will use pre-recorded VCR cassettes stored in `spec/fixtures/vcr_cassettes/`.
|
|
32
|
-
|
|
33
|
-
### Working with VCR Cassettes
|
|
34
|
-
|
|
35
|
-
**For most contributions, you won't need to modify VCR cassettes.** The existing cassettes cover the current API functionality.
|
|
36
|
-
|
|
37
|
-
#### When You Need to Record New Cassettes
|
|
38
|
-
|
|
39
|
-
You only need to record new VCR cassettes when:
|
|
40
|
-
- Adding support for a **new API endpoint** that doesn't have existing test coverage
|
|
41
|
-
- Modifying an existing API call that changes the request/response structure
|
|
42
|
-
|
|
43
|
-
To record new cassettes:
|
|
44
|
-
|
|
45
|
-
1. Set your Monday.com API token as an environment variable:
|
|
46
|
-
```bash
|
|
47
|
-
export MONDAY_TOKEN="your_token_here"
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
2. Delete the old cassette file (if updating an existing test):
|
|
51
|
-
```bash
|
|
52
|
-
rm spec/fixtures/vcr_cassettes/your_cassette_name.yml
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
3. Run the specific test to generate a new cassette:
|
|
56
|
-
```bash
|
|
57
|
-
bundle exec rspec spec/path/to/your_spec.rb
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
4. **Important:** Before committing, verify the cassette doesn't contain sensitive data:
|
|
61
|
-
- VCR automatically filters the `Authorization` header
|
|
62
|
-
- Check for any other sensitive information in the cassette file
|
|
63
|
-
- Cassettes are committed to the repository
|
|
64
|
-
|
|
65
|
-
#### Testing New Features Without API Access
|
|
66
|
-
|
|
67
|
-
If you're adding a new feature but don't have API access to record cassettes:
|
|
68
|
-
1. Write your implementation and tests
|
|
69
|
-
2. Create a pull request noting that cassettes need to be recorded
|
|
70
|
-
3. A maintainer with API access will record the cassettes for you
|
|
71
|
-
|
|
72
|
-
### Code Quality
|
|
73
|
-
|
|
74
|
-
Run RuboCop to ensure code style compliance:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
bundle exec rake rubocop
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Commit message guidelines
|
|
81
|
-
|
|
82
|
-
* Use present tense ("Add feature" not "Added feature")
|
|
83
|
-
* Use the imperative mood ("Move file to..." not "Moves file to...")
|
|
84
|
-
* Limit the first line to 70 characters or less.
|
|
85
|
-
* Reference issues and pull requests after the first line.
|
|
86
|
-
* Try to follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
|