Module: Organizations

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

Overview

Organization section of the Meraki Dashboard API

Author:

  • Joe Letizia

Instance Method Summary collapse

Instance Method Details

#claim(org_id, options) ⇒ Integer

Claim something

Parameters:

  • org_id (String)

    the organization that you want to claim to

  • options (Hash)

    a hash containing information about what you want to claim. This can be order, serial, licenseKey and licenseMode. Refer to the official Dashboard API documentation for more information about these

Returns:

  • (Integer)

    HTTP Code



105
106
107
108
109
# File 'lib/organizations.rb', line 105

def claim(org_id, options)
  raise 'Options were not passed as a Hash' if !options.is_a?(Hash)

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

#clone_organization(source_org_id, options) ⇒ Hash

Clone an organization

Parameters:

  • source_org_id (String)

    the source organization that we want to clone from

  • options (Hash)

    options hash containing the attributes for the new organization

Returns:

  • (Hash)

    the attributes of the newly cloned organization



93
94
95
96
97
# File 'lib/organizations.rb', line 93

def clone_organization(source_org_id, options)
  raise 'Options were not passed as a Hash' if !options.is_a?(Hash)

  self.make_api_call("/organizations/#{source_org_id}/clone", 'POST', options)
end

#create_organization(options) ⇒ Hash

Create a new organization

Parameters:

  • options (Hash)

    an options hash containing the name of the new organization

Returns:

  • (Hash)

    the attributes of the newly created organization



83
84
85
86
87
# File 'lib/organizations.rb', line 83

def create_organization(options)
  raise 'Options were not passed as a Hash' if !options.is_a?(Hash)

  self.make_api_call("/organizations", 'POST', options)
end

#get_inventory(org_id) ⇒ Array

Returns the current inventory for an organization

Parameters:

  • org_id (String)

    dashboard organization ID

Returns:

  • (Array)

    an array of hashes containg information on each individual device



21
22
23
# File 'lib/organizations.rb', line 21

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

#get_license_state(org_id) ⇒ Hash

Returns the current license state for a given organization

Parameters:

  • org_id (String)

    dashboard organization ID

Returns:

  • (Hash)

    results contains the current license state information



14
15
16
# File 'lib/organizations.rb', line 14

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

#get_organization(org_id) ⇒ Hash

Returns information about an organization

Parameters:

  • org_id (String)

    dashboard organization ID

Returns:

  • (Hash)

    results contains the org id and name of the given organization



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

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

#get_snmp_settings(org_id) ⇒ Hash

Returns the current SNMP status for an organization

Parameters:

  • org_id (String)

    dashboard organization ID

Returns:

  • (Hash)

    a hash containing all SNMP configuration information for an organization



28
29
30
# File 'lib/organizations.rb', line 28

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

#get_third_party_peers(org_id) ⇒ Array

Returns the configurations for an organizations 3rd party VPN peers

Parameters:

  • org_id (String)

    dashboard organization ID

Returns:

  • (Array)

    an arrry of hashes containing the configuration information for each 3rd party VPN peer



49
50
51
# File 'lib/organizations.rb', line 49

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

#list_all_organizationsArray

Returns all organizations a user is an administrator on

Returns:

  • (Array)

    an array of hashes containing the organizations and their attributes



66
67
68
# File 'lib/organizations.rb', line 66

def list_all_organizations
  self.make_api_call("/organizations", 'GET')
end

#update_organization(org_id, options) ⇒ Hash

Update an organization

Parameters:

  • org_id (String)

    the organization ID that you want to update

  • options (Hash)

    an options hash containing the org ID and new name of the org

Returns:

  • (Hash)

    the updated attributes of the organization



74
75
76
77
78
# File 'lib/organizations.rb', line 74

def update_organization(org_id, options)
  raise 'Options were not passed as a Hash' if !options.is_a?(Hash)

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

#update_snmp_settings(org_id, options) ⇒ Hash

Updates the current SNMP status for an organization

Parameters:

  • org_id (String)

    dashboard organization ID

  • options (Hash)

    a hash containing all updated SNMP configuration information for an organization. Please refer to official Dashboard API documentation for more information on these options: v2cEnabled, v3Enabled, v3AuthMode, v3AuthPass, v3PrivMode, v3PrivPass, peerIps

Returns:

  • (Hash)

    a hash containing all SNMP configuration information for an organization



38
39
40
41
42
43
# File 'lib/organizations.rb', line 38

def update_snmp_settings(org_id, options)
  raise 'Options were not passed as a Hash' if !options.is_a?(Hash)


  self.make_api_call("/organizations/#{org_id}/snmp", 'PUT', options)
end

#update_third_party_peers(org_id, options) ⇒ Array

Updates your third party peers

Parameters:

  • org_id (String)

    dashboard organization ID

Returns:

  • (Array)

    returns the array of hashes for all currently configured 3rd party peers



58
59
60
61
62
# File 'lib/organizations.rb', line 58

def update_third_party_peers(org_id, options)
  raise 'Options were not passed as an Array' if !options.is_a?(Array)

  self.make_api_call("/organizations/#{org_id}/thirdPartyVPNPeers", 'PUT', options)
end