Sha256: 121cacd5877e01e159b15495ef225d5028546b94217eda083a5d19d1fcf3ad5e

Contents?: true

Size: 925 Bytes

Versions: 2

Compression:

Stored size: 925 Bytes

Contents

module Fog
  module DNS
    class Rackspace
      class Real
        def add_records(domain_id, records)

          validate_path_fragment :domain_id, domain_id

          data = {
            'records' => records.collect do |record|
              record_data = {
                'name' => record[:name],
                'type' => record[:type],
                'data' => record[:data]
              }

              if record.has_key? :ttl
                record_data['ttl'] = record[:ttl]
              end

              if record.has_key? :priority
                record_data['priority'] = record[:priority]
              end
              record_data
            end
          }

          request(
            :expects  => 202,
            :method   => 'POST',
            :path     => "domains/#{domain_id}/records",
            :body     => Fog::JSON.encode(data)
          )
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-1.22.0 lib/fog/rackspace/requests/dns/add_records.rb
fog-1.21.0 lib/fog/rackspace/requests/dns/add_records.rb