Module: Phones

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

Overview

Phones section of the Meraki Dashboard API

Author:

  • Joe Letizia

Instance Method Summary collapse

Instance Method Details

#add_phone_contact(network_id, options) ⇒ Hash

Add a single phone contact

Parameters:

  • network_id (String)

    the network id you want to add the contact to

  • options (Hash)

    an options hash that contains the contact attributes. Currently only supports the name attribute.

Returns:

  • (Hash)

    returns the hash containing the contact attributes



16
17
18
19
20
# File 'lib/phones.rb', line 16

def add_phone_contact(network_id, options)
  raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
  
  self.make_api_call("/networks/#{network_id}/phoneContacts", 'POST', options)
end

#delete_phone_contact(network_id, contact_id) ⇒ Integer

Delete a single phone contact

Parameters:

  • network_id (String)

    the network id you want to delete the contact on

  • contact_id (String)

    the ID of the contact you want to delete

Returns:

  • (Integer)

    HTTP Code



37
38
39
# File 'lib/phones.rb', line 37

def delete_phone_contact(network_id, contact_id)
  self.make_api_call("/networks/#{network_id}/phoneContacts/#{contact_id}", 'DELETE')
end

#list_phone_contacts(network_id) ⇒ Array

Get list of phone contacts

Parameters:

  • network_id (String)

    the network id you want to list contacts for

Returns:

  • (Array)

    an array of hashes containing attribute information for each contact



8
9
10
# File 'lib/phones.rb', line 8

def list_phone_contacts(network_id)
  self.make_api_call("/networks/#{network_id}/phoneContacts", 'GET')
end

#update_phone_contact(network_id, contact_id, options) ⇒ Hash

Update a single phone contact

Parameters:

  • network_id (String)

    the network id you want to update the contact in

  • contact_id (String)

    the ID of the contact you want to update

  • options (Hash)

    an options hash that contains the contact attributes. Currently only supports the name attribute.

Returns:

  • (Hash)

    returns the hash containing the contacts updated attributes



27
28
29
30
31
# File 'lib/phones.rb', line 27

def update_phone_contact(network_id, contact_id, options)
  raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
  
  self.make_api_call("/networks/#{network_id}/phoneContacts/#{contact_id}", 'PUT', options)
end