monday_ruby 0.6.1 → 1.0.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -1
  3. data/CHANGELOG.md +26 -0
  4. data/README.md +22 -51
  5. data/lib/monday/client.rb +14 -11
  6. data/lib/monday/resources/account.rb +6 -4
  7. data/lib/monday/resources/activity_log.rb +7 -5
  8. data/lib/monday/resources/base.rb +20 -0
  9. data/lib/monday/resources/board.rb +19 -17
  10. data/lib/monday/resources/board_view.rb +6 -4
  11. data/lib/monday/resources/column.rb +22 -20
  12. data/lib/monday/resources/group.rb +18 -16
  13. data/lib/monday/resources/item.rb +15 -13
  14. data/lib/monday/resources/subitem.rb +8 -6
  15. data/lib/monday/resources/update.rb +13 -11
  16. data/lib/monday/resources/workspace.rb +10 -8
  17. data/lib/monday/resources.rb +16 -20
  18. data/lib/monday/util.rb +6 -1
  19. data/lib/monday/version.rb +1 -1
  20. data/monday_ruby.gemspec +2 -0
  21. metadata +19 -43
  22. data/docs/README.md +0 -13
  23. data/docs/SUMMARY.md +0 -40
  24. data/docs/client.md +0 -15
  25. data/docs/configuration.md +0 -40
  26. data/docs/error-handling.md +0 -71
  27. data/docs/getting-started.md +0 -25
  28. data/docs/quick-start.md +0 -269
  29. data/docs/resources/README.md +0 -27
  30. data/docs/resources/account/README.md +0 -9
  31. data/docs/resources/account/accounts.md +0 -82
  32. data/docs/resources/activity-log/README.md +0 -9
  33. data/docs/resources/activity-log/activity_logs.md +0 -95
  34. data/docs/resources/board/README.md +0 -21
  35. data/docs/resources/board/archive_board.md +0 -79
  36. data/docs/resources/board/boards.md +0 -96
  37. data/docs/resources/board/create_board.md +0 -95
  38. data/docs/resources/board/delete_board.md +0 -79
  39. data/docs/resources/board/delete_board_subscribers.md +0 -87
  40. data/docs/resources/board/duplicate_board.md +0 -94
  41. data/docs/resources/board/update_board.md +0 -91
  42. data/docs/resources/board-view/README.md +0 -9
  43. data/docs/resources/board-view/board_views.md +0 -88
  44. data/docs/resources/column/README.md +0 -25
  45. data/docs/resources/column/change_column_metadata.md +0 -70
  46. data/docs/resources/column/change_column_title.md +0 -68
  47. data/docs/resources/column/change_column_value.md +0 -73
  48. data/docs/resources/column/change_multiple_column_value.md +0 -81
  49. data/docs/resources/column/change_simple_column_value.md +0 -69
  50. data/docs/resources/column/column_values.md +0 -115
  51. data/docs/resources/column/columns.md +0 -117
  52. data/docs/resources/column/create_column.md +0 -70
  53. data/docs/resources/column/delete_column.md +0 -58
  54. data/docs/resources/item/README.md +0 -17
  55. data/docs/resources/item/archive_item.md +0 -80
  56. data/docs/resources/item/create_item.md +0 -105
  57. data/docs/resources/item/delete_item.md +0 -80
  58. data/docs/resources/item/duplicate_item.md +0 -87
  59. data/docs/resources/item/items.md +0 -95
  60. data/docs/response.md +0 -21
@@ -1,71 +0,0 @@
1
- # Error Handling
2
-
3
- Monday.com has a set of predefined errors and exceptions that are sent back from their GraphQL API. Refer to their [official documentation](https://developer.monday.com/api-reference/docs/errors) to know more about the error codes.
4
-
5
- ### Catching exceptions
6
-
7
- If there is an error from the API, the library raises an exception. It's a best practice to catch and handle exceptions.
8
-
9
- To catch an exception, use the `rescue` keyword. You can catch all the exceptions from the API using the `Monday::Error` class. However, it is recommended to catch specific exceptions using its subclasses and have a fallback rescue using `Monday::Error`.
10
-
11
- ```ruby
12
- require "monday_ruby"
13
-
14
- client = Monday::Client.new(token: <AUTH_TOKEN>)
15
-
16
- def example
17
- res = client.boards
18
- puts res.body
19
- rescue Monday::AuthorizationError => error
20
- puts "Authorization error: #{error.message}"
21
- puts "Error code: #{error.code}"
22
- rescue Monday::Error => error
23
- puts "Other error: #{error.message}"
24
- end
25
- ```
26
-
27
- Along with the default status code exceptions, monday.com returns some other exceptions with `200` status code. This library handles those errors and raises exceptions accordingly.
28
-
29
- #### `Monday::InternalServer Error`
30
-
31
- This exception is raised when the server returns a `500` status code. Read more about what can cause this error on Monday.com's [official documentation](https://developer.monday.com/api-reference/docs/errors#internal-server-error).
32
-
33
- #### `Monday::AuthorizationError`
34
-
35
- This exception is raised when the server returns a `401` or a `403` status code. This can happen when the client is not authenticated, i.e., not configured with the token, or the token is incorrect.
36
-
37
- This exception is also raised when the server returns a `200` status code but the body returns `UserUnauthorizedException` error code.
38
-
39
- #### `Monday::RateLimitError`
40
-
41
- This exception is raised when the server returns a `429` status code. This can happen when you exceed the rate limit, i.e., 5,000 requests per minute. Read more about their rate limit on their [official documentation](https://developer.monday.com/api-reference/docs/rate-limits).
42
-
43
- #### `Monday::ResourceNotFoundError`
44
-
45
- This exception is raised when the server returns a `404` status code. This can happen when you pass an invalid ID in the query.
46
-
47
- This exception is also raised when the server returns a `200` status code but the body returns `ResourceNotFoundException` error code.
48
-
49
- #### `Monday::ComplexityError`
50
-
51
- This exception is raised when the server returns a `200` status code but the body returns `ComplexityException` error code.
52
-
53
- #### `Monday::InvalidRequestError`
54
-
55
- This exception is raised when the server returns a `400` status code. This can happen when the query you pass is invalid.
56
-
57
- This exception is also raised when the server returns a `200` status code but the body returns the following error codes:
58
-
59
- 1. `InvalidUserIdException`
60
- 2. `InvalidVersionException`
61
- 3. `InvalidColumnIdException`
62
- 4. `InvalidItemIdException`
63
- 5. `InvalidBoardIdException`
64
- 6. `InvalidArgumentException`
65
- 7. `CreateBoardException`
66
- 8. `ItemsLimitationException`
67
- 9. `ItemNameTooLongException`
68
- 10. `ColumnValueException`
69
- 11. `CorrectedValueException`
70
-
71
- Read more about these specific exceptions on their [official API documentation](https://developer.monday.com/api-reference/docs/errors).
@@ -1,25 +0,0 @@
1
- # Getting Started
2
-
3
- ### Installation
4
-
5
- You don't need the source code unless you want to modify the gem. If you want to use the package, run the following:
6
-
7
- ```sh
8
- gem install monday_ruby
9
- ```
10
-
11
- If you want to build the gem from the source:
12
-
13
- ```sh
14
- gem build monday_ruby.gemspec
15
- ```
16
-
17
- ### Bundler
18
-
19
- If you are installing via bundler, you should be sure to use the HTTPS rubygems source in your Gemfile, as any gems fetched over HTTP could potentially be compromised in transit and alter the code of gems fetched securely over HTTPS:
20
-
21
- ```ruby
22
- source "https://rubygems.org"
23
-
24
- gem "monday_ruby"
25
- ```
data/docs/quick-start.md DELETED
@@ -1,269 +0,0 @@
1
- # Quick Start
2
-
3
- The following is the minimum needed to fetch all the boards with their IDs and column IDs:
4
-
5
- {% code lineNumbers="true" %}
6
- ```ruby
7
- require "monday_ruby"
8
-
9
- client = Monday::Client.new(token: <AUTH_TOKEN>)
10
-
11
- select = [
12
- "id",
13
- {
14
- columns: "id"
15
- }
16
- ]
17
-
18
- response = client.boards(select: select)
19
- # => <Monday::Response ...>
20
-
21
- puts response.body
22
- ```
23
- {% endcode %}
24
-
25
- The response body from the above query would be as follows:
26
-
27
- {% code lineNumbers="true" %}
28
- ```json
29
- {
30
- "data": {
31
- "boards": [
32
- {
33
- "id": "123",
34
- "columns": [
35
- {
36
- "id": "name"
37
- },
38
- {
39
- "id": "subitems"
40
- },
41
- {
42
- "id": "work_status"
43
- },
44
- {
45
- "id": "keywords"
46
- }
47
- ]
48
- },
49
- {
50
- "id": "456",
51
- "columns": [
52
- {
53
- "id": "name"
54
- },
55
- {
56
- "id": "person"
57
- },
58
- {
59
- "id": "status"
60
- },
61
- {
62
- "id": "date0"
63
- }
64
- ]
65
- },
66
- ]
67
- },
68
- "account_id": 123
69
- }
70
- ```
71
- {% endcode %}
72
-
73
- ### Advanced select query
74
-
75
- The following is the minimum needed to fetch:
76
-
77
- 1. All the boards' IDs, names and count of items on each board.
78
- 2. The ID, title and type for the columns on each board.
79
- 3. The ID, name and the value of the items on each board.
80
-
81
- {% code lineNumbers="true" %}
82
- ```ruby
83
- require "monday_ruby"
84
-
85
- client = Monday::Client.new(token: <AUTH_TOKEN>)
86
-
87
- select = [
88
- "id",
89
- "name",
90
- "items_count",
91
- {
92
- columns: %w[id title type],
93
- items: [
94
- "id",
95
- "name",
96
- {
97
- column_values: "value"
98
- }
99
- ]
100
- }
101
- ]
102
-
103
- response = client.boards(select: select)
104
- # => <Monday::Response ...>
105
-
106
- puts response.body
107
- ```
108
- {% endcode %}
109
-
110
- The response body from the above query would be as follows:
111
-
112
- {% code lineNumbers="true" %}
113
- ```json
114
- {
115
- "data": {
116
- "boards": [
117
- {
118
- "id": "123",
119
- "name": "New test board",
120
- "items_count": 2,
121
- "columns": [
122
- {
123
- "id": "name",
124
- "title": "Name",
125
- "type": "name"
126
- },
127
- {
128
- "id": "subitems",
129
- "title": "Subitems",
130
- "type": "subtasks"
131
- },
132
- {
133
- "id": "work_status",
134
- "title": "Status",
135
- "type": "color"
136
- },
137
- {
138
- "id": "keywords",
139
- "title": "Keywords",
140
- "type": "dropdown"
141
- }
142
- ],
143
- "items": [
144
- {
145
- "id": "4708726090",
146
- "name": "Task 1",
147
- "column_values": [
148
- {
149
- "value": null
150
- },
151
- {
152
- "value": "{\"index\":0,\"changed_at\":\"2023-06-27T16:21:22.192Z\"}"
153
- },
154
- {
155
- "value": "{\"ids\":[1]}"
156
- }
157
- ]
158
- },
159
- {
160
- "id": "4713421325",
161
- "name": "New item",
162
- "column_values": [
163
- {
164
- "value": null
165
- },
166
- {
167
- "value": null
168
- },
169
- {
170
- "value": null
171
- }
172
- ]
173
- }
174
- ]
175
- },
176
- {
177
- "id": "456",
178
- "name": "Your first board",
179
- "items_count": 3,
180
- "columns": [
181
- {
182
- "id": "name",
183
- "title": "Name",
184
- "type": "name"
185
- },
186
- {
187
- "id": "subitems",
188
- "title": "Subitems",
189
- "type": "subtasks"
190
- },
191
- {
192
- "id": "person",
193
- "title": "Person",
194
- "type": "multiple-person"
195
- },
196
- {
197
- "id": "status",
198
- "title": "Status",
199
- "type": "color"
200
- },
201
- {
202
- "id": "date4",
203
- "title": "Date",
204
- "type": "date"
205
- }
206
- ],
207
- "items": [
208
- {
209
- "id": "4691485763",
210
- "name": "Item 1",
211
- "column_values": [
212
- {
213
- "value": null
214
- },
215
- {
216
- "value": "{\"changed_at\":\"2022-10-26T12:39:58.664Z\",\"personsAndTeams\":[{\"id\":44865791,\"kind\":\"person\"}]}"
217
- },
218
- {
219
- "value": "{\"index\":0,\"post_id\":null,\"changed_at\":\"2019-03-01T17:24:57.321Z\"}"
220
- },
221
- {
222
- "value": "{\"date\":\"2023-06-21\",\"icon\":null,\"changed_at\":\"2022-12-18T14:03:06.455Z\"}"
223
- }
224
- ]
225
- },
226
- {
227
- "id": "4691485774",
228
- "name": "Item 2",
229
- "column_values": [
230
- {
231
- "value": null
232
- },
233
- {
234
- "value": null
235
- },
236
- {
237
- "value": "{\"index\":1,\"post_id\":null,\"changed_at\":\"2019-03-01T17:28:23.178Z\"}"
238
- },
239
- {
240
- "value": "{\"date\":\"2023-06-23\",\"icon\":null,\"changed_at\":\"2022-12-25T12:31:18.096Z\"}"
241
- }
242
- ]
243
- },
244
- {
245
- "id": "4691485784",
246
- "name": "Item 3",
247
- "column_values": [
248
- {
249
- "value": null
250
- },
251
- {
252
- "value": null
253
- },
254
- {
255
- "value": "{\"index\":2,\"post_id\":null,\"changed_at\":\"2022-12-11T14:33:50.083Z\"}"
256
- },
257
- {
258
- "value": "{\"date\":\"2023-06-25\",\"changed_at\":\"2022-12-25T12:31:20.220Z\"}"
259
- }
260
- ]
261
- }
262
- ]
263
- }
264
- ]
265
- },
266
- "account_id": 123
267
- }
268
- ```
269
- {% endcode %}
@@ -1,27 +0,0 @@
1
- # Resources
2
-
3
- Once you have the client set up, you can call the API resources using the client.
4
-
5
- {% content-ref url="account/" %}
6
- [account](account/)
7
- {% endcontent-ref %}
8
-
9
- {% content-ref url="activity-log/" %}
10
- [activity-log](activity-log/)
11
- {% endcontent-ref %}
12
-
13
- {% content-ref url="board-view/" %}
14
- [board-view](board-view/)
15
- {% endcontent-ref %}
16
-
17
- {% content-ref url="board/" %}
18
- [board](board/)
19
- {% endcontent-ref %}
20
-
21
- {% content-ref url="column/" %}
22
- [column](column/)
23
- {% endcontent-ref %}
24
-
25
- {% content-ref url="item/" %}
26
- [item](item/)
27
- {% endcontent-ref %}
@@ -1,9 +0,0 @@
1
- # Account
2
-
3
- The account API is used to access the account data. It includes the following methods:
4
-
5
- [accounts.md](accounts.md "mention")
6
-
7
- {% hint style="info" %}
8
- Visit monday.com's API documentation to know more about the [account API](https://developer.monday.com/api-reference/docs/account).
9
- {% endhint %}
@@ -1,82 +0,0 @@
1
- # #accounts
2
-
3
- Querying the `account` API will return the metadata for the account.
4
-
5
- {% hint style="info" %}
6
- This account is the one that is associated with the authentication token.
7
- {% endhint %}
8
-
9
- ### Basic usage
10
-
11
- {% code lineNumbers="true" %}
12
- ```ruby
13
- client = Monday::Client.new(token: <AUTH_TOKEN>)
14
-
15
- response = client.account
16
- # => <Monday::Response ...>
17
-
18
- puts response.body
19
- ```
20
- {% endcode %}
21
-
22
- This will return the accounts' ID and name fields by default.
23
-
24
- The response body from the above query would be as follows:
25
-
26
- {% code lineNumbers="true" %}
27
- ```json
28
- {
29
- "data": {
30
- "users": [
31
- {
32
- "account": {
33
- "id": 1234,
34
- "name": "Test User's Team"
35
- }
36
- }
37
- ]
38
- },
39
- "account_id": 123
40
- }
41
- ```
42
- {% endcode %}
43
-
44
- ### Customizing fields to retrieve
45
-
46
- You can customize the fields to retrieve by passing in the `select` option and listing all the fields you need to retrieve as an array.
47
-
48
- {% code lineNumbers="true" %}
49
- ```ruby
50
- client = Monday::Client.new(token: <AUTH_TOKEN>)
51
-
52
- select = %w[id name slug logo country_code]
53
-
54
- response = client.account(select: select)
55
-
56
- puts response.body
57
- ```
58
- {% endcode %}
59
-
60
- ### Retrieving nested fields
61
-
62
- Some fields have nested attributes, and you need to specify the attributes to retrieve that field; else, the API will respond with an error. For example, the field `plan` is of type `Plan` and expects you to pass the attributes you want to retrieve for the `plan` field.
63
-
64
- {% code lineNumbers="true" %}
65
- ```ruby
66
- client = Monday::Client.new(token: <AUTH_TOKEN>)
67
-
68
- select = [
69
- "id",
70
- "name",
71
- {
72
- creator: %w[id name email is_admin]
73
- }
74
- ]
75
-
76
- response = client.boards(select: select)
77
-
78
- puts response.body
79
- ```
80
- {% endcode %}
81
-
82
- You can find the list of all the available fields for account [here](https://developer.monday.com/api-reference/docs/account#fields).
@@ -1,9 +0,0 @@
1
- # Activity Log
2
-
3
- The activity log API is used to access the activity on your boards. It includes the following methods:
4
-
5
- [activity\_logs.md](activity\_logs.md "mention")
6
-
7
- {% hint style="info" %}
8
- Visit monday.com's API documentation to know more about the [activity logs API](https://developer.monday.com/api-reference/docs/activity-logs).
9
- {% endhint %}
@@ -1,95 +0,0 @@
1
- # #activity\_logs
2
-
3
- Querying `activity_logs` will return a collection of activity logs from a specific board.
4
-
5
- ### Basic usage
6
-
7
- This method accepts one required argument - `board_ids`, an array of board IDs.
8
-
9
- {% code lineNumbers="true" %}
10
- ```ruby
11
- client = Monday::Client.new(token: <AUTH_TOKEN>)
12
-
13
- board_ids = [123, 456]
14
- response = client.activity_logs(board_ids)
15
-
16
- puts response.body
17
- ```
18
- {% endcode %}
19
-
20
- This will return the activity logs' ID, event and data fields by default.
21
-
22
- The response body from the above query would be as follows:
23
-
24
- {% code lineNumbers="true" %}
25
- ```json
26
- {
27
- "data": {
28
- "boards": [
29
- {
30
- "activity_logs": [
31
- {
32
- "id": "123-abc",
33
- "event": "create_column",
34
- "data": "{\"board_id\":123,\"column_id\":\"date0\",\"column_title\":\"Date\",\"column_type\":\"date\"}"
35
- },
36
- {
37
- "id": "456-def",
38
- "event": "create_column",
39
- "data": "{\"board_id\":123,\"column_id\":\"status\",\"column_title\":\"Status\",\"column_type\":\"color\"}"
40
- },
41
- {
42
- "id": "789-ghi",
43
- "event": "create_column",
44
- "data": "{\"board_id\":123,\"column_id\":\"name\",\"column_title\":\"Name\",\"column_type\":\"name\"}"
45
- }
46
- ]
47
- }
48
- ]
49
- },
50
- "account_id": 123
51
- }
52
- ```
53
- {% endcode %}
54
-
55
- ### Filtering activity logs
56
-
57
- This method accepts various arguments to filter down the activity logs. You can find the complete list of arguments [here](https://developer.monday.com/api-reference/docs/activity-logs#arguments).
58
-
59
- You can pass these filters using the `args` option.
60
-
61
- {% code lineNumbers="true" %}
62
- ```ruby
63
- client = Monday::Client.new(token: <AUTH_TOKEN>)
64
-
65
- board_ids = [123, 456]
66
- args = {
67
- from: "2023-01-01T00:00:00Z",
68
- to: "2023-06-01T00:00:00Z"
69
- }
70
- response = client.activity_logs(board_ids, args: args)
71
-
72
- puts response.body
73
- ```
74
- {% endcode %}
75
-
76
- This will filter and return the logs from Jan 1, 2023, to Jun 1, 2023.
77
-
78
- ### Customizing fields to retrieve
79
-
80
- You can customize the fields to retrieve by passing in the `select` option and listing all the fields you need to retrieve as an array.
81
-
82
- {% code lineNumbers="true" %}
83
- ```ruby
84
- client = Monday::Client.new(token: <AUTH_TOKEN>)
85
-
86
- board_ids = [123, 456]
87
-
88
- select = %w[id event data entity user_id]
89
- response = client.activity_logs(board_ids, select: select)
90
-
91
- puts response.body
92
- ```
93
- {% endcode %}
94
-
95
- You can find the list of all the available fields for activity logs [here](https://developer.monday.com/api-reference/docs/activity-logs#fields).
@@ -1,21 +0,0 @@
1
- # Board
2
-
3
- The boards API is used to access and mutate the board data. It includes the following methods:
4
-
5
- [boards.md](boards.md "mention")
6
-
7
- [create\_board.md](create\_board.md "mention")
8
-
9
- [duplicate\_board.md](duplicate\_board.md "mention")
10
-
11
- [update\_board.md](update\_board.md "mention")
12
-
13
- [archive\_board.md](archive\_board.md "mention")
14
-
15
- [delete\_board.md](delete\_board.md "mention")
16
-
17
- [delete\_board\_subscribers.md](delete\_board\_subscribers.md "mention")
18
-
19
- {% hint style="info" %}
20
- Visit monday.com's API documentation to know more about the [boards API](https://developer.monday.com/api-reference/docs/boards).
21
- {% endhint %}
@@ -1,79 +0,0 @@
1
- # #archive\_board
2
-
3
- The `archive_board` mutation will allow you to archive a board.
4
-
5
- ### Basic usage
6
-
7
- This method accepts one required argument - `board_id`.
8
-
9
- {% code lineNumbers="true" %}
10
- ```ruby
11
- client = Monday::Client.new(token: <AUTH_TOKEN>)
12
-
13
- board_id = 789
14
- response = client.archive_board(board_id)
15
-
16
- puts response.body
17
- ```
18
- {% endcode %}
19
-
20
- This will archive the `789` board.
21
-
22
- This will return the board's ID by default.
23
-
24
- The response body from the above query would be as follows:
25
-
26
- {% code lineNumbers="true" %}
27
- ```json
28
- {
29
- "data": {
30
- "archive_board": {
31
- "id": "789"
32
- }
33
- },
34
- "account_id": 123
35
- }
36
- ```
37
- {% endcode %}
38
-
39
- ### Customizing fields to retrieve
40
-
41
- You can customize the fields to retrieve by passing in the `select` option and listing all the fields you need to retrieve as an array.
42
-
43
- {% code lineNumbers="true" %}
44
- ```ruby
45
- client = Monday::Client.new(token: <AUTH_TOKEN>)
46
-
47
- board_id = 789
48
- select = %w[id name description items_count permissions]
49
-
50
- response = client.archive_board(board_id, select: select)
51
-
52
- puts response.body
53
- ```
54
- {% endcode %}
55
-
56
- ### Retrieving nested fields
57
-
58
- Some fields have nested attributes, and you need to specify the attributes to retrieve that field; else, the API will respond with an error.
59
-
60
- {% code lineNumbers="true" %}
61
- ```ruby
62
- client = Monday::Client.new(token: <AUTH_TOKEN>)
63
-
64
- board_id = 789
65
- select = [
66
- "id",
67
- "name",
68
- {
69
- creator: %w[id name email is_admin]
70
- }
71
- ]
72
-
73
- response = client.archive_board(board_id, select: select)
74
-
75
- puts response.body
76
- ```
77
- {% endcode %}
78
-
79
- You can find the list of all the available fields for boards [here](https://developer.monday.com/api-reference/docs/board-view-queries#fields).