Class: ActiveZone::Provider::Zone Abstract
- Inherits:
-
Object
- Object
- ActiveZone::Provider::Zone
- Extended by:
- ActiveModel::Callbacks
- Includes:
- ActiveModel::AttributeAssignment, ActiveModel::Attributes, ActiveModel::Conversion, ActiveModel::Dirty, ActiveModel::Model, ActiveModel::Serialization, ActiveModel::Validations, Zone::Builtins
- Defined in:
- lib/active_zone/provider/zone.rb
Overview
Subclass and override to create a functional Zone model
An Active Model class representing a DNS Zone at a provider.
Instance Attribute Summary collapse
-
#persisted ⇒ TrueClass, FalseClass
readonly
private
Whether the current zone is persisted with a provider.
-
#provider ⇒ ActiveZone::Provider
readonly
Provider the zone will be stored at.
Class Method Summary collapse
-
.method_missing(method_name) ⇒ Object
Delegate missing class methods to all.
-
.respond_to_missing?(method_name, include_private = false) ⇒ TrueClass, FalseClass
Delegate missing class methods to all.
Instance Method Summary collapse
-
#delete! ⇒ TrueClass, FalseClass
abstract
Underlying method to delete the current zone.
-
#initialize(provider = ActiveZone.provider, **attributes) ⇒ Zone
constructor
A new instance of Zone.
-
#persist!(**options, &block) ⇒ TrueClass, FalseClass
abstract
private
Underlying method to save the current zone.
-
#persisted? ⇒ TrueClass, FalseClass
private
Whether the current zone is persisted with a provider.
Methods included from Zone::Builtins::Persistence
#destroy, #destroy!, #save, #save!, #update, #update!
Constructor Details
#initialize(provider = ActiveZone.provider, **attributes) ⇒ Zone
Returns a new instance of Zone.
27 28 29 30 31 32 |
# File 'lib/active_zone/provider/zone.rb', line 27 def initialize(provider = ActiveZone.provider, **attributes) @provider = provider (attributes[:resources] = attributes[:resources].map { |el| ActiveZone::Resource.new(**el) }) if attributes[:resources] super(attributes) clear_changes_information end |
Instance Attribute Details
#persisted ⇒ TrueClass, FalseClass (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether the current zone is persisted with a provider
20 21 22 |
# File 'lib/active_zone/provider/zone.rb', line 20 def persisted @persisted end |
#provider ⇒ ActiveZone::Provider (readonly)
Provider the zone will be stored at
51 52 53 |
# File 'lib/active_zone/provider/zone.rb', line 51 def provider @provider end |
Class Method Details
.method_missing(method_name) ⇒ Object
Delegate missing class methods to all
35 36 37 |
# File 'lib/active_zone/provider/zone.rb', line 35 def self.method_missing(method_name, *, &) all.send(method_name, *, &) end |
.respond_to_missing?(method_name, include_private = false) ⇒ TrueClass, FalseClass
Delegate missing class methods to all
41 42 43 |
# File 'lib/active_zone/provider/zone.rb', line 41 def self.respond_to_missing?(method_name, include_private = false) all.respond_to?(method_name, include_private) end |
Instance Method Details
#delete! ⇒ TrueClass, FalseClass
Override in subclass with how to delete a Zone at your provider.
Underlying method to delete the current zone
66 67 68 |
# File 'lib/active_zone/provider/zone.rb', line 66 def delete! raise NotImplementedError end |
#persist!(**options, &block) ⇒ TrueClass, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override in subclass with how to persist a Zone at your provider
Underlying method to save the current zone
59 60 61 |
# File 'lib/active_zone/provider/zone.rb', line 59 def persist!(**, &block) raise NotImplementedError end |
#persisted? ⇒ TrueClass, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether the current zone is persisted with a provider
72 73 74 |
# File 'lib/active_zone/provider/zone.rb', line 72 def persisted? persisted end |