Class: GitWand::GitHub::Resource::File

Inherits:
Object
  • Object
show all
Defined in:
lib/git_wand/github/resource/file.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#contentObject

Returns the value of attribute content.



7
8
9
# File 'lib/git_wand/github/resource/file.rb', line 7

def content
  @content
end

#html_urlObject

Returns the value of attribute html_url.



7
8
9
# File 'lib/git_wand/github/resource/file.rb', line 7

def html_url
  @html_url
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/git_wand/github/resource/file.rb', line 7

def name
  @name
end

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/git_wand/github/resource/file.rb', line 7

def path
  @path
end

#shaObject

Returns the value of attribute sha.



7
8
9
# File 'lib/git_wand/github/resource/file.rb', line 7

def sha
  @sha
end

#sizeObject

Returns the value of attribute size.



7
8
9
# File 'lib/git_wand/github/resource/file.rb', line 7

def size
  @size
end

Class Method Details

.build_from_api_result(result) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/git_wand/github/resource/file.rb', line 9

def self.build_from_api_result(result)
  return unless result.success?
  resource = new
  resource.name = result.body["name"]
  resource.path = result.body["path"]
  resource.sha = result.body["sha"]
  resource.size = result.body["size"]
  resource.html_url = result.body["html_url"]
  resource.content = Base64::decode64(result.body["content"])
  resource
end