Class: GitDataBlobs

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github) ⇒ GitDataBlobs

Returns a new instance of GitDataBlobs.



4
5
6
# File 'lib/github/gitdata/gitdata_blobs.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_blobs.rb', line 2

def github
  @github
end

Instance Method Details

#createBlob(repo, content, encoding, user = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/github/gitdata/gitdata_blobs.rb', line 14

def createBlob(repo, content, encoding, user=nil)
  username = user == nil ? @github.username : user
  params = {
      :content => content,
      :encoding => encoding
  }
  data = params.to_json
  @github.post('repos/%s/%s/git/blobs' % [username, repo],
               data)
end

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



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

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