Class: Ghee::API::Repos::Git::Proxy

Inherits:
ResourceProxy show all
Defined in:
lib/ghee/api/git_data.rb

Instance Attribute Summary

Attributes inherited from ResourceProxy

#connection, #current_page, #pagination, #params, #path_prefix, #total

Instance Method Summary collapse

Methods inherited from ResourceProxy

#all, #initialize, #method_missing, #paginate, #subject

Constructor Details

This class inherits a constructor from Ghee::ResourceProxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ghee::ResourceProxy

Instance Method Details

#blobs(sha = nil, params = {}) ⇒ Object

Get the blob by a provided sha



69
70
71
72
73
# File 'lib/ghee/api/git_data.rb', line 69

def blobs(sha=nil, params={})
  params = sha if sha.is_a?Hash
  prefix = (!sha.is_a?(Hash) and sha) ? "#{path_prefix}/blobs/#{sha}" : "#{path_prefix}/blobs"
  Ghee::API::Repos::Git::Blobs::Proxy.new(connection, prefix, params)
end

#commits(sha = nil, params = {}) ⇒ Object

Get a commit by the sha



77
78
79
80
81
# File 'lib/ghee/api/git_data.rb', line 77

def commits(sha=nil, params={})
  params = sha if sha.is_a?Hash
  prefix = (!sha.is_a?(Hash) and sha) ? "#{path_prefix}/commits/#{sha}" : "#{path_prefix}/commits"
  Ghee::API::Repos::Git::Commits::Proxy.new(connection, prefix, params)
end

#refs(ref = nil) ⇒ Object

Get refs for the repo



85
86
87
88
# File 'lib/ghee/api/git_data.rb', line 85

def refs(ref=nil)
   prefix = ref ? "#{path_prefix}/refs/#{ref}" : "#{path_prefix}/refs"
  Ghee::API::Repos::Git::Refs::Proxy.new(connection, prefix)
end

#tags(sha = nil) ⇒ Object

Get a tag by a given sha



99
100
101
102
# File 'lib/ghee/api/git_data.rb', line 99

def tags(sha=nil)
  prefix = sha ? "#{path_prefix}/tags/#{sha}" : "#{path_prefix}/tags"
  Ghee::API::Repos::Git::Tags::Proxy.new(connection, prefix)
end

#trees(sha = nil) ⇒ Object

Get tree by a given sha



92
93
94
95
# File 'lib/ghee/api/git_data.rb', line 92

def trees(sha=nil)
  prefix = sha ? "#{path_prefix}/trees/#{sha}" : "#{path_prefix}/trees"
  Ghee::API::Repos::Git::Trees::Proxy.new(connection, prefix)
end