Class: Pushover::Teams
- Inherits:
-
Object
- Object
- Pushover::Teams
- Defined in:
- lib/pushover/teams.rb
Overview
Teams provides operations for the Pushover for Teams API.
Constant Summary collapse
- TEXT_FIELDS =
%i[name password group].freeze
- FLAGS =
%i[instant admin].freeze
Instance Method Summary collapse
-
#add_user(email:, **fields) ⇒ Response
Add a user or send an invitation to the team.
-
#get ⇒ Response
Retrieve the team and its users and devices.
-
#initialize(client) ⇒ Teams
constructor
A new instance of Teams.
-
#remove_user(email:) ⇒ Response
Remove a user from the team and its delivery groups.
-
#revoke_invitation(email:) ⇒ Response
Revoke a pending team invitation.
Constructor Details
#initialize(client) ⇒ Teams
Returns a new instance of Teams.
7 8 9 |
# File 'lib/pushover/teams.rb', line 7 def initialize(client) @client = client end |
Instance Method Details
#add_user(email:, **fields) ⇒ Response
Add a user or send an invitation to the team.
23 24 25 26 27 28 29 30 |
# File 'lib/pushover/teams.rb', line 23 def add_user(email:, **fields) validate_email!(email) validate_add_user_fields!(fields) body = { 'email' => email }.merge(fields.slice(*TEXT_FIELDS).compact.transform_keys(&:to_s)) add_flags!(body, **fields.slice(*FLAGS)) post_action('add_user', body) end |
#get ⇒ Response
Retrieve the team and its users and devices.
13 14 15 16 17 18 19 |
# File 'lib/pushover/teams.rb', line 13 def get response = @client.connection.get( path: '/1/teams.json', query: { token: @client.token } ) Response.create_from_excon_response(response) end |
#remove_user(email:) ⇒ Response
Remove a user from the team and its delivery groups.
40 41 42 |
# File 'lib/pushover/teams.rb', line 40 def remove_user(email:) post_email_action('remove_user', email) end |
#revoke_invitation(email:) ⇒ Response
Revoke a pending team invitation.
34 35 36 |
# File 'lib/pushover/teams.rb', line 34 def revoke_invitation(email:) post_email_action('revoke_invitation', email) end |