Class: GitDataTags

Inherits:
Object
  • Object
show all
Defined in:
lib/github/gitdata/gitdata_tags.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github) ⇒ GitDataTags

Returns a new instance of GitDataTags.



4
5
6
# File 'lib/github/gitdata/gitdata_tags.rb', line 4

def initialize(github)
  @github = github
end

Instance Attribute Details

#githubObject

Returns the value of attribute github.



2
3
4
# File 'lib/github/gitdata/gitdata_tags.rb', line 2

def github
  @github
end

Instance Method Details

#createTagObject(repo, tag, message, object, type, taggerName, taggerEmail, taggerDate, user = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/github/gitdata/gitdata_tags.rb', line 14

def createTagObject(repo, tag, message, object, type, taggerName,
    taggerEmail, taggerDate, user=nil)
  username = user == nil ? @github.username : user
  tagger = {
      :name => taggerName,
      :email => taggerEmail,
      :date => taggerDate
  }
  params = {
      :tag => tag,
      :message => message,
      :object => object,
      :type => type,
      :tagger => tagger
  }
  data = params.to_json
  url = 'repos/%s/%s/git/tags' % [user, repo]
  @github.post(url % [username, repo], data)
end

#getTag(repo, sha, user = nil) ⇒ Object



8
9
10
11
12
# File 'lib/github/gitdata/gitdata_tags.rb', line 8

def getTag(repo, sha, user=nil)
  username = user == nil ? @github.username : user
  @github.get(
      'repos/%s/%s/git/tags/%s' % [username, repo, sha])
end