Class: Inwx::Nameserver

Inherits:
Object
  • Object
show all
Defined in:
lib/inwx.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user = false, pass = false, address = "api.domrobot.com", lang = "en") ⇒ Nameserver

Returns a new instance of Nameserver.



14
15
16
# File 'lib/inwx.rb', line 14

def initialize(user=false, pass=false, address="api.domrobot.com", lang="en")
  self.api_client = DomainRobot.new(address, user, pass, lang)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



12
13
14
# File 'lib/inwx.rb', line 12

def api_client
  @api_client
end

Instance Method Details

#add_domain(domain_name, send_params = {}) ⇒ Object

IS WORKING CORRECT



30
31
32
33
34
35
36
# File 'lib/inwx.rb', line 30

def add_domain(domain_name, send_params={}) # IS WORKING CORRECT
  params = {:domain => domain_name, :type => DEFAULT_NAMESERVER_TYPE, :ns => DEFAULT_NAMESERVER_LIST, :web => DEFAULT_WEB_IP, :mail => DEFAULT_MAILSERVER_IP, :soaEmail => DEFAULT_SOA_MAIL}
  params.merge! send_params
  response = self.api_client.call("nameserver", "create", params)
  return [true, response] if response["code"] == 1000 or response["code"] == 1001
  [false, response]
end

#address=(a) ⇒ Object



26
27
28
# File 'lib/inwx.rb', line 26

def address=(a)
  self.api_client.address=(a)
end

#create_domain_record(roId, type, content, send_params = {}) ⇒ Object

IS WORKING CORRECT



66
67
68
69
70
71
72
# File 'lib/inwx.rb', line 66

def create_domain_record(roId, type, content, send_params={}) # IS WORKING CORRECT
  params = {:roId => roId, :type => type, :content => content}
  params.merge! send_params
  response = self.api_client.call("nameserver", "createRecord", params)
  return [true, response] if response["code"] == 1000 or response["code"] == 1001
  [false, response] 
end

#delete_domain(domain_name, roId) ⇒ Object

IS WORKING CORRECT



38
39
40
41
42
43
# File 'lib/inwx.rb', line 38

def delete_domain(domain_name, roId) # IS WORKING CORRECT
  params = {:domain => domain_name, :roId => roId}
  response = self.api_client.call("nameserver", "delete", params)
  return [true, response] if response["code"] == 1000 or response["code"] == 1001
  [false, response]
end

#delete_domain_record(id) ⇒ Object

IS WORKING CORRECT



74
75
76
77
78
79
# File 'lib/inwx.rb', line 74

def delete_domain_record(id) # IS WORKING CORRECT
  params = {:id => id}
  response = self.api_client.call("nameserver", "deleteRecord", params)
  return [true, response] if response["code"] == 1000 or response["code"] == 1001
  [false, response]
end

#info_domain(roId) ⇒ Object

IS WORKING CORRECT



59
60
61
62
63
64
# File 'lib/inwx.rb', line 59

def info_domain(roId) # IS WORKING CORRECT
  params = {:roId => roId}
  response = self.api_client.call("nameserver", "info", params)
  return [true, response] if response["code"] == 1000 or response["code"] == 1001
  [false, response]
end

#list_domains(page = 0, pagelimit = 0) ⇒ Object

IS WORKING CORRECT



45
46
47
48
49
50
# File 'lib/inwx.rb', line 45

def list_domains(page=0, pagelimit=0) # IS WORKING CORRECT
  params = {:page => page, :pagelimit => pagelimit}
  response = self.api_client.call("nameserver", "list", params)
  return [true, response] if response["code"] == 1000 or response["code"] == 1001
  [false, response]
end

#pass=(p) ⇒ Object



22
23
24
# File 'lib/inwx.rb', line 22

def pass=(p)
  self.api_client.password=p
end

#search_domain(domain, page = 0, pagelimit = 0) ⇒ Object

IS WORKING CORRECT



52
53
54
55
56
57
# File 'lib/inwx.rb', line 52

def search_domain(domain, page=0, pagelimit=0) # IS WORKING CORRECT
  params = {:domain => domain, :page => page, :pagelimit => pagelimit}
  response = self.api_client.call("nameserver", "list", params)
  return [true, response] if response["code"] == 1000 or response["code"] == 1001
  [false, response]
end

#update_domain_record(id, send_params = {}) ⇒ Object

IS WORKING CORRECT



81
82
83
84
85
86
87
# File 'lib/inwx.rb', line 81

def update_domain_record(id, send_params={}) # IS WORKING CORRECT
  params = {:id => id}
  params.merge! send_params
  response = self.api_client.call("nameserver", "updateRecord", params)
  return [true, response] if response["code"] == 1000 or response["code"] == 1001
  [false, response]
end

#user=(u) ⇒ Object



18
19
20
# File 'lib/inwx.rb', line 18

def user=(u)
  self.api_client.username=u
end