Class: DNSimple::TransferOrder

Inherits:
Base
  • Object
show all
Defined in:
lib/dnsimple/transfer_order.rb

Overview

Represents a transfer order.

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from DNSimple::Base

Instance Attribute Details

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/dnsimple/transfer_order.rb', line 6

def id
  @id
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/dnsimple/transfer_order.rb', line 8

def status
  @status
end

Class Method Details

.create(name, authinfo = '', registrant = {}, extended_attributes = {}, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dnsimple/transfer_order.rb', line 10

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("/v1/domain_transfers", options)

  case response.code
  when 201
    new(response["transfer_order"])
  else
    raise RequestError.new("Error creating transfer order", response)
  end
end