Skip to content

Commit

Permalink
add a request to delete a collection item
Browse files Browse the repository at this point in the history
  • Loading branch information
bourda_c committed May 22, 2024
1 parent 28afa9d commit 4b25e9a
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
## [Unreleased]

- Add new request: list items linked to a collection.
- Add new request: Create a job from its workflow.
- Add new request: Create a job from it's workflow.
- Add new request: Update a collection's item.
- Add new request: Update a job's cell.
- Add new request: Delete a collection's item.

## [0.4.0] - 2023-09-12

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module KazeClient

# @author [email protected]
# Delete a collection item
# @see KazeClient::Request
# @see KazeClient::Utils::FinalRequest
# @see KazeClient::Utils::AuthentifiedRequest
# @since 0.4.1
class DeleteCollectionItemRequest < Utils::FinalRequest

include Utils::AuthentifiedRequest

# @param collection_id [String]
# @param item_id [String]
def initialize(collection_id, item_id)
super(:delete, "api/collections/#{collection_id}/items/#{item_id}")
end

end

end
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ module KazeClient
# @see KazeClient::Request
# @see KazeClient::Utils::FinalRequest
# @see KazeClient::Utils::AuthentifiedRequest
# @since 0.3.2
# @since 0.4.1
class UpdateCollectionItemRequest < Utils::FinalRequest

include Utils::AuthentifiedRequest

# @param collection_id [String]
# @param item_id [String]
# @param payload [Hash]
def initialize(collection_id, item_id, payload)
super(:put, "api/collections/#{collection_id}/items/#{item_id}")
Expand Down
39 changes: 39 additions & 0 deletions lib/kaze_client/request/requests/jobs/update_job_cell_request.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

module KazeClient

# @author [email protected]
# Update a given job cell.
# @see KazeClient::Request
# @see KazeClient::Utils::FinalRequest
# @see KazeClient::Utils::AuthentifiedRequest
# @since 0.1.0
class UpdateJobCell < Utils::FinalRequest

include Utils::AuthentifiedRequest

# @return [String] The id of the target job.
attr_reader :job_id

# @return [String] The id of the target cell.
attr_reader :cell_id

# @return [Hash] The workflow used to update the cell.
attr_reader :cell_data

def initialize(job_id, cell_id, cell_data, skip_version_check: false)
super(:put, "api/jobs/#{job_id}/cells/#{cell_id}")

@body = {
data: {
cell_id => {
data: cell_data
}
},
skip_version_check: skip_version_check ? 1 : 0
}
end

end

end
2 changes: 2 additions & 0 deletions lib/kaze_client/requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
require_relative 'request/requests/jobs/cancel_job_request'
require_relative 'request/requests/jobs/add_tag_request'
require_relative 'request/requests/jobs/complete_step_request'
require_relative 'request/requests/jobs/update_job_cell_request'

# => Collections
require_relative 'request/requests/collections/collection_request'
Expand All @@ -36,6 +37,7 @@
require_relative 'request/requests/collections/items/create_collection_item_request'
require_relative 'request/requests/collections/items/update_collection_item_request'
require_relative 'request/requests/collections/items/linked_collections_request'
require_relative 'request/requests/collections/items/delete_collection_item_request'

# => Tags
require_relative 'request/requests/tags/tag_request'
Expand Down

0 comments on commit 4b25e9a

Please sign in to comment.