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, #id, #pagination, #params, #path_prefix, #total

Instance Method Summary collapse

Methods inherited from ResourceProxy

accept_header, #all, #all_parallel, #build_prefix, #initialize, #method_missing, #paginate, #raw, #subject

Methods included from CUD

#create, #destroy, #patch

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



64
65
66
67
68
# File 'lib/ghee/api/git_data.rb', line 64

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



72
73
74
75
76
# File 'lib/ghee/api/git_data.rb', line 72

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



80
81
82
83
# File 'lib/ghee/api/git_data.rb', line 80

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



94
95
96
97
# File 'lib/ghee/api/git_data.rb', line 94

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, params = {}) ⇒ Object

Get tree by a given sha



87
88
89
90
# File 'lib/ghee/api/git_data.rb', line 87

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