Sha256: 1e8d8041a5f6e770af5ae0c1669efa98395c696cbd0a642d5f55956b31d94b3a

Contents?: true

Size: 799 Bytes

Versions: 3

Compression:

Stored size: 799 Bytes

Contents

class DNSimple::TransferOrder # Class representing a transfer order in DNSimple
  attr_accessor :id

  attr_accessor :status

  def self.create(name, authinfo='', registrant={}, extended_attributes={}, options={})
    body = {:domain => {:name => name}, :transfer_order => {:authinfo => authinfo}}

    if registrant[:id]
      body[:domain][:registrant_id] = registrant[:id]
    else
      body.merge!(:contact => Contact.resolve_attributes(registrant))
    end

    body.merge!(:extended_attribute => extended_attributes)

    options.merge!({:body => body})

    response = DNSimple::Client.post 'domain_transfers.json', options

    case response.code
    when 201
      return new(response["transfer_order"])
    else
      raise DNSimple::Error.new(name, response["errors"])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dnsimple-ruby-1.3.2 lib/dnsimple/transfer_order.rb
dnsimple-ruby-1.3.1 lib/dnsimple/transfer_order.rb
dnsimple-ruby-1.3.0 lib/dnsimple/transfer_order.rb