Module: Admins

Included in:
DashboardAPI
Defined in:
lib/admins.rb

Overview

Admins section of the Meraki Dashboard API

Author:

  • Joe Letizia

Instance Method Summary collapse

Instance Method Details

#add_admin(org_id, options) ⇒ Object

Add an admin to a specific org

Parameters:

  • org_id (String)

    organization ID you want to add an administrator to

  • options (Hash)

    option hash containing attributes for the new admin. Can contain: email, name, orgAccess, tags and networks. See the Meraki API Documentation for more details.



15
16
17
18
# File 'lib/admins.rb', line 15

def add_admin(org_id, options)
#  
  self.make_api_call("/organizations/#{org_id}/admins", 'POST', options)
end

#list_admins(org_id) ⇒ Array

List all of the administrators for a given org

Parameters:

  • org_id (String)

    organization ID you want the list of administrators for

Returns:

  • (Array)

    an array of hashes containing each admin and their attributes



7
8
9
# File 'lib/admins.rb', line 7

def list_admins(org_id)
  self.make_api_call("/organizations/#{org_id}/admins", 'GET')
end

#revoke_admin(org_id, admin_id) ⇒ Integer

Revoke an administrator for a specific org

Parameters:

  • org_id (String)

    organization ID you want to revoke access on

  • admin_id (String)

    ID of the administrator you want to revoke

Returns:

  • (Integer)

    HTTP Code



34
35
36
# File 'lib/admins.rb', line 34

def revoke_admin(org_id, admin_id)
  self.make_api_call("/organizations/#{org_id}/admins/#{admin_id}", 'DELETE')
end

#update_admin(org_id, admin_id, options) ⇒ Object

Update an administrator for a specific org

Parameters:

  • org_id (String)

    organization ID you want to update an administrator on

  • admin_id (String)

    ID of the admin you want to update

  • options (Hash)

    hash containing the attributes and values you want to update. Can contain: email, name, orgAccess, tags and networks. See the Meraki API Documentation for more details.



25
26
27
28
# File 'lib/admins.rb', line 25

def update_admin(org_id, admin_id, options)
#    
  self.make_api_call("/organizations/#{org_id}/admins/#{admin_id}", 'PUT', options)
end