camper 0.0.11 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dbee68b43218a497b29c8006b70cb344d0925c879f5220aef14228e12cd6dce
4
- data.tar.gz: fc3f58b2d04d11912e6fd497c86eba3039dae579c645eb8a5a5493d9076283d0
3
+ metadata.gz: a55ed04d219593d0ed46a16a84c1993eab9b51d1cbc6b55386bd23068f002668
4
+ data.tar.gz: 1bf654df624233c32289b132ee58dabe05158088f4fc970a8b2ebdf7ddfae229
5
5
  SHA512:
6
- metadata.gz: 00fabce0dc901476883b26af2e71b8b68fab3859577172e3a4456d20b099ffed533961917388e3eba39fa334f8b9097b73804a15a97264bc9cc6ebd8911b26a1
7
- data.tar.gz: b360150b837d8d0d89e794f7145c711a7ef86f88267d9b17d6829b1988ef425f8c82f53b4c0037f74c6a63f655689c93438da9c7f618e5c02c004bffbea27f16
6
+ metadata.gz: 1a56723911f5687789ae0078d62dd2ffc3ce5df0af7edd844ec2a4942098f26dcec1931a21d9731983af62134d331e6958526d910df68a1959e5794e3fd9a292
7
+ data.tar.gz: c076b430f753ab8b2021b64e7811b05bfb9e7669a842638df47a7fd2ab6a0536c54ccdc449bbdf81b2a3be86950c3554e11866e45dbd8f2dd612fe18d499f2d5
@@ -15,6 +15,9 @@ Layout/LineLength:
15
15
  - 'lib/camper/client/*'
16
16
  - 'spec/**/*'
17
17
 
18
+ Layout/FirstHashElementIndentation:
19
+ EnforcedStyle: consistent
20
+
18
21
  Metrics/BlockLength:
19
22
  Exclude:
20
23
  - 'spec/**/*'
@@ -25,6 +28,12 @@ Metrics/AbcSize:
25
28
  Style/Documentation:
26
29
  Enabled: false
27
30
 
31
+ Style/AsciiComments:
32
+ Enabled: false
33
+
34
+ Style/ParallelAssignment:
35
+ Enabled: false
36
+
28
37
  Style/ClassAndModuleChildren:
29
38
  Exclude:
30
39
  - 'lib/camper/*'
@@ -4,6 +4,20 @@
4
4
 
5
5
  **Implemented enhancements:**
6
6
 
7
+ - Complete messages and message types APIs [\#66](https://github.com/renehernandez/camper/pull/66)
8
+ - Complete comments api [\#65](https://github.com/renehernandez/camper/pull/65)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Refactor check for valid basecamp url [\#67](https://github.com/renehernandez/camper/pull/67)
13
+ - Bump rspec from 3.9.0 to 3.10.0 [\#64](https://github.com/renehernandez/camper/pull/64)
14
+ - Rewrite API modules to use module nesting [\#63](https://github.com/renehernandez/camper/pull/63)
15
+ - Bump rubocop from 1.0.0 to 1.1.0 [\#48](https://github.com/renehernandez/camper/pull/48)
16
+
17
+ ## [v0.0.11](https://github.com/renehernandez/camper/tree/v0.0.11) (2020-11-01)
18
+
19
+ **Implemented enhancements:**
20
+
7
21
  - Implement trash\_todo endpoint [\#58](https://github.com/renehernandez/camper/issues/58)
8
22
  - Implement trash\_todolist endpoint [\#57](https://github.com/renehernandez/camper/issues/57)
9
23
  - To-do API is missing update\_todo endpoint [\#49](https://github.com/renehernandez/camper/issues/49)
@@ -20,6 +34,10 @@
20
34
  - Update endpoints documentation to use PaginatedResponse [\#59](https://github.com/renehernandez/camper/pull/59)
21
35
  - Fix query string generation in get endpoints [\#55](https://github.com/renehernandez/camper/pull/55)
22
36
 
37
+ **Documentation:**
38
+
39
+ - update\_todolist needs to call out that description will be cleared if not specified [\#50](https://github.com/renehernandez/camper/issues/50)
40
+
23
41
  ## [v0.0.10](https://github.com/renehernandez/camper/tree/v0.0.10) (2020-10-30)
24
42
 
25
43
  **Implemented enhancements:**
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- camper (0.0.10)
4
+ camper (0.0.11)
5
5
  concurrent-ruby (~> 1.1)
6
6
  httparty (~> 0.18)
7
7
  rack-oauth2 (~> 1.14)
@@ -21,7 +21,7 @@ GEM
21
21
  bindata (2.4.8)
22
22
  coderay (1.1.3)
23
23
  concurrent-ruby (1.1.7)
24
- diff-lcs (1.3)
24
+ diff-lcs (1.4.4)
25
25
  httparty (0.18.1)
26
26
  mime-types (~> 3.0)
27
27
  multi_xml (>= 0.5.2)
@@ -55,29 +55,29 @@ GEM
55
55
  rake (13.0.1)
56
56
  regexp_parser (1.8.2)
57
57
  rexml (3.2.4)
58
- rspec (3.9.0)
59
- rspec-core (~> 3.9.0)
60
- rspec-expectations (~> 3.9.0)
61
- rspec-mocks (~> 3.9.0)
62
- rspec-core (3.9.2)
63
- rspec-support (~> 3.9.3)
64
- rspec-expectations (3.9.2)
58
+ rspec (3.10.0)
59
+ rspec-core (~> 3.10.0)
60
+ rspec-expectations (~> 3.10.0)
61
+ rspec-mocks (~> 3.10.0)
62
+ rspec-core (3.10.0)
63
+ rspec-support (~> 3.10.0)
64
+ rspec-expectations (3.10.0)
65
65
  diff-lcs (>= 1.2.0, < 2.0)
66
- rspec-support (~> 3.9.0)
67
- rspec-mocks (3.9.1)
66
+ rspec-support (~> 3.10.0)
67
+ rspec-mocks (3.10.0)
68
68
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.9.0)
70
- rspec-support (3.9.3)
71
- rubocop (1.0.0)
69
+ rspec-support (~> 3.10.0)
70
+ rspec-support (3.10.0)
71
+ rubocop (1.1.0)
72
72
  parallel (~> 1.10)
73
73
  parser (>= 2.7.1.5)
74
74
  rainbow (>= 2.2.2, < 4.0)
75
75
  regexp_parser (>= 1.8)
76
76
  rexml
77
- rubocop-ast (>= 0.6.0)
77
+ rubocop-ast (>= 1.0.1)
78
78
  ruby-progressbar (~> 1.7)
79
79
  unicode-display_width (>= 1.4.0, < 2.0)
80
- rubocop-ast (1.0.0)
80
+ rubocop-ast (1.1.0)
81
81
  parser (>= 2.7.1.5)
82
82
  rubocop-performance (1.8.1)
83
83
  rubocop (>= 0.87.0)
data/README.md CHANGED
@@ -30,11 +30,13 @@ The up-to-date list of Basecamp API endpoints can be found at [here](https://git
30
30
 
31
31
  Currently, Camper supports the following endpoints:
32
32
 
33
- * [Comments](https://github.com/basecamp/bc3-api/blob/master/sections/comments.md): Implementation at [comments.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/comments.rb) (Partial)
34
- * [Messages](https://github.com/basecamp/bc3-api/blob/master/sections/messages.md): Implementation at [messages.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/messages.rb) (Partial)
33
+ * [Comments](https://github.com/basecamp/bc3-api/blob/master/sections/comments.md): Implementation at [comments.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/comments.rb) (Complete)
34
+ * [Message Types](https://github.com/basecamp/bc3-api/blob/master/sections/message_types.md): Implementation at [messages.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/message_types.rb) (Complete)
35
+ * [Message Boards](https://github.com/basecamp/bc3-api/blob/master/sections/message_boards.md): Implementation at [message_boards.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/message_boards.rb) (Complete)
36
+ * [Messages](https://github.com/basecamp/bc3-api/blob/master/sections/messages.md): Implementation at [messages.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/messages.rb) (Complete)
35
37
  * [People](https://github.com/basecamp/bc3-api/blob/master/sections/people.md): Implementation at [people.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/people.rb) (Complete)
36
38
  * [Projects](https://github.com/basecamp/bc3-api/blob/master/sections/projects.md): Implementation at [projects.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/projects.rb) (Complete)
37
- * [Recordings](https://github.com/basecamp/bc3-api/blob/master/sections/recordings.md): Implementation at [recordings.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/recordings.rb)
39
+ * [Recordings](https://github.com/basecamp/bc3-api/blob/master/sections/recordings.md): Implementation at [recordings.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/recordings.rb) (Complete)
38
40
  * [To-do list](https://github.com/basecamp/bc3-api/blob/master/sections/todolists.md): Implementation at [todolists.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/todolists.rb) (Complete)
39
41
  * [To-dos](https://github.com/basecamp/bc3-api/blob/master/sections/todos.md): Implementation at [todos.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/todos.rb) (Complete)
40
42
 
@@ -25,11 +25,22 @@ projects.auto_paginate do |p|
25
25
  # Adds a comment on the first todolist
26
26
  list = client.todolists(todoset).first
27
27
  puts "Todolist: #{list.title}, can be commented on: #{list.can_be_commented?}"
28
- client.create_comment(list, 'New <b>comment</b> with <i>HTML support</i>')
28
+
29
+ puts 'Create a new comment'
30
+ new_comment = client.create_comment(list, 'New temporary comment')
29
31
  comments = client.comments(list)
30
32
  idx = 0
31
33
  comments.auto_paginate do |c|
32
34
  puts "Comment #{idx} content: #{c.content}"
33
35
  idx += 1
34
36
  end
37
+
38
+ puts 'Get single comment'
39
+ single_comment = client.comment(list, new_comment.id)
40
+
41
+ puts 'Update comment'
42
+ client.update_comment(single_comment, 'New content')
43
+
44
+ puts 'Delete comment'
45
+ client.trash_comment(single_comment)
35
46
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'camper'
4
+
5
+ client = Camper.client
6
+
7
+ project = client.projects.first
8
+
9
+ puts 'List all messages types'
10
+ client.message_types(project).auto_paginate do |type|
11
+ puts "Name: #{type.name}; Icon: #{type.icon}"
12
+ end
13
+
14
+ puts 'Create new message type'
15
+ type = client.create_message_type(project, 'Farewell', '👋')
16
+ puts "Message Type:\n#{type.inspect}"
17
+
18
+ puts 'Update message type name'
19
+ type = client.update_message_type(project, type, name: 'Bye bye')
20
+ puts "Message Type:\n#{type.inspect}"
21
+
22
+ puts 'Update message type icon'
23
+ type = client.update_message_type(project, type, icon: '🙌')
24
+ puts "Message Type:\n#{type.inspect}"
25
+
26
+ puts 'Delete message type'
27
+ client.delete_message_type(project, type)
28
+
29
+
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'camper'
2
4
 
3
5
  client = Camper.configure do |config|
@@ -16,9 +18,18 @@ projects.auto_paginate do |p|
16
18
  message_board = client.message_board(p)
17
19
  puts "Message Board: #{message_board.title}"
18
20
 
21
+ puts 'List messages using the message board'
19
22
  messages = client.messages(message_board)
20
23
 
21
24
  messages.auto_paginate do |msg|
22
- puts msg.inspect
25
+ puts "Title: #{msg.title}; Content: #{msg.content}"
26
+ end
27
+
28
+ puts 'List messages using the project'
29
+ messages = client.messages(p)
30
+
31
+ messages.auto_paginate do |msg|
32
+ puts "Title: #{msg.title}; Content: #{msg.content}"
33
+ puts "Message:\n#{msg.inspect}"
23
34
  end
24
- end
35
+ end
@@ -1,15 +1,87 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Camper::Client
4
- module CommentsAPI
5
- def create_comment(resource, content)
6
- raise Error::ResourceCannotBeCommented, resource unless resource.can_be_commented?
3
+ module Camper
4
+ class Client
5
+ # Defines methods related to comments.
6
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/comments.md
7
+ module CommentsAPI
8
+ # Get a paginated list of active comments for a given resource
9
+ #
10
+ # @example
11
+ # client.comments(todo)
12
+ #
13
+ # @param resource [Resource] resource to gets the comments from
14
+ # @return [PaginatedResponse<Resource>]
15
+ # @raise [Error::ResourceCannotBeCommented] if the resource doesn't support comments
16
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/comments.md#get-comments
17
+ def comments(resource)
18
+ raise Error::ResourceCannotBeCommented, resource unless resource.can_be_commented?
7
19
 
8
- post(resource.comments_url, override_path: true, body: { content: content })
9
- end
20
+ get(resource.comments_url, override_path: true)
21
+ end
22
+
23
+ # Get a comment within a resource
24
+ #
25
+ # @example
26
+ # client.comment(todo, 10)
27
+ # @example
28
+ # client.comment(my_message, '23')
29
+ #
30
+ # @param resource [Resource] resource to get the comment from
31
+ # @param comment_id [Integer|String] id of comment ot retrieve
32
+ # @return [Resource]
33
+ # @raise [Error::ResourceCannotBeCommented] if the resource doesn't support comments
34
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/comments.md#get-a-comment
35
+ def comment(resource, comment_id)
36
+ raise Error::ResourceCannotBeCommented, resource unless resource.can_be_commented?
37
+
38
+ bucket_id = resource.bucket.id
39
+
40
+ get("/buckets/#{bucket_id}/comments/#{comment_id}")
41
+ end
42
+
43
+ # Create a new comment for a given resource
44
+ #
45
+ # @example
46
+ # client.create_comment(my_message, 'We are ready to start the project')
47
+ #
48
+ # @param resource [Resource] resource to create the comment on
49
+ # @param content [String] content of the comment
50
+ # @return [Resource]
51
+ # @raise [Error::ResourceCannotBeCommented] if the resource doesn't support comments
52
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/comments.md#create-a-comment
53
+ def create_comment(resource, content)
54
+ raise Error::ResourceCannotBeCommented, resource unless resource.can_be_commented?
55
+
56
+ post(resource.comments_url, override_path: true, body: { content: content })
57
+ end
58
+
59
+ # Update the content in a comment
60
+ #
61
+ # @example
62
+ # client.update_comment(comment, 'Fixed grammar mistakes')
63
+ #
64
+ # @param comment [Resource] comment to modify
65
+ # @param content [String] new content of the comment
66
+ # @return [Resource]
67
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/comments.md#update-a-comment
68
+ def update_comment(comment, content)
69
+ bucket_id = comment.bucket.id
70
+
71
+ put("/buckets/#{bucket_id}/comments/#{comment.id}", body: { content: content })
72
+ end
10
73
 
11
- def comments(resource)
12
- get(resource.comments_url, override_path: true)
74
+ # Trash a comment
75
+ # it calls the trash_recording endpoint under the hood
76
+ #
77
+ # @example
78
+ # client.trash_comment(current_comment)
79
+ #
80
+ # @param comment [Resource] the comment to be trashed
81
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/recordings.md#trash-a-recording
82
+ def trash_comment(comment)
83
+ trash_recording(comment)
84
+ end
13
85
  end
14
86
  end
15
87
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Camper
4
+ class Client
5
+ # Defines methods related to message boards.
6
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/message_boards.md
7
+ module MessageBoardsAPI
8
+ # Get a message board for a given project
9
+ #
10
+ # @example
11
+ # client.message_board(project)
12
+ #
13
+ # @param project [Project] project to get the associated message board on
14
+ # @return [Resource]
15
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/message_boards.md#message-boards
16
+ def message_board(project)
17
+ board = project.message_board
18
+
19
+ get(board.url, override_path: true)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Camper
4
+ class Client
5
+ # Defines methods related to message types.
6
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/message_types.md
7
+ module MessageTypesAPI
8
+ # Get a paginated list of all messages types in a given project
9
+ #
10
+ # @example
11
+ # client.messages_types(my_project)
12
+ #
13
+ # @param project [Project] project to get the messages types from
14
+ # @return [PaginatedResponse<Resource>]
15
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/message_types.md#get-message-types
16
+ def message_types(project)
17
+ get("/buckets/#{project.id}/categories")
18
+ end
19
+
20
+ # Get a messages type in a given project
21
+ #
22
+ # @example
23
+ # client.message_type(my_project, '10')
24
+ # @example
25
+ # client.message_type(my_project, 64926)
26
+ #
27
+ # @param project [Project] project to get the messages type from
28
+ # @param message_type_id [Integer|String] id of the message type to retrieve
29
+ # @return [Resource]
30
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/message_types.md#get-a-message-type
31
+ def message_type(project, message_type_id)
32
+ get("/buckets/#{project.id}/categories/#{message_type_id}")
33
+ end
34
+
35
+ # Create a messages type in a given project
36
+ #
37
+ # @example
38
+ # client.create_message_type(my_project, 'Farewell', '👋')
39
+ #
40
+ # @param project [Project] project where the message type belongs to
41
+ # @param name [String] name of the new message type
42
+ # @param icon [String] icon to associate with the new message type
43
+ # @return [Resource]
44
+ # @raise [Error::InvalidParameter] if either name or icon is blank
45
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/message_types.md#create-a-message-type
46
+ def create_message_type(project, name, icon)
47
+ raise Error::InvalidParameter, 'Name and icon parameters cannot be blank' if name.blank? || icon.blank?
48
+
49
+ post("/buckets/#{project.id}/categories", body: { name: name, icon: icon })
50
+ end
51
+
52
+ # Update a message type in a given project
53
+ #
54
+ # @example
55
+ # client.update_message_type(my_project, type, name: 'Quick Update')
56
+ # @example
57
+ # client.update_message_type(my_project, type, icon: '🤙')
58
+ #
59
+ # @param project [Project] project where the message type belongs to
60
+ # @param type [Resource|Integer|String] resource or id representing a message type
61
+ # @param options [Hash] hash containing the name and/or icon to modify
62
+ # @return [Resource]
63
+ # @raise [Error::InvalidParameter] if options parameter is empty
64
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/message_types.md#destroy-a-message-type
65
+ def update_message_type(project, type, options = {})
66
+ raise Error::InvalidParameter, 'options cannot be empty' if options.empty?
67
+
68
+ type_id = type.respond_to?(:id) ? type.id : type
69
+
70
+ put("/buckets/#{project.id}/categories/#{type_id}", body: options)
71
+ end
72
+
73
+ # Delete a message type in a given project
74
+ #
75
+ # @example
76
+ # client.delete_message_type(my_project, type)
77
+ #
78
+ # @param project [Project] project where the message type belongs to
79
+ # @param type [Resource|Integer|String] resource or id representing a message type
80
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/message_types.md#destroy-a-message-type
81
+ def delete_message_type(project, type)
82
+ type_id = type.respond_to?(:id) ? type.id : type
83
+
84
+ delete("/buckets/#{project.id}/categories/#{type_id}")
85
+ end
86
+
87
+ alias trash_message_type delete_message_type
88
+ end
89
+ end
90
+ end
@@ -1,9 +1,108 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Camper::Client
4
- module MessagesAPI
5
- def messages(message_board)
6
- get(message_board.messages_url, override_path: true)
3
+ module Camper
4
+ class Client
5
+ # Defines methods related to messages.
6
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/messages.md
7
+ module MessagesAPI
8
+ # Get a paginated list of active messages under the given message board or project
9
+ #
10
+ # @example
11
+ # client.messages(message_board)
12
+ # @example
13
+ # client.messages(my_project)
14
+ #
15
+ # @param parent [Project|Resource] either a project or message board resource
16
+ # @return [PaginatedResponse<Resource>]
17
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/messages.md#get-messages
18
+ def messages(parent)
19
+ if parent.is_a?(Project)
20
+ bucket_id, board_id = parent.id, parent.message_board.id
21
+ else
22
+ bucket_id, board_id = parent.bucket.id, parent.id
23
+ end
24
+
25
+ get("/buckets/#{bucket_id}/message_boards/#{board_id}/messages")
26
+ end
27
+
28
+ # Get a paginated list of active messages under the given message board or project
29
+ #
30
+ # @example
31
+ # client.message(my_project, '2343')
32
+ # @example
33
+ # client.message(message_board, 234)
34
+ #
35
+ # @param parent [Project|Resource] either a project or message board resource
36
+ # @param message_id [Integer|String] id of the message to retrieve
37
+ # @return [Resource]
38
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/messages.md#get-a-message
39
+ def message(parent, message_id)
40
+ bucket_id = parent.is_a?(Project) ? parent.id : parent.bucket.id
41
+
42
+ get("/buckets/#{bucket_id}/messages/#{message_id}")
43
+ end
44
+
45
+ # Create a message
46
+ #
47
+ # @example
48
+ # client.create_message(my_project, 'New Infrastructure')
49
+ # @example
50
+ # client.create_message(message_board, 'New Launch',
51
+ # content: 'This launch will be awesome',
52
+ # category_id: '23'
53
+ # )
54
+ #
55
+ # @param parent [Project|Resource] either a project or message board resource
56
+ # @param subject [String] subject of the new message
57
+ # @param options [Hash] hash containing the content and/or category id for the new message
58
+ # @return [Resource]
59
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/messages.md#create-a-message
60
+ def create_message(parent, subject, options = {})
61
+ if parent.is_a?(Project)
62
+ bucket_id, board_id = parent.id, parent.message_board.id
63
+ else
64
+ bucket_id, board_id = parent.bucket.id, parent.id
65
+ end
66
+
67
+ post(
68
+ "/buckets/#{bucket_id}/message_boards/#{board_id}/messages",
69
+ body: options.merge({ subject: subject, status: 'active' })
70
+ )
71
+ end
72
+
73
+ # Update a message
74
+ #
75
+ # @example
76
+ # client.update_message(message, subject: 'New Infrastructure')
77
+ # @example
78
+ # client.update_message(message, content: 'This launch will be awesome')
79
+ # @example
80
+ # client.update_message(message, category_id: '6918641') # message type id
81
+ #
82
+ # @param message [Resource] message to update
83
+ # @param options [Hash] subject of the new message
84
+ # @param options [Hash] hash containing subject, content and/or category_id to update
85
+ # @return [Resource]
86
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/messages.md#update-a-message
87
+ def update_message(message, options = {})
88
+ raise Error::InvalidParameter, 'options cannot be empty' if options.empty?
89
+
90
+ update("/buckets/#{message.bucket.id}/messages/#{message.id}", body: options)
91
+ end
92
+
93
+ # Trash message
94
+ # it calls the trash_recording endpoint under the hood
95
+ #
96
+ # @example
97
+ # client.trash_message(message)
98
+ #
99
+ # @param todo [Resource] the message to be trashed
100
+ # @raise [Error::InvalidParameter] if url field in todo param
101
+ # is not a valid basecamp url
102
+ # @see https://github.com/basecamp/bc3-api/blob/master/sections/recordings.md#trash-a-recording
103
+ def trash_message(message)
104
+ trash_recording(message)
105
+ end
7
106
  end
8
107
  end
9
108
  end