Sha256: 6e489b4c3406c794718fdab67407e6b3a13e0aba54cd5a7d30e2fb4dba938d0f

Contents?: true

Size: 1.63 KB

Versions: 39

Compression:

Stored size: 1.63 KB

Contents

module Fog
  module DNS
    class DNSimple
      class Real

        # Update the given record for the given domain.
        #
        # ==== Parameters
        # * domain<~String>
        # * record_id<~String>
        # * options<~Hash> - optional
        #   * type<~String>
        #   * content<~String>
        #   * priority<~Integer>
        #   * ttl<~Integer>
        # ==== Returns
        # * response<~Excon::Response>:
        #   * record<~Hash>
        #     * name<~String>
        #     * ttl<~Integer>
        #     * created_at<~String>
        #     * special_type<~String>
        #     * updated_at<~String>
        #     * domain_id<~Integer>
        #     * id<~Integer>
        #     * content<~String>
        #     * record_type<~String>
        #     * prio<~Integer>
        def update_record(domain, record_id, options)

          body = { "record" => options }

          request( :body     => Fog::JSON.encode(body),
                   :expects  => 200,
                   :method   => "PUT",
                   :path     => "/domains/#{domain}/records/#{record_id}" )
        end

      end

      class Mock

        def update_record(domain, record_id, options)
          record = self.data[:records][domain].detect { |record| record["record"]["id"] == record_id }
          response = Excon::Response.new

          if record.nil?
            response.status = 400
          else
            response.status = 200
            record["record"].merge!(options)
            record["record"]["updated_at"] = Time.now.iso8601
            response.body = record
          end

          response
        end

      end
    end
  end
end

Version data entries

39 entries across 39 versions & 3 rubygems

Version Path
fog-maestrodev-1.19.0.20140212012611 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/dnsimple/requests/dns/update_record.rb
fog-1.19.0 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/dnsimple/requests/dns/update_record.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/dnsimple/requests/dns/update_record.rb