Class: Octopi::Blob

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

Constant Summary

Constant Summary

Constants inherited from Base

Octopi::Base::VALID

Instance Attribute Summary collapse

Attributes inherited from Base

#api

Class Method Summary collapse

Methods included from Resource

for, included

Methods inherited from Base

#error=, #initialize, #property, #save

Constructor Details

This class inherits a constructor from Octopi::Base

Instance Attribute Details

#dataObject

Returns the value of attribute data



4
5
6
# File 'lib/octopi/blob.rb', line 4

def data
  @data
end

#mime_typeObject

Returns the value of attribute mime_type



4
5
6
# File 'lib/octopi/blob.rb', line 4

def mime_type
  @mime_type
end

#modeObject

Returns the value of attribute mode



4
5
6
# File 'lib/octopi/blob.rb', line 4

def mode
  @mode
end

#nameObject

Returns the value of attribute name



4
5
6
# File 'lib/octopi/blob.rb', line 4

def name
  @name
end

#shaObject

Returns the value of attribute sha



4
5
6
# File 'lib/octopi/blob.rb', line 4

def sha
  @sha
end

#sizeObject

Returns the value of attribute size



4
5
6
# File 'lib/octopi/blob.rb', line 4

def size
  @size
end

#textObject

Returns the value of attribute text



4
5
6
# File 'lib/octopi/blob.rb', line 4

def text
  @text
end

Class Method Details

.find(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/octopi/blob.rb', line 10

def self.find(options={})
  ensure_hash(options)
  user, repo = gather_details(options)
  sha = options[:sha]
  path = options[:path]
  
  self.validate_args(sha => :sha, user => :user)
  
  if path
    super [user, repo, sha, path]
  else
    Api.api.get_raw(path_for(:resource), {:id => [user, repo, sha].join('/')})
  end  
end