1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[dynect|dns] Updates reference to service

This commit is contained in:
Paul Thornthwaite 2012-12-22 23:27:58 +00:00
parent 322cf0c56a
commit 0c5395b0d6
4 changed files with 11 additions and 11 deletions

View file

@ -16,7 +16,7 @@ module Fog
def destroy def destroy
requires :identity, :name, :type, :zone requires :identity, :name, :type, :zone
connection.delete_record(type, zone.identity, name, identity) service.delete_record(type, zone.identity, name, identity)
true true
end end
@ -28,13 +28,13 @@ module Fog
} }
options.delete_if {|key, value| value.nil?} options.delete_if {|key, value| value.nil?}
data = connection.post_record(type, zone.identity, name, rdata, options).body['data'] data = service.post_record(type, zone.identity, name, rdata, options).body['data']
# avoid overwriting zone object with zone string # avoid overwriting zone object with zone string
data = data.reject {|key, value| key == 'zone'} data = data.reject {|key, value| key == 'zone'}
merge_attributes(data) merge_attributes(data)
zone.publish zone.publish
records = connection.get_record(type, zone.identity, name).body['data'] records = service.get_record(type, zone.identity, name).body['data']
# data in format ['/REST/xRecord/domain/fqdn/identity] # data in format ['/REST/xRecord/domain/fqdn/identity]
records.map! do |record| records.map! do |record|
tokens = record.split('/') tokens = record.split('/')

View file

@ -14,8 +14,8 @@ module Fog
def all(options = {}) def all(options = {})
requires :zone requires :zone
data = [] data = []
connection.get_node_list(zone.domain, options).body['data'].each do |fqdn| service.get_node_list(zone.domain, options).body['data'].each do |fqdn|
records = connection.get_record('ANY', zone.domain, fqdn).body['data'] records = service.get_record('ANY', zone.domain, fqdn).body['data']
# data in format ['/REST/xRecord/domain/fqdn/identity] # data in format ['/REST/xRecord/domain/fqdn/identity]
records.map! do |record| records.map! do |record|

View file

@ -23,7 +23,7 @@ module Fog
def destroy def destroy
requires :domain requires :domain
connection.delete_zone(domain) service.delete_zone(domain)
true true
end end
@ -34,12 +34,12 @@ module Fog
def publish def publish
requires :identity requires :identity
data = connection.put_zone(identity, 'publish' => true) data = service.put_zone(identity, 'publish' => true)
true true
end end
def records def records
@records ||= Fog::DNS::Dynect::Records.new(:zone => self, :connection => connection) @records ||= Fog::DNS::Dynect::Records.new(:zone => self, :service => service)
end end
def nameservers def nameservers
@ -48,7 +48,7 @@ module Fog
def save def save
requires :domain, :email, :ttl requires :domain, :email, :ttl
data = connection.post_zone(email, ttl, domain).body['data'] data = service.post_zone(email, ttl, domain).body['data']
merge_attributes(data) merge_attributes(data)
true true
end end

View file

@ -10,14 +10,14 @@ module Fog
model Fog::DNS::Dynect::Zone model Fog::DNS::Dynect::Zone
def all def all
data = connection.get_zone.body['data'].map do |zone| data = service.get_zone.body['data'].map do |zone|
{ :domain => zone } { :domain => zone }
end end
load(data) load(data)
end end
def get(zone_id) def get(zone_id)
new(connection.get_zone('zone' => zone_id).body['data']) new(service.get_zone('zone' => zone_id).body['data'])
rescue Excon::Errors::NotFound rescue Excon::Errors::NotFound
nil nil
end end