Class: Fuselage::Tag

Inherits:
Base
  • Object
show all
Defined in:
lib/fuselage/tag.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#api

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

delete_method, get, #initialize, post

Constructor Details

This class inherits a constructor from Fuselage::Base

Instance Attribute Details

#messageObject

Returns the value of attribute message.



3
4
5
# File 'lib/fuselage/tag.rb', line 3

def message
  @message
end

#objectObject

Returns the value of attribute object.



3
4
5
# File 'lib/fuselage/tag.rb', line 3

def object
  @object
end

#shaObject

Returns the value of attribute sha.



3
4
5
# File 'lib/fuselage/tag.rb', line 3

def sha
  @sha
end

#tagObject

Returns the value of attribute tag.



3
4
5
# File 'lib/fuselage/tag.rb', line 3

def tag
  @tag
end

#taggerObject

Returns the value of attribute tagger.



3
4
5
# File 'lib/fuselage/tag.rb', line 3

def tagger
  @tagger
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/fuselage/tag.rb', line 3

def url
  @url
end

Class Method Details

.create(repo, tag, message, object, options = {}) ⇒ Object

Create a tag

Options:

:type,    values: 'commit', 'tree', and 'blob'. default is commit
:tagger
   :name
   :date
   :email

 examples:
   Tag.create('cockpit', v1.0', 'New tag', '45f6d8e74e145b910be4e15f67ef3892fe7abb26')

   Commit.create('cockpit', v1.0', 'New tag', '45f6d8e74e145b910be4e15f67ef3892fe7abb26', {
     :tagger => {:name => 'Corey', :email => '[email protected]'}
   })


31
32
33
34
35
36
37
# File 'lib/fuselage/tag.rb', line 31

def self.create(repo, tag, message, object, options={})
  raise AuthenticationRequired unless Api.authenticated
  options = {:type => 'commit'}.merge(options)
  params = {:tag => tag, :message => message, :object => object}.merge(options)
  user = User.current.
  Tag.new(post("/repos/#{user}/#{repo}/git/blobs", params))
end

.find(repo, sha, user = nil) ⇒ Object

Find a tag

examples:
  Tag.find('cockpit', '45f6d8e74e145b910be4e15f67ef3892fe7abb26')


9
10
11
12
13
# File 'lib/fuselage/tag.rb', line 9

def self.find(repo, sha, user=nil)
  raise AuthenticationRequired unless Api.authenticated
  user ||= User.current.
  Tag.new(get("/repos/#{user}/#{repo}/git/tags/#{sha}"))
end

Instance Method Details

#to_sObject



39
40
41
# File 'lib/fuselage/tag.rb', line 39

def to_s
  tag
end