Class: VSTS::Changeset
Overview
Changeset model
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#checked_in_by ⇒ Object
Returns the value of attribute checked_in_by.
-
#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.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.find(id, opts = {}) ⇒ Changeset?
Find specific changeset by id See https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/changesets#get-a-changeset.
- .find_all(search_criteria = {}) ⇒ array of Changeset
Instance Method Summary collapse
-
#changes(opts = {}) ⇒ array of Change
Get changes in the changeset See https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/changesets#get-list-of-changes-in-a-changeset.
-
#initialize(h = {}) ⇒ Changeset
constructor
Create new changeset instance from a hash.
Methods inherited from BaseModel
Constructor Details
#initialize(h = {}) ⇒ Changeset
Create new changeset instance from a hash
10 11 12 13 14 15 16 17 18 |
# File 'lib/vsts/changeset.rb', line 10 def initialize(h = {}) @id = h["changesetId"] @url = h["url"] @author = Identity.new(h["author"]) @checked_in_by = Identity.new(h["checkedInBy"]) @created_date = DateTime.rfc3339(h["createdDate"]) @comment = h["comment"] @_changes = nil end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
5 6 7 |
# File 'lib/vsts/changeset.rb', line 5 def @author end |
#checked_in_by ⇒ Object
Returns the value of attribute checked_in_by.
5 6 7 |
# File 'lib/vsts/changeset.rb', line 5 def checked_in_by @checked_in_by end |
#comment ⇒ Object
Returns the value of attribute comment.
5 6 7 |
# File 'lib/vsts/changeset.rb', line 5 def comment @comment end |
#created_date ⇒ Object
Returns the value of attribute created_date.
5 6 7 |
# File 'lib/vsts/changeset.rb', line 5 def created_date @created_date end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/vsts/changeset.rb', line 5 def id @id end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/vsts/changeset.rb', line 5 def url @url end |
Class Method Details
.find(id, opts = {}) ⇒ Changeset?
Find specific changeset by id See https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/changesets#get-a-changeset
70 71 72 73 74 |
# File 'lib/vsts/changeset.rb', line 70 def self.find(id, opts = {}) urlparams = APIClient.build_params(opts, [:includeDetails, :includeWorkItems, :maxCommentLength, :maxChangeCount]) resp = APIClient.get("/changesets/#{id}", area: "tfvc", urlparams: urlparams) Changeset.new(resp.parsed) end |
.find_all(search_criteria = {}) ⇒ array of Changeset
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/vsts/changeset.rb', line 37 def self.find_all(search_criteria = {}) urlparams = APIClient.build_params( search_criteria, [ ["searchCriteria.", :itemPath], ["searchCriteria.", :version], ["searchCriteria.", :versionType], ["searchCriteria.", :versionOption], ["searchCriteria.", :author], ["searchCriteria.", :fromId], ["searchCriteria.", :toId], ["searchCriteria.", :fromDate], ["searchCriteria.", :toDate], ["$", :top], ["$", :skip], ["$", :orderBy], :maxCommentLength ] ) resp = APIClient.get("/changesets", area: "tfvc", urlparams: urlparams) resp.parsed["value"].map { |o| Changeset.new(o) } end |
Instance Method Details
#changes(opts = {}) ⇒ array of Change
Get changes in the changeset See https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/changesets#get-list-of-changes-in-a-changeset
25 26 27 28 29 30 |
# File 'lib/vsts/changeset.rb', line 25 def changes(opts = {}) return @_changes if @_changes.instance_of?(Array) urlparams = APIClient.build_params(opts, [["$", :top], ["$", :skip]]) resp = APIClient.get("/changesets/#{id}/changes", area: "tfvc", urlparams: urlparams) @_changes = resp.parsed["value"].map { |o| Change.new(o) } end |