Sha256: e2682b6a8195cad79dd3d13e8bec80f294f3a6de3ae583bdfa232d7b58a5a82b

Contents?: true

Size: 1.48 KB

Versions: 25

Compression:

Stored size: 1.48 KB

Contents

module Fog
  module DNS
    class Dynect
      class Real

        # Get one or more zones
        #
        # ==== Parameters
        # * options<~Hash>:
        #   * zone<~String> - name of zone to lookup, or omit to return list of zones

        def get_zone(options = {})
          request(
            :expects  => 200,
            :method   => :get,
            :path     => ['Zone', options['zone']].compact.join('/')
          )
        end
      end

      class Mock
        def get_zone(options = {})
          if options['zone']
            raise Fog::DNS::Dynect::NotFound unless zone = self.data[:zones][options['zone']]
            data = {
              "zone_type" => zone[:zone_type],
              "serial_style" => zone[:serial_style],
              "serial" => zone[:serial],
              "zone" => zone[:zone]
            }
            info = "get: Your zone, #{zone[:zone]}"
          else
            data = self.data[:zones].collect { |zone, data| "/REST/Zone/#{zone}/" }
            info = "get: Your #{data.size} zones"
          end

          response = Excon::Response.new
          response.status = 200

          response.body = {
            "status" => "success",
            "data" => data,
            "job_id" => Fog::Dynect::Mock.job_id,
            "msgs" => [{
              "INFO" => info,
              "SOURCE" => "BLL",
              "ERR_CD" => nil,
              "LVL" => "INFO"
            }]
          }

          response
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 7 rubygems

Version Path
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/lib/fog/dynect/requests/dns/get_zone.rb
tag-fog-1.0.1 lib/fog/dynect/requests/dns/get_zone.rb
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/lib/fog/dynect/requests/dns/get_zone.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/lib/fog/dynect/requests/dns/get_zone.rb
fog-1.0.0 lib/fog/dynect/requests/dns/get_zone.rb