Class: VSTS::Shelveset
Overview
Shelveset model
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#created_date ⇒ Object
Returns the value of attribute created_date.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.find(id, opts = {}) ⇒ Shelveset?
Find specific shelveset by id See https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/shelvesets#get-a-shelveset.
- .find_all(params = {}) ⇒ array of Shelveset
-
.find_by_name(name, owner, opts = {}) ⇒ Shelveset?
Find specific shelveset by name and owner See https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/shelvesets#get-a-shelveset.
Instance Method Summary collapse
-
#changes(opts = {}) ⇒ array of Change
Get changes in the shelveset See https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/shelvesets#get-shelveset-changes.
-
#initialize(h = {}) ⇒ Shelveset
constructor
Create new shelveset instance from a hash.
Methods inherited from BaseModel
Constructor Details
#initialize(h = {}) ⇒ Shelveset
Create new shelveset instance from a hash
10 11 12 13 14 15 16 17 18 |
# File 'lib/vsts/shelveset.rb', line 10 def initialize(h = {}) @id = h["id"] @name = h["name"] @url = h["url"] @owner = Identity.new(h["owner"]) @created_date = DateTime.rfc3339(h["createdDate"]) @comment = h["comment"] @_changes = nil end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
5 6 7 |
# File 'lib/vsts/shelveset.rb', line 5 def comment @comment end |
#created_date ⇒ Object
Returns the value of attribute created_date.
5 6 7 |
# File 'lib/vsts/shelveset.rb', line 5 def created_date @created_date end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/vsts/shelveset.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/vsts/shelveset.rb', line 5 def name @name end |
#owner ⇒ Object
Returns the value of attribute owner.
5 6 7 |
# File 'lib/vsts/shelveset.rb', line 5 def owner @owner end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/vsts/shelveset.rb', line 5 def url @url end |
Class Method Details
.find(id, opts = {}) ⇒ Shelveset?
Find specific shelveset by id See https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/shelvesets#get-a-shelveset
78 79 80 81 82 |
# File 'lib/vsts/shelveset.rb', line 78 def self.find(id, opts = {}) urlparams = APIClient.build_params(opts, [:includeDetails, :includeWorkItems, :maxCommentLength, :maxChangeCount]) resp = APIClient.get("/shelvesets/#{id}", area: "tfvc", urlparams: urlparams) Shelveset.new(resp.parsed) end |
.find_all(params = {}) ⇒ array of Shelveset
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vsts/shelveset.rb', line 37 def self.find_all(params = {}) urlparams = APIClient.build_params( params, [ :owner, :maxCommentLength, ["$", :top], ["$", :skip] ] ) resp = APIClient.get("/shelvesets", area: "tfvc", urlparams: urlparams) resp.parsed["value"].map { |o| Shelveset.new(o) } end |
.find_by_name(name, owner, opts = {}) ⇒ Shelveset?
Find specific shelveset by name and owner See https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/shelvesets#get-a-shelveset
62 63 64 65 66 |
# File 'lib/vsts/shelveset.rb', line 62 def self.find_by_name(name, owner, opts = {}) urlparams = APIClient.build_params(opts, [:includeDetails, :includeWorkItems, :maxCommentLength, :maxChangeCount]) resp = APIClient.get("/shelvesets/#{name};#{owner}", area: "tfvc", urlparams: urlparams) Shelveset.new(resp.parsed) end |
Instance Method Details
#changes(opts = {}) ⇒ array of Change
Get changes in the shelveset See https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/shelvesets#get-shelveset-changes
25 26 27 28 29 30 |
# File 'lib/vsts/shelveset.rb', line 25 def changes(opts = {}) return @_changes if @_changes.instance_of?(Array) urlparams = APIClient.build_params(opts, [["$", :top], ["$", :skip]]) resp = APIClient.get("/shelvesets/#{id}/changes", area: "tfvc", urlparams: urlparams) @_changes = resp.parsed["changes"].map { |o| Change.new(o) } end |