Sha256: 0af575ea347103802d09e55fdb5a36f379491eecc22558698c75d5b55d6c6848

Contents?: true

Size: 1.55 KB

Versions: 10

Compression:

Stored size: 1.55 KB

Contents

module Fog
  module DNS
    class Zerigo
      class Real

        # Update a host record
        #
        # ==== Parameters
        # * host_id<~Integer> - host ID of the record to update
        # * options<~Hash> - optional paramaters
        #   * host_type<~String>
        #   * data<~String>
        #   * hostname<~String> - Note: normally this is set/required!!
        #   * notes<~String>
        #   * priority<~Integer> - Note: required for MX or SRV records
        #   * ttl<~Integer>
        # ==== Returns
        # * response<~Excon::Response>: 
        #   * 'status'<~Integer> - 200 for success
        #
        def update_host( host_id, options = {})

          optional_tags= ''
          options.each { |option, value|
            case option
            when :host_type
              optional_tags+= "<host-type>#{host_type}</host-type>"
            when :data
              optional_tags+= "<data>#{data}</data>"
            when :hostname
              optional_tags+= "<hostname>#{value}</hostname>"
            when :notes
              optional_tags+= "<notes>#{value}</notes>"
            when :priority
              optional_tags+= "<priority>#{value}</priority>"
            when :ttl
              optional_tags+= "<ttl>#{value}</ttl>"
            end
          }

          request(
            :body     => %Q{<?xml version="1.0" encoding="UTF-8"?><host>#{optional_tags}</host>},
            :expects  => 200,
            :method   => 'PUT',
            :path     => "/api/1.1/hosts/#{host_id}.xml"
          )
        end

      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/lib/fog/zerigo/requests/dns/update_host.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/lib/fog/zerigo/requests/dns/update_host.rb
fog-1.0.0 lib/fog/zerigo/requests/dns/update_host.rb
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/dns/requests/zerigo/update_host.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/dns/requests/zerigo/update_host.rb
fog-0.11.0 lib/fog/dns/requests/zerigo/update_host.rb
fog-0.10.0 lib/fog/dns/requests/zerigo/update_host.rb
fog4encbs-0.9.0.1 lib/fog/dns/requests/zerigo/update_host.rb
fog4encbs-0.9.0 lib/fog/dns/requests/zerigo/update_host.rb
fog-0.9.0 lib/fog/dns/requests/zerigo/update_host.rb