Class: Octopi::Blob

Inherits:
Base
  • Object
show all
Includes:
Resource
Defined in:
lib/octopi/blob.rb

Constant Summary

Constants inherited from Base

Octopi::Base::VALID

Instance Attribute Summary

Attributes inherited from Base

#api

Class Method Summary collapse

Methods included from Resource

for, included

Methods inherited from Base

#initialize, #property, #save

Constructor Details

This class inherits a constructor from Octopi::Base

Class Method Details

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



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/octopi/blob.rb', line 8

def self.find(user, repo, sha, path=nil)
  user = user. if user.is_a? User
  repo = repo.name if repo.is_a? Repository
  self.class.validate_args(sha => :sha, user => :user, path => :file)
  if path
    super [user,repo,sha,path]
  else
    blob = ANONYMOUS_API.get_raw(path_for(:resource), 
          {:id => [user,repo,sha].join('/')})
    new(ANONYMOUS_API, {:text => blob})
  end  
end