Class: Registrar::Provider::OpenSRS

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/registrar/provider/opensrs.rb,
lib/registrar/provider/opensrs/order.rb,
lib/registrar/provider/opensrs/contact.rb,
lib/registrar/provider/opensrs/tld_data.rb,
lib/registrar/provider/opensrs/operation.rb,
lib/registrar/provider/opensrs/contact_set.rb,
lib/registrar/provider/opensrs/tld_data_us.rb,
lib/registrar/provider/opensrs/name_server_list.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Contact, ContactSet, NameServerList, Operation, Order, TldData, TldDataUs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, username, private_key) ⇒ OpenSRS

Returns a new instance of OpenSRS.



19
20
21
22
23
# File 'lib/registrar/provider/opensrs.rb', line 19

def initialize(url, username, private_key)
  @url = url
  @username = username
  @private_key = private_key
end

Instance Attribute Details

#private_keyObject

Returns the value of attribute private_key.



17
18
19
# File 'lib/registrar/provider/opensrs.rb', line 17

def private_key
  @private_key
end

#urlObject

Returns the value of attribute url.



17
18
19
# File 'lib/registrar/provider/opensrs.rb', line 17

def url
  @url
end

#usernameObject

Returns the value of attribute username.



17
18
19
# File 'lib/registrar/provider/opensrs.rb', line 17

def username
  @username
end

Instance Method Details

#available?(name) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
# File 'lib/registrar/provider/opensrs.rb', line 25

def available?(name)
  response = execute(lookup_operation(name).to_xml)

  items = response['OPS_envelope']['body']['data_block']['dt_assoc']['item']
  items = items.find { |item| item['dt_assoc'] }['dt_assoc']
  items['item'][0] == 'available'
end

#name_servers(name) ⇒ Object Also known as: nameservers



46
47
48
49
50
51
52
# File 'lib/registrar/provider/opensrs.rb', line 46

def name_servers(name)
  operation = Operation.new(:get, {
    :domain => name, 
    :type => "nameservers"
  })
  nameserver_list_from(execute(operation.to_xml).body)
end

#purchase(name, registrant, purchase_options = nil) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/registrar/provider/opensrs.rb', line 33

def purchase(name, registrant, purchase_options=nil)
  purchase_options ||= Registrar::PurchaseOptions.new
  response = execute(registration_operation(name, registrant, 
                                            purchase_options).to_xml)
  order = check_order(response.body)
  order.add_domain(name, registrant)
  order.to_order
end

#renew(name, renewal_options) ⇒ Object



42
43
44
# File 'lib/registrar/provider/opensrs.rb', line 42

def renew(name, renewal_options)

end