monday_ruby 0.6.2 → 1.1.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 +18 -0
- data/.simplecov +1 -0
- data/CHANGELOG.md +55 -0
- data/CONTRIBUTING.md +61 -0
- data/README.md +97 -51
- data/lib/monday/client.rb +30 -12
- data/lib/monday/configuration.rb +8 -0
- data/lib/monday/deprecation.rb +23 -0
- data/lib/monday/error.rb +5 -2
- data/lib/monday/request.rb +4 -1
- data/lib/monday/resources/account.rb +6 -4
- data/lib/monday/resources/activity_log.rb +7 -5
- data/lib/monday/resources/base.rb +20 -0
- data/lib/monday/resources/board.rb +71 -17
- data/lib/monday/resources/board_view.rb +6 -4
- data/lib/monday/resources/column.rb +28 -20
- data/lib/monday/resources/folder.rb +55 -0
- data/lib/monday/resources/group.rb +84 -16
- data/lib/monday/resources/item.rb +77 -13
- data/lib/monday/resources/subitem.rb +8 -6
- data/lib/monday/resources/update.rb +13 -11
- data/lib/monday/resources/workspace.rb +10 -8
- data/lib/monday/resources.rb +16 -20
- data/lib/monday/util.rb +33 -1
- data/lib/monday/version.rb +1 -1
- data/lib/monday_ruby.rb +1 -0
- metadata +22 -48
- data/docs/README.md +0 -13
- data/docs/SUMMARY.md +0 -40
- data/docs/client.md +0 -15
- data/docs/configuration.md +0 -40
- data/docs/error-handling.md +0 -71
- data/docs/getting-started.md +0 -25
- data/docs/quick-start.md +0 -269
- data/docs/resources/README.md +0 -27
- data/docs/resources/account/README.md +0 -9
- data/docs/resources/account/accounts.md +0 -82
- data/docs/resources/activity-log/README.md +0 -9
- data/docs/resources/activity-log/activity_logs.md +0 -95
- data/docs/resources/board/README.md +0 -21
- data/docs/resources/board/archive_board.md +0 -79
- data/docs/resources/board/boards.md +0 -96
- data/docs/resources/board/create_board.md +0 -95
- data/docs/resources/board/delete_board.md +0 -79
- data/docs/resources/board/delete_board_subscribers.md +0 -87
- data/docs/resources/board/duplicate_board.md +0 -94
- data/docs/resources/board/update_board.md +0 -91
- data/docs/resources/board-view/README.md +0 -9
- data/docs/resources/board-view/board_views.md +0 -88
- data/docs/resources/column/README.md +0 -25
- data/docs/resources/column/change_column_metadata.md +0 -70
- data/docs/resources/column/change_column_title.md +0 -68
- data/docs/resources/column/change_column_value.md +0 -73
- data/docs/resources/column/change_multiple_column_value.md +0 -81
- data/docs/resources/column/change_simple_column_value.md +0 -69
- data/docs/resources/column/column_values.md +0 -115
- data/docs/resources/column/columns.md +0 -117
- data/docs/resources/column/create_column.md +0 -70
- data/docs/resources/column/delete_column.md +0 -58
- data/docs/resources/item/README.md +0 -17
- data/docs/resources/item/archive_item.md +0 -80
- data/docs/resources/item/create_item.md +0 -105
- data/docs/resources/item/delete_item.md +0 -80
- data/docs/resources/item/duplicate_item.md +0 -87
- data/docs/resources/item/items.md +0 -95
- data/docs/response.md +0 -21
- data/monday_ruby.gemspec +0 -37
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
3
5
|
module Monday
|
|
4
6
|
module Resources
|
|
5
7
|
# Represents Monday.com's subitem resource.
|
|
6
|
-
|
|
8
|
+
class Subitem < Base
|
|
7
9
|
DEFAULT_SELECT = %w[id name created_at].freeze
|
|
8
10
|
|
|
9
11
|
# Retrieves all the subitems for the item.
|
|
@@ -11,10 +13,10 @@ module Monday
|
|
|
11
13
|
# Allows filtering subitems using the args option.
|
|
12
14
|
# Allows customizing the values to retrieve using the select option.
|
|
13
15
|
# By default, ID, name and created_at fields are retrieved.
|
|
14
|
-
def
|
|
15
|
-
|
|
16
|
+
def query(args: {}, select: DEFAULT_SELECT)
|
|
17
|
+
request_query = "query{items#{Util.format_args(args)}{ subitems{#{Util.format_select(select)}}}}"
|
|
16
18
|
|
|
17
|
-
make_request(
|
|
19
|
+
make_request(request_query)
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
# Creates a new subitem.
|
|
@@ -22,8 +24,8 @@ module Monday
|
|
|
22
24
|
# Allows customizing the subitem creation using the args option.
|
|
23
25
|
# Allows customizing the values to retrieve using the select option.
|
|
24
26
|
# By default, ID, name and created_at fields are retrieved.
|
|
25
|
-
def
|
|
26
|
-
query = "mutation
|
|
27
|
+
def create(args: {}, select: DEFAULT_SELECT)
|
|
28
|
+
query = "mutation{create_subitem#{Util.format_args(args)}{#{Util.format_select(select)}}}"
|
|
27
29
|
|
|
28
30
|
make_request(query)
|
|
29
31
|
end
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
3
5
|
module Monday
|
|
4
6
|
module Resources
|
|
5
7
|
# Represents Monday.com's update resource.
|
|
6
|
-
|
|
8
|
+
class Update < Base
|
|
7
9
|
DEFAULT_SELECT = %w[id body created_at].freeze
|
|
8
10
|
|
|
9
11
|
# Retrieves all the updates.
|
|
@@ -11,10 +13,10 @@ module Monday
|
|
|
11
13
|
# Allows filtering updates using the args option.
|
|
12
14
|
# Allows customizing the values to retrieve using the select option.
|
|
13
15
|
# By default, ID, body and created_at fields are retrieved.
|
|
14
|
-
def
|
|
15
|
-
|
|
16
|
+
def query(args: {}, select: DEFAULT_SELECT)
|
|
17
|
+
request_query = "query{updates#{Util.format_args(args)}{#{Util.format_select(select)}}}"
|
|
16
18
|
|
|
17
|
-
make_request(
|
|
19
|
+
make_request(request_query)
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
# Creates a new update.
|
|
@@ -22,8 +24,8 @@ module Monday
|
|
|
22
24
|
# Allows customizing the update creation using the args option.
|
|
23
25
|
# Allows customizing the values to retrieve using the select option.
|
|
24
26
|
# By default, ID, body and created_at fields are retrieved.
|
|
25
|
-
def
|
|
26
|
-
query = "mutation
|
|
27
|
+
def create(args: {}, select: DEFAULT_SELECT)
|
|
28
|
+
query = "mutation{create_update#{Util.format_args(args)}{#{Util.format_select(select)}}}"
|
|
27
29
|
|
|
28
30
|
make_request(query)
|
|
29
31
|
end
|
|
@@ -33,8 +35,8 @@ module Monday
|
|
|
33
35
|
# Allows customizing the update creation using the args option.
|
|
34
36
|
# Allows customizing the values to retrieve using the select option.
|
|
35
37
|
# By default, ID is retrieved.
|
|
36
|
-
def
|
|
37
|
-
query = "mutation
|
|
38
|
+
def like(args: {}, select: %w[id])
|
|
39
|
+
query = "mutation{like_update#{Util.format_args(args)}{#{Util.format_select(select)}}}"
|
|
38
40
|
|
|
39
41
|
make_request(query)
|
|
40
42
|
end
|
|
@@ -45,7 +47,7 @@ module Monday
|
|
|
45
47
|
# Allows customizing the values to retrieve using the select option.
|
|
46
48
|
# By default, ID is retrieved.
|
|
47
49
|
def clear_item_updates(args: {}, select: %w[id])
|
|
48
|
-
query = "mutation
|
|
50
|
+
query = "mutation{clear_item_updates#{Util.format_args(args)}{#{Util.format_select(select)}}}"
|
|
49
51
|
|
|
50
52
|
make_request(query)
|
|
51
53
|
end
|
|
@@ -55,8 +57,8 @@ module Monday
|
|
|
55
57
|
# Allows customizing the update creation using the args option.
|
|
56
58
|
# Allows customizing the values to retrieve using the select option.
|
|
57
59
|
# By default, ID is retrieved.
|
|
58
|
-
def
|
|
59
|
-
query = "mutation
|
|
60
|
+
def delete(args: {}, select: %w[id])
|
|
61
|
+
query = "mutation{delete_update#{Util.format_args(args)}{#{Util.format_select(select)}}}"
|
|
60
62
|
|
|
61
63
|
make_request(query)
|
|
62
64
|
end
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "base"
|
|
4
|
+
|
|
3
5
|
module Monday
|
|
4
6
|
module Resources
|
|
5
7
|
# Represents Monday.com's workspace resource.
|
|
6
|
-
|
|
8
|
+
class Workspace < Base
|
|
7
9
|
DEFAULT_SELECT = %w[id name description].freeze
|
|
8
10
|
|
|
9
11
|
# Retrieves all the workspaces.
|
|
@@ -11,10 +13,10 @@ module Monday
|
|
|
11
13
|
# Allows filtering workspaces using the args option.
|
|
12
14
|
# Allows customizing the values to retrieve using the select option.
|
|
13
15
|
# By default, ID, name and description fields are retrieved.
|
|
14
|
-
def
|
|
15
|
-
|
|
16
|
+
def query(args: {}, select: DEFAULT_SELECT)
|
|
17
|
+
request_query = "query{workspaces#{Util.format_args(args)}{#{Util.format_select(select)}}}"
|
|
16
18
|
|
|
17
|
-
make_request(
|
|
19
|
+
make_request(request_query)
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
# Creates a new workspaces.
|
|
@@ -22,8 +24,8 @@ module Monday
|
|
|
22
24
|
# Allows customizing creating a workspace using the args option.
|
|
23
25
|
# Allows customizing the values to retrieve using the select option.
|
|
24
26
|
# By default, ID, name and description fields are retrieved.
|
|
25
|
-
def
|
|
26
|
-
query = "mutation
|
|
27
|
+
def create(args: {}, select: DEFAULT_SELECT)
|
|
28
|
+
query = "mutation{create_workspace#{Util.format_args(args)}{#{Util.format_select(select)}}}"
|
|
27
29
|
|
|
28
30
|
make_request(query)
|
|
29
31
|
end
|
|
@@ -33,8 +35,8 @@ module Monday
|
|
|
33
35
|
# Requires workspace_id to delete the workspace.
|
|
34
36
|
# Allows customizing the values to retrieve using the select option.
|
|
35
37
|
# By default, returns the ID of the workspace deleted.
|
|
36
|
-
def
|
|
37
|
-
query = "mutation
|
|
38
|
+
def delete(workspace_id, select: ["id"])
|
|
39
|
+
query = "mutation{delete_workspace(workspace_id: #{workspace_id}){#{Util.format_select(select)}}}"
|
|
38
40
|
|
|
39
41
|
make_request(query)
|
|
40
42
|
end
|
data/lib/monday/resources.rb
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
require_relative "resources/activity_log"
|
|
5
|
-
require_relative "resources/board"
|
|
6
|
-
require_relative "resources/board_view"
|
|
7
|
-
require_relative "resources/column"
|
|
8
|
-
require_relative "resources/group"
|
|
9
|
-
require_relative "resources/item"
|
|
10
|
-
require_relative "resources/subitem"
|
|
11
|
-
require_relative "resources/workspace"
|
|
12
|
-
require_relative "resources/update"
|
|
3
|
+
Dir[File.join(__dir__, "resources", "*.rb")].sort.each { |file| require file }
|
|
13
4
|
|
|
14
5
|
module Monday
|
|
6
|
+
# Encapsulates all available resources and includes them in the client.
|
|
15
7
|
module Resources
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
def self.initialize(client)
|
|
9
|
+
constants.each do |constant|
|
|
10
|
+
resource_class = const_get(constant)
|
|
11
|
+
resource_name = constant.to_s.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase
|
|
12
|
+
client.instance_variable_set("@#{resource_name}", resource_class.new(client))
|
|
13
|
+
define_resource_accessor(client, resource_name) unless client.class.method_defined?(resource_name)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.define_resource_accessor(client, resource_name)
|
|
18
|
+
client.class.class_eval do
|
|
19
|
+
attr_reader resource_name
|
|
20
|
+
end
|
|
21
|
+
end
|
|
26
22
|
end
|
|
27
23
|
end
|
data/lib/monday/util.rb
CHANGED
|
@@ -29,6 +29,18 @@ module Monday
|
|
|
29
29
|
values
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# Formats a hash as a GraphQL input object (not JSON string)
|
|
33
|
+
# Used for complex input types like ItemsQuery
|
|
34
|
+
#
|
|
35
|
+
# input: { rules: [{ column_id: "status", compare_value: [1] }], operator: :and }
|
|
36
|
+
# output: { rules: [{ column_id: "status", compare_value: [1] }], operator: and }
|
|
37
|
+
def format_graphql_object(hash)
|
|
38
|
+
formatted = hash.map do |key, value|
|
|
39
|
+
"#{key}: #{format_graphql_value(value)}"
|
|
40
|
+
end.join(", ")
|
|
41
|
+
"{#{formatted}}"
|
|
42
|
+
end
|
|
43
|
+
|
|
32
44
|
def status_code_exceptions_mapping(status_code)
|
|
33
45
|
{
|
|
34
46
|
"500" => InternalServerError,
|
|
@@ -43,7 +55,9 @@ module Monday
|
|
|
43
55
|
def response_error_exceptions_mapping(error_code)
|
|
44
56
|
{
|
|
45
57
|
"ComplexityException" => [ComplexityError, 429],
|
|
58
|
+
"COMPLEXITY_BUDGET_EXHAUSTED" => [RateLimitError, 429],
|
|
46
59
|
"UserUnauthorizedException" => [AuthorizationError, 403],
|
|
60
|
+
"USER_UNAUTHORIZED" => [AuthorizationError, 403],
|
|
47
61
|
"ResourceNotFoundException" => [ResourceNotFoundError, 404],
|
|
48
62
|
"InvalidUserIdException" => [InvalidRequestError, 400],
|
|
49
63
|
"InvalidVersionException" => [InvalidRequestError, 400],
|
|
@@ -58,7 +72,8 @@ module Monday
|
|
|
58
72
|
"ItemNameTooLongException" => [InvalidRequestError, 400],
|
|
59
73
|
"ColumnValueException" => [InvalidRequestError, 400],
|
|
60
74
|
"CorrectedValueException" => [InvalidRequestError, 400],
|
|
61
|
-
"InvalidWorkspaceIdException" => [InvalidRequestError, 400]
|
|
75
|
+
"InvalidWorkspaceIdException" => [InvalidRequestError, 400],
|
|
76
|
+
"INTERNAL_SERVER_ERROR" => [InternalServerError, 500]
|
|
62
77
|
}[error_code] || [Error, 400]
|
|
63
78
|
end
|
|
64
79
|
|
|
@@ -76,9 +91,26 @@ module Monday
|
|
|
76
91
|
end.join(" ")
|
|
77
92
|
end
|
|
78
93
|
|
|
94
|
+
def format_graphql_value(value)
|
|
95
|
+
case value
|
|
96
|
+
when Hash
|
|
97
|
+
format_graphql_object(value)
|
|
98
|
+
when Array
|
|
99
|
+
"[#{value.map { |v| format_graphql_value(v) }.join(", ")}]"
|
|
100
|
+
when Integer, TrueClass, FalseClass
|
|
101
|
+
value
|
|
102
|
+
when String
|
|
103
|
+
"\"#{value}\""
|
|
104
|
+
else
|
|
105
|
+
value.to_s
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
79
109
|
def formatted_args_value(value)
|
|
110
|
+
return value if value.is_a?(Symbol)
|
|
80
111
|
return value.to_json.to_json if value.is_a?(Hash)
|
|
81
112
|
return value if integer?(value)
|
|
113
|
+
return "[#{value.map { |v| formatted_args_value(v) }.join(", ")}]" if value.is_a?(Array)
|
|
82
114
|
|
|
83
115
|
"\"#{value}\""
|
|
84
116
|
end
|
data/lib/monday/version.rb
CHANGED
data/lib/monday_ruby.rb
CHANGED
metadata
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: monday_ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sanif Himani
|
|
8
8
|
- Wes Hays
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: exe
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
13
|
-
dependencies:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: base64
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.3.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.3.0
|
|
14
27
|
description: A Gem to easily interact with monday.com API using native Ruby
|
|
15
28
|
email:
|
|
16
29
|
- sanifhimani92@gmail.com
|
|
@@ -30,55 +43,19 @@ files:
|
|
|
30
43
|
- LICENSE
|
|
31
44
|
- README.md
|
|
32
45
|
- Rakefile
|
|
33
|
-
- docs/README.md
|
|
34
|
-
- docs/SUMMARY.md
|
|
35
|
-
- docs/client.md
|
|
36
|
-
- docs/configuration.md
|
|
37
|
-
- docs/error-handling.md
|
|
38
|
-
- docs/getting-started.md
|
|
39
|
-
- docs/quick-start.md
|
|
40
|
-
- docs/resources/README.md
|
|
41
|
-
- docs/resources/account/README.md
|
|
42
|
-
- docs/resources/account/accounts.md
|
|
43
|
-
- docs/resources/activity-log/README.md
|
|
44
|
-
- docs/resources/activity-log/activity_logs.md
|
|
45
|
-
- docs/resources/board-view/README.md
|
|
46
|
-
- docs/resources/board-view/board_views.md
|
|
47
|
-
- docs/resources/board/README.md
|
|
48
|
-
- docs/resources/board/archive_board.md
|
|
49
|
-
- docs/resources/board/boards.md
|
|
50
|
-
- docs/resources/board/create_board.md
|
|
51
|
-
- docs/resources/board/delete_board.md
|
|
52
|
-
- docs/resources/board/delete_board_subscribers.md
|
|
53
|
-
- docs/resources/board/duplicate_board.md
|
|
54
|
-
- docs/resources/board/update_board.md
|
|
55
|
-
- docs/resources/column/README.md
|
|
56
|
-
- docs/resources/column/change_column_metadata.md
|
|
57
|
-
- docs/resources/column/change_column_title.md
|
|
58
|
-
- docs/resources/column/change_column_value.md
|
|
59
|
-
- docs/resources/column/change_multiple_column_value.md
|
|
60
|
-
- docs/resources/column/change_simple_column_value.md
|
|
61
|
-
- docs/resources/column/column_values.md
|
|
62
|
-
- docs/resources/column/columns.md
|
|
63
|
-
- docs/resources/column/create_column.md
|
|
64
|
-
- docs/resources/column/delete_column.md
|
|
65
|
-
- docs/resources/item/README.md
|
|
66
|
-
- docs/resources/item/archive_item.md
|
|
67
|
-
- docs/resources/item/create_item.md
|
|
68
|
-
- docs/resources/item/delete_item.md
|
|
69
|
-
- docs/resources/item/duplicate_item.md
|
|
70
|
-
- docs/resources/item/items.md
|
|
71
|
-
- docs/response.md
|
|
72
46
|
- lib/monday/client.rb
|
|
73
47
|
- lib/monday/configuration.rb
|
|
48
|
+
- lib/monday/deprecation.rb
|
|
74
49
|
- lib/monday/error.rb
|
|
75
50
|
- lib/monday/request.rb
|
|
76
51
|
- lib/monday/resources.rb
|
|
77
52
|
- lib/monday/resources/account.rb
|
|
78
53
|
- lib/monday/resources/activity_log.rb
|
|
54
|
+
- lib/monday/resources/base.rb
|
|
79
55
|
- lib/monday/resources/board.rb
|
|
80
56
|
- lib/monday/resources/board_view.rb
|
|
81
57
|
- lib/monday/resources/column.rb
|
|
58
|
+
- lib/monday/resources/folder.rb
|
|
82
59
|
- lib/monday/resources/group.rb
|
|
83
60
|
- lib/monday/resources/item.rb
|
|
84
61
|
- lib/monday/resources/subitem.rb
|
|
@@ -88,16 +65,14 @@ files:
|
|
|
88
65
|
- lib/monday/util.rb
|
|
89
66
|
- lib/monday/version.rb
|
|
90
67
|
- lib/monday_ruby.rb
|
|
91
|
-
- monday_ruby.gemspec
|
|
92
68
|
homepage: https://github.com/sanifhimani/monday_ruby
|
|
93
69
|
licenses:
|
|
94
70
|
- MIT
|
|
95
71
|
metadata:
|
|
96
72
|
homepage_uri: https://github.com/sanifhimani/monday_ruby
|
|
97
73
|
documentation_uri: https://monday-ruby.gitbook.io/docs/
|
|
98
|
-
changelog_uri: https://github.com/sanifhimani/monday_ruby/blob/
|
|
74
|
+
changelog_uri: https://github.com/sanifhimani/monday_ruby/blob/v1.1.0/CHANGELOG.md
|
|
99
75
|
rubygems_mfa_required: 'true'
|
|
100
|
-
post_install_message:
|
|
101
76
|
rdoc_options: []
|
|
102
77
|
require_paths:
|
|
103
78
|
- lib
|
|
@@ -112,8 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
112
87
|
- !ruby/object:Gem::Version
|
|
113
88
|
version: '0'
|
|
114
89
|
requirements: []
|
|
115
|
-
rubygems_version: 3.
|
|
116
|
-
signing_key:
|
|
90
|
+
rubygems_version: 3.6.9
|
|
117
91
|
specification_version: 4
|
|
118
92
|
summary: Ruby bindings to use the monday.com API
|
|
119
93
|
test_files: []
|
data/docs/README.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Monday API Library for Ruby
|
|
2
|
-
|
|
3
|
-
This library provides convenient access to the monday.com API from the application written in the Ruby language.
|
|
4
|
-
|
|
5
|
-
The library provides:
|
|
6
|
-
|
|
7
|
-
1. A pre-defined set of methods to easily interact with the API resources.
|
|
8
|
-
2. Easy configuration path for fast setup and use.
|
|
9
|
-
3. Easy error handling
|
|
10
|
-
|
|
11
|
-
#### Requirements
|
|
12
|
-
|
|
13
|
-
* Ruby 2.7+
|
data/docs/SUMMARY.md
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Table of contents
|
|
2
|
-
|
|
3
|
-
* [Monday API Library for Ruby](README.md)
|
|
4
|
-
* [Getting Started](getting-started.md)
|
|
5
|
-
* [Configuration](configuration.md)
|
|
6
|
-
* [Client](client.md)
|
|
7
|
-
* [Response](response.md)
|
|
8
|
-
* [Quick Start](quick-start.md)
|
|
9
|
-
* [Error Handling](error-handling.md)
|
|
10
|
-
* [Resources](resources/README.md)
|
|
11
|
-
* [Account](resources/account/README.md)
|
|
12
|
-
* [#accounts](resources/account/accounts.md)
|
|
13
|
-
* [Activity Log](resources/activity-log/README.md)
|
|
14
|
-
* [#activity\_logs](resources/activity-log/activity\_logs.md)
|
|
15
|
-
* [Board View](resources/board-view/README.md)
|
|
16
|
-
* [#board\_views](resources/board-view/board\_views.md)
|
|
17
|
-
* [Board](resources/board/README.md)
|
|
18
|
-
* [#boards](resources/board/boards.md)
|
|
19
|
-
* [#create\_board](resources/board/create\_board.md)
|
|
20
|
-
* [#duplicate\_board](resources/board/duplicate\_board.md)
|
|
21
|
-
* [#update\_board](resources/board/update\_board.md)
|
|
22
|
-
* [#archive\_board](resources/board/archive\_board.md)
|
|
23
|
-
* [#delete\_board](resources/board/delete\_board.md)
|
|
24
|
-
* [#delete\_board\_subscribers](resources/board/delete\_board\_subscribers.md)
|
|
25
|
-
* [Column](resources/column/README.md)
|
|
26
|
-
* [#columns](resources/column/columns.md)
|
|
27
|
-
* [#column\_values](resources/column/column\_values.md)
|
|
28
|
-
* [#create\_column](resources/column/create\_column.md)
|
|
29
|
-
* [#change\_column\_title](resources/column/change\_column\_title.md)
|
|
30
|
-
* [#change\_column\_metadata](resources/column/change\_column\_metadata.md)
|
|
31
|
-
* [#change\_column\_value](resources/column/change\_column\_value.md)
|
|
32
|
-
* [#change\_simple\_column\_value](resources/column/change\_simple\_column\_value.md)
|
|
33
|
-
* [#change\_multiple\_column\_value](resources/column/change\_multiple\_column\_value.md)
|
|
34
|
-
* [#delete\_column](resources/column/delete\_column.md)
|
|
35
|
-
* [Item](resources/item/README.md)
|
|
36
|
-
* [#items](resources/item/items.md)
|
|
37
|
-
* [#create\_item](resources/item/create\_item.md)
|
|
38
|
-
* [#duplicate\_item](resources/item/duplicate\_item.md)
|
|
39
|
-
* [#archive\_item](resources/item/archive\_item.md)
|
|
40
|
-
* [#delete\_item](resources/item/delete\_item.md)
|
data/docs/client.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Client
|
|
2
|
-
|
|
3
|
-
The Monday client is flat, meaning most API actions are available as methods on the client object. To initialize a client, run the following:
|
|
4
|
-
|
|
5
|
-
{% code lineNumbers="true" %}
|
|
6
|
-
```ruby
|
|
7
|
-
# If the library is configured globally
|
|
8
|
-
client_with_global_config = Monday::Client.new
|
|
9
|
-
|
|
10
|
-
# For a specific client
|
|
11
|
-
client = Monday::Client.new(token: <AUTH_TOKEN>)
|
|
12
|
-
```
|
|
13
|
-
{% endcode %}
|
|
14
|
-
|
|
15
|
-
You can then use all the [resources](resources/) using the client object.
|
data/docs/configuration.md
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Configuration
|
|
2
|
-
|
|
3
|
-
To interact with the API, you must provide a valid auth token. This token can be generated from the Administration tab on the account. For more authentication information, please look at monday.com's [API documentation](https://developer.monday.com/api-reference/docs/authentication).
|
|
4
|
-
|
|
5
|
-
Once you have the authentication token, you can either globally configure the library or you can configure a specific client.
|
|
6
|
-
|
|
7
|
-
### Global
|
|
8
|
-
|
|
9
|
-
To configure the library globally, you can do the following:
|
|
10
|
-
|
|
11
|
-
```ruby
|
|
12
|
-
require "monday_ruby"
|
|
13
|
-
|
|
14
|
-
Monday.configure do |config|
|
|
15
|
-
config.token = <AUTH_TOKEN>
|
|
16
|
-
end
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Client specific config
|
|
20
|
-
|
|
21
|
-
To configure a client, you can do the following:
|
|
22
|
-
|
|
23
|
-
```ruby
|
|
24
|
-
require "monday_ruby"
|
|
25
|
-
|
|
26
|
-
client = Monday::Client.new(token: <AUTH_TOKEN>)
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
You can optionally pass in the version of the API you want to use using the `version` configuration field.
|
|
30
|
-
|
|
31
|
-
By default, the latest stable version is used. Read more about the version on monday.com's [official documentation](https://developer.monday.com/api-reference/docs/api-versioning).
|
|
32
|
-
|
|
33
|
-
```ruby
|
|
34
|
-
require "monday_ruby"
|
|
35
|
-
|
|
36
|
-
Monday.configure do |config|
|
|
37
|
-
config.token = <AUTH_TOKEN>
|
|
38
|
-
config.version = "2023-07"
|
|
39
|
-
end
|
|
40
|
-
```
|
data/docs/error-handling.md
DELETED
|
@@ -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).
|
data/docs/getting-started.md
DELETED
|
@@ -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
|
-
```
|