Class: Ghee::API::Users::Proxy

Inherits:
ResourceProxy show all
Includes:
CUD
Defined in:
lib/ghee/api/users.rb

Overview

Users::Proxy inherits from Ghee::Proxy and enables defining methods on the proxy object

Instance Attribute Summary

Attributes inherited from ResourceProxy

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

Instance Method Summary collapse

Methods included from CUD

#create, #destroy, #patch

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

#gists(params = {}) ⇒ Object

Gists for a user

Returns json



23
24
25
# File 'lib/ghee/api/users.rb', line 23

def gists(params={})
  Ghee::API::Gists::Proxy.new(connection,"#{path_prefix}/gists",params)
end

#orgs(org = nil, params = {}) ⇒ Object

Returns list of the provided users organizations or an organization by name

org - String name of the organization (optional)

Returns json



44
45
46
47
48
# File 'lib/ghee/api/users.rb', line 44

def orgs(org=nil, params={})
  params = org if org.is_a?Hash
  prefix = org.is_a?(String) ? "/orgs/#{org}" : "#{path_prefix}/orgs"
  Ghee::API::Orgs::Proxy.new(connection, prefix, params)
end

#repos(name = nil, params = {}) ⇒ Object

Repos for a user

Returns json



31
32
33
34
35
# File 'lib/ghee/api/users.rb', line 31

def repos(name=nil, params={})
  params = name if name.is_a?Hash
  prefix = name.is_a?(String) ? "/repos/#{self["login"]}/#{name}" : "#{path_prefix}/repos" 
  Ghee::API::Repos::Proxy.new(connection,prefix, params)
end