Class: Ghee::API::Orgs::Proxy

Inherits:
ResourceProxy show all
Includes:
CUD
Defined in:
lib/ghee/api/orgs.rb,
lib/ghee/api/members.rb

Overview

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

Instance Attribute Summary

Attributes inherited from ResourceProxy

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

Instance Method Summary collapse

Methods included from CUD

#create, #destroy, #patch

Methods inherited from ResourceProxy

accept_header, #all, #all_parallel, #build_prefix, #initialize, #method_missing, #paginate, #raw, #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

#members(id = nil, &block) ⇒ Object



5
6
7
8
# File 'lib/ghee/api/members.rb', line 5

def members(id=nil, &block)
  prefix = build_prefix id, "members"
  Ghee::API::Orgs::Members::Proxy.new connection, prefix, id, &block
end

#memberships(user, &block) ⇒ Object

User Membership for an org

Returns json



91
92
93
94
# File 'lib/ghee/api/orgs.rb', line 91

def memberships(user, &block)
  prefix = "#{path_prefix}/memberships/#{user}"
  Ghee::API::Orgs::Memberships::MembershipsProxy.new(connection, prefix, nil, &block)
end

#public_members(id = nil, &block) ⇒ Object



9
10
11
12
# File 'lib/ghee/api/members.rb', line 9

def public_members(id=nil, &block)
  prefix = build_prefix id, "public_members"
  Ghee::API::Orgs::PublicMembers::Proxy.new connection, prefix, id, &block
end

#repos(name = nil, &block) ⇒ Object

Repos for a orgs

Returns json



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

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

#teams(number = nil, &block) ⇒ Object

Teams for an org

Returns json



71
72
73
74
# File 'lib/ghee/api/orgs.rb', line 71

def teams(number=nil, &block)
  prefix = (!number.is_a?(Hash) and number) ? "./teams/#{number}" : "#{path_prefix}/teams"
  Ghee::API::Orgs::Teams::Proxy.new(connection, prefix, number, &block)
end