ghee 0.13.19 → 0.14.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d2b5546ab688edb5fe7e4fa5bebb079366e45e7
4
- data.tar.gz: 6b38d8e4cf6d37e26c65ec9a4233e885c1776cd6
3
+ metadata.gz: e9f984ef8aaf8331cc633f4946e03729c95ae496
4
+ data.tar.gz: 5d679b923655a9477c26c6cfd2ed9ad1b9e61602
5
5
  SHA512:
6
- metadata.gz: 47b84b662152d68b76dde9f920fa51a5e1ecc7a449b179159af8e6a0f7d7eb812b61a2c2bc791f20ec4b082fbd50ed83d50ccb9692dc3a0d5b46636f56718e3d
7
- data.tar.gz: 423b4281d1235820c6a46c8c1443b87b566519e7cf927f6ca016a16c53c6c243751c4e2b8481aa696849056d171589273d5bc59bdc96d74cd0d63558949c8036
6
+ metadata.gz: 693c4ca4df4b189086ded6128a92ca523113de196f310f3736b2a311eb1d43f206c2072052142f9cfd92d668893165a6c0106515fbe45164d5b3508069ec3590
7
+ data.tar.gz: 2bd3e7a25674956b62b8209ac19973ca1a5c30e388bb48fd97fd5265f9899592343d0449fc20cf5aa24353fd097b3405ec5900c4a1e1a4f03b1640f331a48a8d
@@ -0,0 +1,44 @@
1
+ class Ghee
2
+ module API
3
+ module Orgs
4
+ class Proxy < ::Ghee::ResourceProxy
5
+ def members(id=nil, &block)
6
+ prefix = build_prefix id, "members"
7
+ Ghee::API::Orgs::Members::Proxy.new connection, prefix, id, &block
8
+ end
9
+ def public_members(id=nil, &block)
10
+ prefix = build_prefix id, "public_members"
11
+ Ghee::API::Orgs::PublicMembers::Proxy.new connection, prefix, id, &block
12
+ end
13
+ end
14
+ module PublicMembers
15
+ class Proxy < ::Ghee::ResourceProxy
16
+ def check?(username=nil)
17
+ prefix = username ? File.join(path_prefix, username) : path_prefix
18
+ connection.get(prefix).status == 204
19
+ end
20
+
21
+ def add(username=nil)
22
+ prefix = username ? File.join(path_prefix, username) : path_prefix
23
+ connection.put(prefix).status == 204
24
+ end
25
+ alias_method :publicize, :add
26
+
27
+ def remove(username=nil)
28
+ prefix = username ? File.join(path_prefix, username) : path_prefix
29
+ connection.delete(prefix).status == 204
30
+ end
31
+ alias_method :conceal, :remove
32
+ end
33
+ end
34
+ module Members
35
+ class Proxy < ::Ghee::ResourceProxy
36
+ def check?(username=nil)
37
+ prefix = username ? File.join(path_prefix, username) : path_prefix
38
+ connection.get(prefix).status == 204
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
data/lib/ghee/api/orgs.rb CHANGED
@@ -37,6 +37,10 @@ class Ghee
37
37
  def remove(member)
38
38
  connection.delete("#{path_prefix}/#{member}").status == 204
39
39
  end
40
+ def check?(username=nil)
41
+ prefix = username ? File.join(path_prefix, username) : path_prefix
42
+ connection.get(prefix).status == 204
43
+ end
40
44
  end
41
45
  end
42
46
 
data/lib/ghee/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  class Ghee
3
- VERSION = "0.13.19"
3
+ VERSION = "0.14.19"
4
4
  end
data/lib/ghee.rb CHANGED
@@ -28,6 +28,7 @@ require 'ghee/api/followers'
28
28
  require 'ghee/api/pulls'
29
29
  require 'ghee/api/search'
30
30
  require 'ghee/api/contents'
31
+ require 'ghee/api/members'
31
32
 
32
33
  class Ghee
33
34
  attr_reader :connection
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+ require 'pry'
3
+
4
+ describe Ghee::API::Orgs::Members do
5
+ subject { Ghee.new(GH_AUTH) }
6
+
7
+ def should_be_a_member(member)
8
+ member.has_key?('login').should == true
9
+ end
10
+
11
+
12
+ describe 'orgs(org)#members' do
13
+ it 'return a list of members' do
14
+ VCR.use_cassette("orgs(#{GH_ORG})members") do
15
+ members = subject.orgs(GH_ORG).members
16
+ should_be_a_member(members.first)
17
+ end
18
+ end
19
+ it 'checks a username for membership' do
20
+ VCR.use_cassette "orgs(#{GH_ORG})member.check?" do
21
+ subject.orgs(GH_ORG).members(GH_USER).check?.should == true
22
+ subject.orgs(GH_ORG).members.check?(GH_USER).should == true
23
+ end
24
+ end
25
+ end
26
+
27
+ describe 'orgs(org)#public_members' do
28
+ it 'return a list of public_members' do
29
+ VCR.use_cassette("orgs(#{GH_ORG})public_members") do
30
+ public_members = subject.orgs(GH_ORG).public_members
31
+ should_be_a_member(public_members.first)
32
+ end
33
+ end
34
+ it 'checks a username for public_membership' do
35
+ VCR.use_cassette "orgs(#{GH_ORG})public_member.check?" do
36
+ subject.orgs(GH_ORG).public_members(GH_USER).check?.should == true
37
+ subject.orgs(GH_ORG).public_members.check?(GH_USER).should == true
38
+ end
39
+ end
40
+ end
41
+ end
@@ -49,6 +49,7 @@ describe Ghee::API::Orgs::Teams do
49
49
  members = subject.orgs.teams(member_team["id"]).members
50
50
  members.first["login"].should == GH_USER
51
51
  members.size.should > 0
52
+ subject.orgs.teams(member_team["id"]).members.check?(GH_USER).should be_true
52
53
  end
53
54
  end
54
55
  it "should remove a member" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.19
4
+ version: 0.14.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Rauh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-15 00:00:00.000000000 Z
12
+ date: 2015-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -257,6 +257,7 @@ files:
257
257
  - lib/ghee/api/issues.rb
258
258
  - lib/ghee/api/keys.rb
259
259
  - lib/ghee/api/labels.rb
260
+ - lib/ghee/api/members.rb
260
261
  - lib/ghee/api/milestones.rb
261
262
  - lib/ghee/api/orgs.rb
262
263
  - lib/ghee/api/pulls.rb
@@ -281,6 +282,7 @@ files:
281
282
  - spec/ghee/api/hooks_spec.rb
282
283
  - spec/ghee/api/issues_spec.rb
283
284
  - spec/ghee/api/milestones_spec.rb
285
+ - spec/ghee/api/org_members_spec.rb
284
286
  - spec/ghee/api/orgs_spec.rb
285
287
  - spec/ghee/api/repos_spec.rb
286
288
  - spec/ghee/api/search_spec.rb
@@ -329,6 +331,7 @@ test_files:
329
331
  - spec/ghee/api/hooks_spec.rb
330
332
  - spec/ghee/api/issues_spec.rb
331
333
  - spec/ghee/api/milestones_spec.rb
334
+ - spec/ghee/api/org_members_spec.rb
332
335
  - spec/ghee/api/orgs_spec.rb
333
336
  - spec/ghee/api/repos_spec.rb
334
337
  - spec/ghee/api/search_spec.rb