Skip to content

Commit

Permalink
Add method to publicize/unpublicize a users's membership
Browse files Browse the repository at this point in the history
  • Loading branch information
mizzy committed May 16, 2012
1 parent 7dae7b0 commit 33f8027
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/octokit/client/organizations.rb
Expand Up @@ -88,6 +88,15 @@ def remove_team_repository(team_id, repo, options={})
delete("teams/#{team_id}/repos/#{Repository.new(repo)}", options, 3, true, raw=true).status == 204
end
alias :remove_team_repo :remove_team_repository

def publicize_membership(org, user, options={})
put("orgs/#{org}/public_members/#{user}", options, 3, true, raw=true).status == 204
end

def unpublicize_membership(org, user, options={})
delete("orgs/#{org}/public_members/#{user}", options, 3, true, raw=true).status == 204
end

end
end
end
24 changes: 24 additions & 0 deletions spec/octokit/client/organizations_spec.rb
Expand Up @@ -220,4 +220,28 @@

end

describe ".publicize_membership" do

it "should pulicize membership" do
stub_put("https://api.github.com/orgs/codeforamerica/public_members/sferik").
with(:name => "sferik").
to_return(:status => 204)
result = @client.publicize_membership("codeforamerica", "sferik")
result.should be_true
end

end

describe ".unpublicize_membership" do

it "should unpulicize membership" do
stub_delete("https://api.github.com/orgs/codeforamerica/public_members/sferik").
with(:name => "sferik").
to_return(:status => 204)
result = @client.unpublicize_membership("codeforamerica", "sferik")
result.should be_true
end

end

end

0 comments on commit 33f8027

Please sign in to comment.