Module: Broadstreet::ZoneMethods

Included in:
Client
Defined in:
lib/broadstreet/zone_methods.rb

Instance Method Summary collapse

Instance Method Details

#create_zone(network_id, params) ⇒ Hash

Create a new zone

Parameters:

  • network_id: (Fixnum)

    the id of the network to create the zone on

  • params: (Hash)

    a hash of the data for the zone

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :name (String)

    The name of the zone

  • :self_server (Boolean)

    Whether the zone is self serve

  • :pricing_callback_url (String)

    Callback for pricing on self-serve zones

Returns:

  • (Hash)

    the zone detail



13
14
15
# File 'lib/broadstreet/zone_methods.rb', line 13

def create_zone(network_id, params)
  request(:post, "api/1/networks/#{network_id}/zones", params).zone
end

#delete_zone(zone_id) ⇒ Object

Delete a zone

Parameters:

  • zone_id: (Fixnum)

    THe ID of the zone to delete

Returns:

  • nil



29
30
31
32
# File 'lib/broadstreet/zone_methods.rb', line 29

def delete_zone(zone_id)
  request :delete, "api/1/zones/#{zone_id}"
  nil
end

#get_zone(zone_id) ⇒ Hash

Get a zone

Parameters:

  • zone_id: (Fixnum)

    The ID of the zone to retrieve

Returns:

  • (Hash)

    the zone detail



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

def get_zone(zone_id)
  request(:get, "api/1/zones/#{zone_id}").zone
end

#list_zones(network_id) ⇒ Array<Hash>

List zones for a given network

Parameters:

  • network_id: (Fixnum)

    The ID of the network to retrieve zones for

Returns:

  • (Array<Hash>)

    the data for the zones on the specified network



38
39
40
# File 'lib/broadstreet/zone_methods.rb', line 38

def list_zones(network_id)
  request(:get, 'api/1/zones', network_id: network_id).zones
end

#update_zone(zone_id, params) ⇒ Hash

Update a zone

Parameters:

  • zone_id: (Fixnum)

    The ID of the zone to update

  • params: (Hash)

    a hash of the data for the zone

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :name (String)

    The name of the zone

  • :self_server (Boolean)

    Whether the zone is self serve

  • :pricing_callback_url (String)

    Callback for pricing on self-serve zones

Returns:

  • (Hash)

    the updated zone detail



50
51
52
# File 'lib/broadstreet/zone_methods.rb', line 50

def update_zone(zone_id, params)
  request(:put, "api/1/zones/#{zone_id}", params).zone
end