Class: Fuselage::Blob
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#sha ⇒ Object
Returns the value of attribute sha.
Attributes inherited from Base
Class Method Summary collapse
-
.create(repo, content) ⇒ Object
Create a blob.
-
.find(repo, sha, user = nil) ⇒ Object
Find a blob.
Methods inherited from Base
delete_method, get, #initialize, post
Constructor Details
This class inherits a constructor from Fuselage::Base
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/fuselage/blob.rb', line 4 def content @content end |
#encoding ⇒ Object
Returns the value of attribute encoding.
4 5 6 |
# File 'lib/fuselage/blob.rb', line 4 def encoding @encoding end |
#sha ⇒ Object
Returns the value of attribute sha.
4 5 6 |
# File 'lib/fuselage/blob.rb', line 4 def sha @sha end |
Class Method Details
.create(repo, content) ⇒ Object
Create a blob
Content must be in utf-8 encoding. TODO: Add suport for base-64.
examples:
Blob.create('cockpit', 'Some really cool data.')
23 24 25 26 27 28 |
# File 'lib/fuselage/blob.rb', line 23 def self.create(repo, content) raise AuthenticationRequired unless Api.authenticated params = {:content => content, :encoding => 'utf-8'} user = User.current.login Blob.new(post("/repos/#{user}/#{repo}/git/blobs", params)) end |
.find(repo, sha, user = nil) ⇒ Object
Find a blob
examples:
Blob.find('cockpit', '45f6d8e74e145b910be4e15f67ef3892fe7abb26')
10 11 12 13 14 |
# File 'lib/fuselage/blob.rb', line 10 def self.find(repo, sha, user=nil) raise AuthenticationRequired unless Api.authenticated user ||= User.current.login Blob.new(get("/repos/#{user}/#{repo}/git/blobs/#{sha}").merge(:sha => sha)) end |