monday_ruby 0.4.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f0e71a61ef39a418ca03c8151a357e3623f9c4a030c74cee613e4cefc8d684a
4
- data.tar.gz: 2ab39c2856f63b1e72a9395630c43b92fd589b1790954b36791ed105f6e52362
3
+ metadata.gz: a1d01fc38546be402980f538a78e38ef1bdf49426dea93eb7d354115c9c156c9
4
+ data.tar.gz: '064188d59638c6e9beb2f1e5c9ea4c1057227e4ace71d89fe61ce56a5d4e39ce'
5
5
  SHA512:
6
- metadata.gz: 65ad4b3eec9937e42fe5a2a811f7ccdc2caf3c17e4b38ede2b10a7be148519ec6a7e75d5b272fb86c33667be7309b2c51858f7e97563f147ca1f35d9adca1ac9
7
- data.tar.gz: 41c14a6bd4c846d25701a19a7dadb775e379ac2a45b1967b3d97025301dfb1ccdbc5983c4efa6d78769f9daedfb9d3a9773fa976140816017d97308f128b4814
6
+ metadata.gz: 8df9570337bd4132ed4693d1cff769ceaf81def899d5d193b496dc77f5896e3af2123fc1144d47db4ca0d77519996a0a8a0c040a715159147beb16036f924a6f
7
+ data.tar.gz: 95551bc412de20e14461fe3c49842829177347d15a6d175656bdfdc1820b884c3262e17796c922f37c270fe75e1581b623c15aa847620cf66ee995aeca6478a9
data/.simplecov ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ SimpleCov.minimum_coverage 97
data/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## v0.6.1 (March 24, 2024)
2
+
3
+ ### Bug Fixes
4
+
5
+ - Fix formatting error for single words (Issue)[https://github.com/sanifhimani/monday_ruby/issues/16]
6
+
7
+ ## v0.6.0 (October 9, 2023)
8
+
9
+ ### Added
10
+
11
+ - Support for working with subitems:
12
+ - Listing subitems
13
+ - Creating a subitem
14
+
15
+ - Support for working with updates:
16
+ - Create an Update
17
+ - Like an Update
18
+ - Clear an item's updates
19
+ - Delete an update
20
+
21
+ ## v0.5.0 (September 21, 2023)
22
+
23
+ ### Added
24
+
25
+ - Support for working with board groups:
26
+ - Reading, Creating, Deleting
27
+ - Archiving, Duplicating
28
+ - Moving an item to a group
29
+
1
30
  ## v0.4.0 (September 15, 2023)
2
31
 
3
32
  ### Added
data/lib/monday/error.rb CHANGED
@@ -79,9 +79,9 @@ module Monday
79
79
  #
80
80
  # It is also raised when the body returns the following error_codes:
81
81
  # InvalidUserIdException, InvalidVersionException, InvalidColumnIdException
82
- # InvalidItemIdException, InvalidBoardIdException, InvalidArgumentException
82
+ # InvalidItemIdException, InvalidSubitemIdException, InvalidBoardIdException, InvalidArgumentException
83
83
  # CreateBoardException, ItemsLimitationException, ItemNameTooLongException
84
- # ColumnValueException, CorrectedValueException
84
+ # ColumnValueException, CorrectedValueException, InvalidGroupIdException
85
85
  class InvalidRequestError < Error
86
86
  end
87
87
 
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Monday
4
+ module Resources
5
+ # Represents Monday.com's group resource.
6
+ module Group
7
+ DEFAULT_SELECT = %w[id title].freeze
8
+
9
+ # Retrieves all the groups.
10
+ #
11
+ # Allows filtering groups using the args option.
12
+ # Allows customizing the values to retrieve using the select option.
13
+ # By default, ID and title fields are retrieved.
14
+ def groups(args: {}, select: DEFAULT_SELECT)
15
+ query = "query { boards(#{Util.format_args(args)}) { groups{#{Util.format_select(select)}}}}"
16
+
17
+ make_request(query)
18
+ end
19
+
20
+ # Creates a new group.
21
+ #
22
+ # Allows customizing creating a group using the args option.
23
+ # Allows customizing the values to retrieve using the select option.
24
+ # By default, ID and title fields are retrieved.
25
+ def create_group(args: {}, select: DEFAULT_SELECT)
26
+ query = "mutation { create_group(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
27
+
28
+ make_request(query)
29
+ end
30
+
31
+ # Updates a group.
32
+ #
33
+ # Allows customizing updating the group using the args option.
34
+ # By default, returns the ID of the updated group.
35
+ def update_group(args: {}, select: ["id"])
36
+ query = "mutation { update_group(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
37
+
38
+ make_request(query)
39
+ end
40
+
41
+ # Deletes a group.
42
+ #
43
+ # Requires board_id and group_id in args option to delete the group.
44
+ # Allows customizing the values to retrieve using the select option.
45
+ # By default, returns the ID of the group deleted.
46
+ def delete_group(args: {}, select: ["id"])
47
+ query = "mutation { delete_group(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
48
+
49
+ make_request(query)
50
+ end
51
+
52
+ # Archives a group.
53
+ #
54
+ # Requires board_id and group_id in args option to archive the group.
55
+ # Allows customizing the values to retrieve using the select option.
56
+ # By default, returns the ID of the group archived.
57
+ def archive_group(args: {}, select: ["id"])
58
+ query = "mutation { archive_group(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
59
+
60
+ make_request(query)
61
+ end
62
+
63
+ # Duplicates a group.
64
+ #
65
+ # Requires board_id and group_id in args option to duplicate the group.
66
+ # Allows customizing the values to retrieve using the select option.
67
+ # By default, ID and title fields are retrieved.
68
+ def duplicate_group(args: {}, select: DEFAULT_SELECT)
69
+ query = "mutation { duplicate_group(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
70
+
71
+ make_request(query)
72
+ end
73
+
74
+ # Move item to group.
75
+ #
76
+ # Requires item_id and group_id in args option to move an item to a group.
77
+ # Allows customizing the values to retrieve using the select option.
78
+ # By default, ID and title fields are retrieved.
79
+ def move_item_to_group(args: {}, select: ["id"])
80
+ query = "mutation { move_item_to_group(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
81
+
82
+ make_request(query)
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Monday
4
+ module Resources
5
+ # Represents Monday.com's subitem resource.
6
+ module Subitem
7
+ DEFAULT_SELECT = %w[id name created_at].freeze
8
+
9
+ # Retrieves all the subitems for the item.
10
+ #
11
+ # Allows filtering subitems using the args option.
12
+ # Allows customizing the values to retrieve using the select option.
13
+ # By default, ID, name and created_at fields are retrieved.
14
+ def subitems(args: {}, select: DEFAULT_SELECT)
15
+ query = "query { items(#{Util.format_args(args)}) { subitems{#{Util.format_select(select)}}}}"
16
+
17
+ make_request(query)
18
+ end
19
+
20
+ # Creates a new subitem.
21
+ #
22
+ # Allows customizing the subitem creation using the args option.
23
+ # Allows customizing the values to retrieve using the select option.
24
+ # By default, ID, name and created_at fields are retrieved.
25
+ def create_subitem(args: {}, select: DEFAULT_SELECT)
26
+ query = "mutation { create_subitem(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
27
+
28
+ make_request(query)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Monday
4
+ module Resources
5
+ # Represents Monday.com's update resource.
6
+ module Update
7
+ DEFAULT_SELECT = %w[id body created_at].freeze
8
+
9
+ # Retrieves all the updates.
10
+ #
11
+ # Allows filtering updates using the args option.
12
+ # Allows customizing the values to retrieve using the select option.
13
+ # By default, ID, body and created_at fields are retrieved.
14
+ def updates(args: {}, select: DEFAULT_SELECT)
15
+ query = "query { updates(#{Util.format_args(args)}) { #{Util.format_select(select)}}}"
16
+
17
+ make_request(query)
18
+ end
19
+
20
+ # Creates a new update.
21
+ #
22
+ # Allows customizing the update creation using the args option.
23
+ # Allows customizing the values to retrieve using the select option.
24
+ # By default, ID, body and created_at fields are retrieved.
25
+ def create_update(args: {}, select: DEFAULT_SELECT)
26
+ query = "mutation { create_update(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
27
+
28
+ make_request(query)
29
+ end
30
+
31
+ # Like an update.
32
+ #
33
+ # Allows customizing the update creation using the args option.
34
+ # Allows customizing the values to retrieve using the select option.
35
+ # By default, ID is retrieved.
36
+ def like_update(args: {}, select: %w[id])
37
+ query = "mutation { like_update(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
38
+
39
+ make_request(query)
40
+ end
41
+
42
+ # Clear an item's update
43
+ #
44
+ # Allows customizing the update creation using the args option.
45
+ # Allows customizing the values to retrieve using the select option.
46
+ # By default, ID is retrieved.
47
+ def clear_item_updates(args: {}, select: %w[id])
48
+ query = "mutation { clear_item_updates(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
49
+
50
+ make_request(query)
51
+ end
52
+
53
+ # Delete an update
54
+ #
55
+ # Allows customizing the update creation using the args option.
56
+ # Allows customizing the values to retrieve using the select option.
57
+ # By default, ID is retrieved.
58
+ def delete_update(args: {}, select: %w[id])
59
+ query = "mutation { delete_update(#{Util.format_args(args)}) {#{Util.format_select(select)}}}"
60
+
61
+ make_request(query)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -5,8 +5,11 @@ require_relative "resources/activity_log"
5
5
  require_relative "resources/board"
6
6
  require_relative "resources/board_view"
7
7
  require_relative "resources/column"
8
+ require_relative "resources/group"
8
9
  require_relative "resources/item"
10
+ require_relative "resources/subitem"
9
11
  require_relative "resources/workspace"
12
+ require_relative "resources/update"
10
13
 
11
14
  module Monday
12
15
  module Resources
@@ -15,7 +18,10 @@ module Monday
15
18
  include Board
16
19
  include BoardView
17
20
  include Column
21
+ include Group
18
22
  include Item
23
+ include Subitem
19
24
  include Workspace
25
+ include Update
20
26
  end
21
27
  end
data/lib/monday/util.rb CHANGED
@@ -45,7 +45,9 @@ module Monday
45
45
  "InvalidVersionException" => [InvalidRequestError, 400],
46
46
  "InvalidColumnIdException" => [InvalidRequestError, 400],
47
47
  "InvalidItemIdException" => [InvalidRequestError, 400],
48
+ "InvalidSubitemIdException" => [InvalidRequestError, 400],
48
49
  "InvalidBoardIdException" => [InvalidRequestError, 400],
50
+ "InvalidGroupIdException" => [InvalidRequestError, 400],
49
51
  "InvalidArgumentException" => [InvalidRequestError, 400],
50
52
  "CreateBoardException" => [InvalidRequestError, 400],
51
53
  "ItemsLimitationException" => [InvalidRequestError, 400],
@@ -71,16 +73,14 @@ module Monday
71
73
  end
72
74
 
73
75
  def formatted_args_value(value)
74
- return "\"#{value}\"" unless single_word?(value)
75
76
  return value.to_json.to_json if value.is_a?(Hash)
77
+ return value if integer?(value)
76
78
 
77
- value
79
+ "\"#{value}\""
78
80
  end
79
81
 
80
- def single_word?(word)
81
- return word unless word.is_a?(String)
82
-
83
- !word.strip.include?(" ")
82
+ def integer?(value)
83
+ value.is_a?(Integer)
84
84
  end
85
85
  end
86
86
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Monday
4
- VERSION = "0.4.0"
4
+ VERSION = "0.6.1"
5
5
  end
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: 0.4.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sanif Himani
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-09-18 00:00:00.000000000 Z
12
+ date: 2024-03-24 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Gem to easily interact with monday.com API using native Ruby
15
15
  email:
@@ -22,6 +22,7 @@ files:
22
22
  - ".env"
23
23
  - ".rspec"
24
24
  - ".rubocop.yml"
25
+ - ".simplecov"
25
26
  - ".vscode/settings.json"
26
27
  - CHANGELOG.md
27
28
  - CODE_OF_CONDUCT.md
@@ -78,7 +79,10 @@ files:
78
79
  - lib/monday/resources/board.rb
79
80
  - lib/monday/resources/board_view.rb
80
81
  - lib/monday/resources/column.rb
82
+ - lib/monday/resources/group.rb
81
83
  - lib/monday/resources/item.rb
84
+ - lib/monday/resources/subitem.rb
85
+ - lib/monday/resources/update.rb
82
86
  - lib/monday/resources/workspace.rb
83
87
  - lib/monday/response.rb
84
88
  - lib/monday/util.rb
@@ -91,7 +95,7 @@ licenses:
91
95
  metadata:
92
96
  homepage_uri: https://github.com/sanifhimani/monday_ruby
93
97
  documentation_uri: https://monday-ruby.gitbook.io/docs/
94
- changelog_uri: https://github.com/sanifhimani/monday_ruby/blob/v0.4.0/CHANGELOG.md
98
+ changelog_uri: https://github.com/sanifhimani/monday_ruby/blob/v0.6.1/CHANGELOG.md
95
99
  rubygems_mfa_required: 'true'
96
100
  post_install_message:
97
101
  rdoc_options: []
@@ -108,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
112
  - !ruby/object:Gem::Version
109
113
  version: '0'
110
114
  requirements: []
111
- rubygems_version: 3.4.19
115
+ rubygems_version: 3.5.6
112
116
  signing_key:
113
117
  specification_version: 4
114
118
  summary: Ruby bindings to use the monday.com API