diff --git a/lib/tracker_api/client.rb b/lib/tracker_api/client.rb index 5302f4b..54e82fd 100644 --- a/lib/tracker_api/client.rb +++ b/lib/tracker_api/client.rb @@ -128,6 +128,14 @@ def project(id, params={}) Endpoints::Project.new(self).get(id, params) end + # Create a new workspace. + # + # @param [Hash] params attributes to create the workspace with + # @return [TrackerApi::Resources::Workspace] newly created Workspace + def create_workspace(params) + Endpoints::Workspace.new(self).create(params) + end + # Get workspace # # @param [Hash] params diff --git a/lib/tracker_api/endpoints/workspace.rb b/lib/tracker_api/endpoints/workspace.rb index 45931d8..7457b7f 100644 --- a/lib/tracker_api/endpoints/workspace.rb +++ b/lib/tracker_api/endpoints/workspace.rb @@ -12,6 +12,12 @@ def get(id, params={}) Resources::Workspace.new({ client: client }.merge(data)) end + + def create(params={}) + data = client.post("/my/workspaces", params: params).body + + Resources::Workspace.new({ client: client }.merge(data)) + end end end end