Class: Nifcloud::DNS::Record
Constant Summary
collapse
- RECORD_SET_WITH_ID =
'hostedzone/%s/rrset'
- RECORD_SET_WITH_PARAMS =
'hostedzone/%s/rrset?%s'
Constants inherited
from Client
Client::AUTHORIZATION_HEADER, Client::DATE_HEADER, Client::ENDPOINT, Client::NAMESPACE, Client::VERSION
Constants inherited
from Auth
Auth::ALGORITHM
Instance Attribute Summary
Attributes inherited from Auth
#time
Instance Method Summary
collapse
-
#add(name, type, value, ttl: 86400, comment: '') ⇒ Object
-
#del(name, type, value, ttl: 86400, comment: '') ⇒ Object
-
#initialize(zone_id, access_key: nil, secret_key: nil) ⇒ Record
constructor
A new instance of Record.
-
#list(options: nil) ⇒ Object
Methods inherited from Client
#delete, #get, #post
Methods inherited from Auth
#signature_header
Constructor Details
#initialize(zone_id, access_key: nil, secret_key: nil) ⇒ Record
11
12
13
14
|
# File 'lib/nifcloud/dns/record.rb', line 11
def initialize(zone_id, access_key: nil, secret_key: nil)
super(access_key, secret_key)
@zone_id = zone_id
end
|
Instance Method Details
#add(name, type, value, ttl: 86400, comment: '') ⇒ Object
24
25
26
|
# File 'lib/nifcloud/dns/record.rb', line 24
def add(name, type, value, ttl: 86400, comment: '')
post(RECORD_SET_WITH_ID % @zone_id, xml('CREATE', name, type, value, ttl, ))
end
|
#del(name, type, value, ttl: 86400, comment: '') ⇒ Object
28
29
30
|
# File 'lib/nifcloud/dns/record.rb', line 28
def del(name, type, value, ttl: 86400, comment: '')
post(RECORD_SET_WITH_ID % @zone_id, xml('DELETE', name, type, value, ttl, ))
end
|
#list(options: nil) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/nifcloud/dns/record.rb', line 16
def list(options: nil)
if options.nil? || !options.instance_of?(Hash)
get(RECORD_SET_WITH_ID % @zone_id)
else
get(RECORD_SET_WITH_PARAMS % [@zone_id, options.collect { |k, v| "#{k}=#{CGI::escape(v.to_s)}" }.join('&')])
end
end
|