Sha256: f66e0c1ac2f15d95cd3c9f45ac53a76ced2be4d7eaf78ec956a694b6693ed072

Contents?: true

Size: 1.77 KB

Versions: 37

Compression:

Stored size: 1.77 KB

Contents

module Fog
  module HP
    class DNS
      class Real
        # List DNS records for a given domain
        #
        # ==== Parameters
        # * 'domain_id'<~String> - UUId of domain for record
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'records'<~Array>:
        #       * 'id'<~String> - UUID of the record
        #       * 'name'<~String> - Name of the record
        #       * 'description'<~String> - Description for the record
        #       * 'type'<~String> - Type of the record
        #       * 'domain_id'<~String> - UUID of the domain
        #       * 'ttl'<~Integer> - TTL of the record
        #       * 'data'<~String> - Data required by the record
        #       * 'priority'<~Integer> - Priority for the record
        #       * 'created_at'<~String> - created date time stamp
        #       * 'updated_at'<~String> - updated date time stamp
        def list_records_in_a_domain(domain_id)
          request(
              :expects => 200,
              :method  => 'GET',
              :path    => "domains/#{domain_id}/records"
          )
        end

      end
      class Mock
        def list_records_in_a_domain(domain_id)
          response = Excon::Response.new
          if domain = list_domains.body['domains'].detect { |_| _['id'] == domain_id }
            response.status = 200
            response.body = { 'records' => records_for_domain(domain_id) }
          else
            raise Fog::HP::DNS::NotFound
          end
          response
        end

        def records_for_domain(domain_id)
          rdata = data[:records].select { |_,v| v['domain_id'] == domain_id}
          records = []
          rdata.each { |_,v| records << v }
          records
        end
      end

    end
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
fog-maestrodev-1.18.0.20131209090811 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/hp/requests/dns/list_records_in_a_domain.rb
fog-1.18.0 lib/fog/hp/requests/dns/list_records_in_a_domain.rb