Class: Nettica::Client
Instance Method Summary collapse
- #add_record(domain_record) ⇒ Object
- #apply_template(domainName, groupName) ⇒ Object
-
#create_domain_record(domainName = nil, hostName = nil, recordType = nil, data = nil, ttl = 0, priority = 0) ⇒ Object
domainName - SOAP::SOAPString hostName - SOAP::SOAPString recordType - SOAP::SOAPString data - SOAP::SOAPString ttl - SOAP::SOAPInt priority - SOAP::SOAPInt.
- #create_secondary_zone(domainName, master, ipAddress) ⇒ Object
- #create_zone(domainName) ⇒ Object
- #decode_status(result) ⇒ Object
- #delete_record(domain_record) ⇒ Object
- #delete_zone(domainName) ⇒ Object
- #get_service_info ⇒ Object
-
#initialize(username, password) ⇒ Client
constructor
A new instance of Client.
- #list_domain(domainName) ⇒ Object
- #list_zones ⇒ Object
- #update_record(old_domain_record, new_domain_record) ⇒ Object
Constructor Details
#initialize(username, password) ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 |
# File 'lib/nettica/client.rb', line 16 def initialize(username, password) @username = username @password = Base64.encode64(password).strip @proxy = DnsApiAsmxSoap.new end |
Instance Method Details
#add_record(domain_record) ⇒ Object
94 95 96 |
# File 'lib/nettica/client.rb', line 94 def add_record(domain_record) @proxy.addRecord(AddRecord.new(@username, @password, domain_record)).addRecordResult end |
#apply_template(domainName, groupName) ⇒ Object
70 71 72 |
# File 'lib/nettica/client.rb', line 70 def apply_template(domainName, groupName) @proxy.applyTemplate(ApplyTemplate.new(@username, @password, domainName, groupName)).applyTemplateResult end |
#create_domain_record(domainName = nil, hostName = nil, recordType = nil, data = nil, ttl = 0, priority = 0) ⇒ Object
domainName - SOAP::SOAPString
hostName - SOAP::SOAPString
recordType - SOAP::SOAPString
data - SOAP::SOAPString
ttl - SOAP::SOAPInt
priority - SOAP::SOAPInt
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/nettica/client.rb', line 29 def create_domain_record(domainName = nil, hostName = nil, recordType = nil, data = nil, ttl = 0, priority = 0) valid_ttls = [0, 1, 60, 300, 600, 900, 1800, 2700, 3600, 7200, 14400, 28800, 43200, 64800, 86400, 172800] raise "Ttl must be one of #{valid_ttls.join(',')}" if ttl && ! valid_ttls.include?(ttl) mx_prio = [5, 10, 20, 30, 40, 50, 60, 70, 80, 90] f_prio = [1, 2, 3] raise "MX priority must be one of #{mx_prio.join(',')}" if recordType == "MX" and ! mx_prio.include?(priority) raise "F priority must be one of #{f_prio.join(',')}" if recordType == "F" and ! f_prio.include?(priority) valid_types = ["A", "CNAME", "MX", "F", "TXT", "SRV"] raise "Record type must be one of #{valid_types.join(',')}" if recordType && ! valid_types.include?(recordType) DomainRecord.new(domainName, hostName, recordType, data, ttl, priority) end |
#create_secondary_zone(domainName, master, ipAddress) ⇒ Object
78 79 80 |
# File 'lib/nettica/client.rb', line 78 def create_secondary_zone(domainName, master, ipAddress) @proxy.createSecondaryZone(CreateSecondaryZone.new(@username, @password, domainName, master, ipAddress)).createSecondaryZoneResult end |
#create_zone(domainName) ⇒ Object
90 91 92 |
# File 'lib/nettica/client.rb', line 90 def create_zone(domainName) @proxy.createZone(CreateZone.new(@username, @password, domainName, "")).createZoneResult end |
#decode_status(result) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/nettica/client.rb', line 44 def decode_status(result) case result.result.status when 200 then "Success" when 401 then "Access Denied" when 404 then "Not Found" when 430 then "Domain Exists" when 431 then "Record already exists" when 432 then "Invalid record type. Must be A, CNAME, MX, F, TXT, SRV" when 450 then "No Service" when 451 then "No credits" when 460 then "Your service has expired" end end |
#delete_record(domain_record) ⇒ Object
62 63 64 |
# File 'lib/nettica/client.rb', line 62 def delete_record(domain_record) @proxy.deleteRecord(DeleteRecord.new(@username, @password, domain_record)).deleteRecordResult end |
#delete_zone(domainName) ⇒ Object
86 87 88 |
# File 'lib/nettica/client.rb', line 86 def delete_zone(domainName) @proxy.deleteZone(DeleteZone.new(@username, @password, domainName)).deleteZoneResult end |
#get_service_info ⇒ Object
82 83 84 |
# File 'lib/nettica/client.rb', line 82 def get_service_info() @proxy.getServiceInfo(GetServiceInfo.new(@username, @password)).getServiceInfoResult end |
#list_domain(domainName) ⇒ Object
74 75 76 |
# File 'lib/nettica/client.rb', line 74 def list_domain(domainName) @proxy.listDomain(ListDomain.new(@username, @password, domainName)).listDomainResult end |
#list_zones ⇒ Object
66 67 68 |
# File 'lib/nettica/client.rb', line 66 def list_zones() @proxy.listZones(ListZones.new(@username, @password)).listZonesResult end |
#update_record(old_domain_record, new_domain_record) ⇒ Object
58 59 60 |
# File 'lib/nettica/client.rb', line 58 def update_record(old_domain_record, new_domain_record) @proxy.updateRecord(UpdateRecord.new(@username, @password, old_domain_record, new_domain_record)).updateRecordResult end |