Class: Myra::Domain
- Inherits:
-
Object
- Object
- Myra::Domain
- Defined in:
- lib/myra/objects/domain.rb
Constant Summary collapse
- PATH =
'/domains'
- MAP =
{ # response field => target field 'name' => 'name', 'autoUpdate' => 'auto_update', 'maintenance' => 'maintenance', 'owned' => 'owned', 'reversed' => 'reversed', 'paused' => 'paused', 'autoDns' => 'auto_dns' }.freeze
Instance Attribute Summary collapse
-
#auto_dns ⇒ Object
Returns the value of attribute auto_dns.
-
#auto_update ⇒ Object
Returns the value of attribute auto_update.
-
#created ⇒ Object
Returns the value of attribute created.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#maintenance ⇒ Object
Returns the value of attribute maintenance.
-
#modified ⇒ Object
Returns the value of attribute modified.
-
#name ⇒ Object
Returns the value of attribute name.
-
#owned ⇒ Object
Returns the value of attribute owned.
-
#paused ⇒ Object
Returns the value of attribute paused.
-
#paused_until ⇒ Object
Returns the value of attribute paused_until.
-
#reversed ⇒ Object
Returns the value of attribute reversed.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id: nil) ⇒ Domain
constructor
A new instance of Domain.
- #to_hash ⇒ Object
Constructor Details
#initialize(id: nil) ⇒ Domain
Returns a new instance of Domain.
26 27 28 29 30 31 |
# File 'lib/myra/objects/domain.rb', line 26 def initialize(id: nil) @id = id %w(maintenance auto_update auto_dns paused owned reversed).each do |field| send("#{field}=", false) end end |
Instance Attribute Details
#auto_dns ⇒ Object
Returns the value of attribute auto_dns.
8 9 10 |
# File 'lib/myra/objects/domain.rb', line 8 def auto_dns @auto_dns end |
#auto_update ⇒ Object
Returns the value of attribute auto_update.
8 9 10 |
# File 'lib/myra/objects/domain.rb', line 8 def auto_update @auto_update end |
#created ⇒ Object
Returns the value of attribute created.
8 9 10 |
# File 'lib/myra/objects/domain.rb', line 8 def created @created end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/myra/objects/domain.rb', line 7 def id @id end |
#maintenance ⇒ Object
Returns the value of attribute maintenance.
8 9 10 |
# File 'lib/myra/objects/domain.rb', line 8 def maintenance @maintenance end |
#modified ⇒ Object
Returns the value of attribute modified.
8 9 10 |
# File 'lib/myra/objects/domain.rb', line 8 def modified @modified end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/myra/objects/domain.rb', line 8 def name @name end |
#owned ⇒ Object
Returns the value of attribute owned.
8 9 10 |
# File 'lib/myra/objects/domain.rb', line 8 def owned @owned end |
#paused ⇒ Object
Returns the value of attribute paused.
8 9 10 |
# File 'lib/myra/objects/domain.rb', line 8 def paused @paused end |
#paused_until ⇒ Object
Returns the value of attribute paused_until.
8 9 10 |
# File 'lib/myra/objects/domain.rb', line 8 def paused_until @paused_until end |
#reversed ⇒ Object
Returns the value of attribute reversed.
8 9 10 |
# File 'lib/myra/objects/domain.rb', line 8 def reversed @reversed end |
Class Method Details
.from_hash(hash) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/myra/objects/domain.rb', line 33 def self.from_hash(hash) domain = new(id: hash['id']) %w(modified created).each do |date_field| domain.send "#{date_field}=", DateTime.parse(hash[date_field]) end MAP.each do |k, v| domain.send "#{v}=", hash[k] if hash.key?(k) end domain end |
Instance Method Details
#to_hash ⇒ Object
44 45 46 47 |
# File 'lib/myra/objects/domain.rb', line 44 def to_hash return new_domain_hash if id.nil? domain_hash end |