Class: Fog::DNS::Dynect::Record
- Extended by:
- Fog::Deprecation
- Defined in:
- lib/fog/dynect/models/dns/record.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
Methods included from Fog::Deprecation
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#destroy ⇒ Object
17 18 19 20 21 |
# File 'lib/fog/dynect/models/dns/record.rb', line 17 def destroy requires :identity, :name, :type, :zone service.delete_record(type, zone.identity, name, identity) true end |
#save ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fog/dynect/models/dns/record.rb', line 23 def save requires :name, :type, :rdata, :zone = { :ttl => ttl } .delete_if {|key, value| value.nil?} data = service.post_record(type, zone.identity, name, rdata, ).body['data'] # avoid overwriting zone object with zone string data = data.reject {|key, value| key == 'zone'} merge_attributes(data) zone.publish records = service.get_record(type, zone.identity, name).body['data'] # data in format ['/REST/xRecord/domain/fqdn/identity] records.map! do |record| tokens = record.split('/') { :identity => tokens.last, :type => tokens[2][0...-6] # everything before 'Record' } end record = records.detect {|record| record[:type] == type} merge_attributes(record) true end |
#zone ⇒ Object
52 53 54 |
# File 'lib/fog/dynect/models/dns/record.rb', line 52 def zone @zone end |