Class: Squall::IpAddress
Overview
OnApp IpAddress
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create(network_id, options = {}) ⇒ Object
Public: Creates a new IpAddress.
-
#delete(network_id, id) ⇒ Object
Public: Deletes an existing ip address.
-
#edit(network_id, id, options = {}) ⇒ Object
Public: Updates an existing ip address.
-
#list(network_id) ⇒ Object
Public: Lists IP addresses for a network.
Methods inherited from Base
#check_config, #default_params, #key_for_class, #request
Instance Method Details
#create(network_id, options = {}) ⇒ Object
Public: Creates a new IpAddress
network_id - ID of the network options - Params for the new ip address
:address - IP address
:broadcast - A logical address at which all devices
connected to a multiple-access
communications network are enabled to
receive datagrams
:disallowed_primary - Set to '1' to prevent this address
being used as primary
:gateway - Gateway address
:netmask - Network mask
:network_address - IP address of network
Returns a Hash.
30 31 32 |
# File 'lib/squall/ip_address.rb', line 30 def create(network_id, = {}) request(:post, "/settings/networks/#{network_id}/ip_addresses.json", default_params()) end |
#delete(network_id, id) ⇒ Object
Public: Deletes an existing ip address.
network_id - ID of the network id - ID of the ip address
Returns a Hash.
51 52 53 |
# File 'lib/squall/ip_address.rb', line 51 def delete(network_id, id) request(:delete, "/settings/networks/#{network_id}/ip_addresses/#{id}.json") end |
#edit(network_id, id, options = {}) ⇒ Object
Public: Updates an existing ip address.
network_id - ID of the network id - ID of the ip address options - Params for updating the ip address, see ‘#create`
Returns a Hash.
41 42 43 |
# File 'lib/squall/ip_address.rb', line 41 def edit(network_id, id, = {}) request(:put, "/settings/networks/#{network_id}/ip_addresses/#{id}.json", default_params()) end |
#list(network_id) ⇒ Object
Public: Lists IP addresses for a network.
network_id - ID of the network
Returns an Array.
9 10 11 12 |
# File 'lib/squall/ip_address.rb', line 9 def list(network_id) response = request(:get, "/settings/networks/#{network_id}/ip_addresses.json") response.collect { |ip| ip['ip_address'] } end |