Module: Keybase::Local::Team
- Defined in:
- lib/keybase/local/team.rb
Overview
Represents an interface to Keybase's teams.
Constant Summary collapse
- TEAM_EXEC_ARGS =
The initial arguments to pass when executing Keybase for team management.
%w[keybase team].freeze
- TEAM_PATTERN =
The pattern used to (partially) validate team names.
/([a-zA-Z0-9][a-zA-Z0-9_]?)+/
Class Method Summary collapse
-
.accept_invite(_token) ⇒ Object
private
Accept an email invitation to join a Keybase team.
-
.add_member(_team, _user, _role: :reader, _email: false) ⇒ Object
private
Add a user to a Keybase team.
-
.create(_team) ⇒ Object
private
Create a new Keybase team.
-
.delete(_team) ⇒ Object
private
Delete a Keybase team.
-
.edit_member(_team, _user, _role: :reader) ⇒ Object
private
Modify a user in a Keybase team.
-
.ignore_request(_team, _user) ⇒ Object
private
Ignore a request to join a Keybase team.
-
.leave(_team, _permanent: false) ⇒ Object
private
Leave a Keybase team.
-
.list_members(team, force_poll: false) ⇒ Hash
List all members of the given team.
-
.list_memberships(force_poll: false) ⇒ Hash
List all teams currently belonged to.
-
.list_requests ⇒ Object
private
List requests to join Keybase teams.
-
.remove_member(_team, _user) ⇒ Object
private
Remove a user from a Keybase team.
-
.rename(_old_team, _new_team) ⇒ Object
private
Change the name of a Keybase team.
-
.request_access(_team) ⇒ Object
private
Request access to a Keybase team.
-
.team_call(*args, payload: nil, json: false) ⇒ Hash, ...
private
The parsed JSON, or a true/false/nil result indicating command success.
Class Method Details
.accept_invite(_token) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
Accept an email invitation to join a Keybase team.
121 122 123 |
# File 'lib/keybase/local/team.rb', line 121 def accept_invite(_token) # stub end |
.add_member(_team, _user, _role: :reader, _email: false) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
Add a user to a Keybase team.
52 53 54 |
# File 'lib/keybase/local/team.rb', line 52 def add_member(_team, _user, _role: :reader, _email: false) # stub end |
.create(_team) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
Create a new Keybase team.
45 46 47 |
# File 'lib/keybase/local/team.rb', line 45 def create(_team) # stub end |
.delete(_team) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
Delete a Keybase team.
135 136 137 |
# File 'lib/keybase/local/team.rb', line 135 def delete(_team) # stub end |
.edit_member(_team, _user, _role: :reader) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
Modify a user in a Keybase team.
66 67 68 |
# File 'lib/keybase/local/team.rb', line 66 def edit_member(_team, _user, _role: :reader) # stub end |
.ignore_request(_team, _user) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
Ignore a request to join a Keybase team.
114 115 116 |
# File 'lib/keybase/local/team.rb', line 114 def ignore_request(_team, _user) # stub end |
.leave(_team, _permanent: false) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
Leave a Keybase team.
128 129 130 |
# File 'lib/keybase/local/team.rb', line 128 def leave(_team, _permanent: false) # stub end |
.list_members(team, force_poll: false) ⇒ Hash
List all members of the given team.
83 84 85 86 87 88 |
# File 'lib/keybase/local/team.rb', line 83 def list_members(team, force_poll: false) args = %W[list-members #{team} --json] args << "--force-poll" if force_poll team_call(*args, json: true) end |
.list_memberships(force_poll: false) ⇒ Hash
List all teams currently belonged to.
73 74 75 76 77 78 |
# File 'lib/keybase/local/team.rb', line 73 def list_memberships(force_poll: false) args = %w[list-memberships --json] args << "--force-poll" if force_poll team_call(*args, json: true) end |
.list_requests ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
List requests to join Keybase teams.
107 108 109 |
# File 'lib/keybase/local/team.rb', line 107 def list_requests # stub end |
.remove_member(_team, _user) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
Remove a user from a Keybase team.
59 60 61 |
# File 'lib/keybase/local/team.rb', line 59 def remove_member(_team, _user) # stub end |
.rename(_old_team, _new_team) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
Change the name of a Keybase team.
93 94 95 |
# File 'lib/keybase/local/team.rb', line 93 def rename(_old_team, _new_team) # stub end |
.request_access(_team) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is a stub.
Request access to a Keybase team.
100 101 102 |
# File 'lib/keybase/local/team.rb', line 100 def request_access(_team) # stub end |
.team_call(*args, payload: nil, json: false) ⇒ Hash, ...
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the parsed JSON, or a true/false/nil result indicating command success.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/keybase/local/team.rb', line 24 def team_call(*args, payload: nil, json: false) if json response = Open3.popen3(*TEAM_EXEC_ARGS, *args) do |stdin, stdout, _, _| stdin.write payload if payload stdin.close # close after writing to let keybase know we're done stdout.read end if response.empty? {} else JSON.parse response end else system(*TEAM_EXEC_ARGS, *args) end end |