Sha256: 31516591f309b1ca6f2972bda37030da57d227f2355cf19d7a2fd4d85658799d
Contents?: true
Size: 1.24 KB
Versions: 5
Compression:
Stored size: 1.24 KB
Contents
module TeamcityRuby class Project extend TeamcityRuby::Resource attr_reader :teamcity_id, :name, :parent_id url_path '/projects' resource_name 'project' def self.create(name, options = {}) payload = { "name" => name } payload["parentProject"] = { "id" => options[:parent_id] } if options[:parent_id] if options[:source_id] payload["sourceProject"] = { "id" => options[:source_id] } payload["copyAllAssociatedSettings"] = 'true' end response = client.post("/projects", :body => payload.to_json) new(response) end def initialize(options = {}) @teamcity_id = options["id"] @name = options["name"] @parent_id = options["parentProjectId"] end def destroy! client.delete("/projects/id:#{teamcity_id}") end def description=(value) headers = { "Accept" => "text/plain", "Content-Type" => "text/plain" } client.put("/projects/id:#{teamcity_id}/description", :body => value, :headers => headers) end def description headers = { "Accept" => "text/plain", "Content-Type" => "text/plain" } client.get("/projects/id:#{teamcity_id}/description", :headers => headers, :format => :text).parsed_response end end end
Version data entries
5 entries across 5 versions & 1 rubygems