class Moniker::Domain

A Moniker Domain

Attributes

Public Class Methods

find_all_by_email(email, options = {}) click to toggle source
# File lib/moniker/domain.rb, line 85
def self.find_all_by_email(email, options = {})
  all(options).select { |domain| domain.email == email }
end
find_by_name(name, options = {}) click to toggle source
# File lib/moniker/domain.rb, line 81
def self.find_by_name(name, options = {})
  all(options).detect { |domain| domain.name == name }
end

Public Instance Methods

records() click to toggle source
# File lib/moniker/domain.rb, line 77
def records
  persisted? ? Record.find(:all, :domain_id => id) : []
end

Protected Instance Methods

initialize(attributes = {}, persisted = false) click to toggle source
Calls superclass method
# File lib/moniker/domain.rb, line 49
def initialize(attributes = {}, persisted = false) # :notnew:
  attributes = attributes.with_indifferent_access
  new_attributes = {
      :id => attributes[:id],
      :name => attributes[:name],
      :email => attributes[:email],
      :ttl => attributes[:ttl].present? ? attributes[:ttl].to_i : nil,
      :serial => attributes[:serial].present? ? attributes[:serial] : nil,
      :updated_at => attributes[:updated].present? ? DateTime.strptime(attributes[:updated], Moniker::DATETIME_FORMAT) : nil,
      :created_at => attributes[:created].present? ? DateTime.strptime(attributes[:created], Moniker::DATETIME_FORMAT) : nil
  }

  super(new_attributes, persisted)
end