Sha256: d4e9c5fd987b056cfab2e44e762a57b1ef541adc96ab1ebf76c03ff86f21068b

Contents?: true

Size: 1.68 KB

Versions: 11

Compression:

Stored size: 1.68 KB

Contents

module Fog
  module Zerigo
    class DNS
      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

      class Mock

        def update_host( host_id, options = {})
          Fog::Mock.not_implemented
        end

      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
fog-0.5.1 lib/fog/dns/requests/zerigo/update_host.rb
fog-0.5.0 lib/fog/dns/requests/zerigo/update_host.rb
phpfog-fog-0.4.1.3 lib/fog/dns/requests/zerigo/update_host.rb
phpfog-fog-0.4.1.2 lib/fog/dns/requests/zerigo/update_host.rb
phpfog-fog-0.4.1.1 lib/fog/dns/requests/zerigo/update_host.rb
phpfog-fog-0.4.1 lib/fog/dns/requests/zerigo/update_host.rb
fog-0.4.1 lib/fog/dns/requests/zerigo/update_host.rb
fog-0.4.0 lib/fog/zerigo/requests/dns/update_host.rb
fog-0.3.34 lib/fog/zerigo/requests/dns/update_host.rb
fog-0.3.33 lib/fog/zerigo/requests/dns/update_host.rb
fog-0.3.32 lib/fog/zerigo/requests/dns/update_host.rb