Class: DNSimple::TransferOrder
- Inherits:
-
Object
- Object
- DNSimple::TransferOrder
- Includes:
- HTTParty
- Defined in:
- lib/dnsimple/transfer_order.rb
Overview
Class representing a transfer order in DNSimple
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ TransferOrder
constructor
A new instance of TransferOrder.
Constructor Details
#initialize(attributes) ⇒ TransferOrder
Returns a new instance of TransferOrder.
10 11 12 13 14 15 |
# File 'lib/dnsimple/transfer_order.rb', line 10 def initialize(attributes) attributes.each do |key, value| m = "#{key}=".to_sym self.send(m, value) if self.respond_to?(m) end end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/dnsimple/transfer_order.rb', line 6 def id @id end |
#status ⇒ Object
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
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/dnsimple/transfer_order.rb', line 17 def self.create(name, authinfo='', registrant={}, extended_attributes={}, ={}) 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) .merge!({:body => body}) .merge!({:basic_auth => Client.credentials}) response = self.post("#{Client.base_uri}/domain_transfers.json", ) pp response if Client.debug? case response.code when 201 return TransferOrder.new(response["transfer_order"]) when 401 raise RuntimeError, "Authentication failed" else raise DNSimple::Error.new(name, response["errors"]) end end |