Class: Fog::DNS::DNSimple::Record
- Inherits:
-
Model
- Object
- Model
- Fog::DNS::DNSimple::Record
- Extended by:
- Fog::Deprecation
- Defined in:
- lib/fog/dnsimple/models/dns/record.rb
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes = {}) ⇒ Record
constructor
A new instance of Record.
- #save ⇒ Object
- #zone ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Record
Returns a new instance of Record.
22 23 24 |
# File 'lib/fog/dnsimple/models/dns/record.rb', line 22 def initialize(attributes={}) super end |
Instance Method Details
#destroy ⇒ Object
26 27 28 29 |
# File 'lib/fog/dnsimple/models/dns/record.rb', line 26 def destroy service.delete_record(zone.id, identity) true end |
#save ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fog/dnsimple/models/dns/record.rb', line 35 def save requires :name, :type, :value = {} [:prio] = priority if priority [:ttl] = ttl if ttl # decide whether its a new record or update of an existing if id.nil? data = service.create_record(zone.id, name, type, value, ) else [:name] = name if name [:content] = value if value [:type] = type if type data = service.update_record(zone.id, id, ) end merge_attributes(data.body["record"]) true end |
#zone ⇒ Object
31 32 33 |
# File 'lib/fog/dnsimple/models/dns/record.rb', line 31 def zone @zone end |