Class: VSTS::Change

Inherits:
BaseModel show all
Defined in:
lib/vsts/change.rb

Overview

Change model

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#underscore

Constructor Details

#initialize(h = {}) ⇒ Change

Parameters:

  • h (Hash) (defaults to: {})

    change data as returned by the VSTS API



11
12
13
14
# File 'lib/vsts/change.rb', line 11

def initialize(h = {})
  @change_type = h["changeType"]
  @item = Item.new(h["item"])
end

Instance Attribute Details

#change_typeObject

Returns the value of attribute change_type.



5
6
7
# File 'lib/vsts/change.rb', line 5

def change_type
  @change_type
end

#itemObject

Returns the value of attribute item.



5
6
7
# File 'lib/vsts/change.rb', line 5

def item
  @item
end

Instance Method Details

#get(opts = nil) ⇒ String

Convenience method to directly download a change item (file)

Parameters:

  • opts (Hash) (defaults to: nil)

    options, see VSTS::Item#get

Returns:

  • (String)

    the downloaded file contents



35
36
37
38
39
40
41
# File 'lib/vsts/change.rb', line 35

def get(opts = nil)
  if opts.nil?
    @item.get
  else
    @item.get(opts)
  end
end

#pathObject

Convenience method to directly access item path



22
23
24
# File 'lib/vsts/change.rb', line 22

def path
  @item.path
end

#urlObject

Convenience method to directly access item url



27
28
29
# File 'lib/vsts/change.rb', line 27

def url
  @item.url
end

#versionObject

Convenience method to directly access item version



17
18
19
# File 'lib/vsts/change.rb', line 17

def version
  @item.version
end