Sha256: 10b0155eceae3e8455482b7dbd049cb8ba4575ea6f3653b64d7fb4ff140524ae

Contents?: true

Size: 1.79 KB

Versions: 39

Compression:

Stored size: 1.79 KB

Contents

module Fog
  module DNS
    class DNSimple
      class Real

        # Create a single domain in DNSimple in your account.
        # ==== Parameters
        # * name<~String> - domain name to host (ie example.com)
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'name'<~String>
        def create_domain(name)
          body = { "domain" => { "name" => name } }
          request(
                  :body     => Fog::JSON.encode(body),
                  :expects  => 201,
                  :method   => 'POST',
                  :path     => '/domains'
                  )
        end

      end

      class Mock

        def create_domain(name)
          response = Excon::Response.new
          response.status = 201

          body = {
            "domain" =>  {
              "auto_renew"         => nil,
              "created_at"         => Time.now.iso8601,
              "expires_on"         => Date.today + 365,
              "id"                 => Fog::Mock.random_numbers(1).to_i,
              "language"           => nil,
              "lockable"           => true,
              "name"               => name,
              "name_server_status" => "unknown",
              "registrant_id"      => nil,
              "state"              => "registered",
              "token"              => "4fIFYWYiJayvL2tkf_mkBkqC4L+4RtYqDA",
              "unicode_name"       => name,
              "updated_at"         => Time.now.iso8601,
              "user_id"            => 1,
              "record_count"       => 0,
              "service_count"      => 0,
              "private_whois?"     => false
            }
          }
          self.data[:domains] << body

          response.body = body
          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/create_domain.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-1.19.0 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/dnsimple/requests/dns/create_domain.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/dnsimple/requests/dns/create_domain.rb