Class: ReminderDomain

Inherits:
Object
  • Object
show all
Defined in:
lib/reminder/domain.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain) ⇒ ReminderDomain

Returns a new instance of ReminderDomain.



6
7
8
9
10
11
12
13
14
# File 'lib/reminder/domain.rb', line 6

def initialize(domain)
  uri = Addressable::URI.heuristic_parse(domain)
  host = uri.host
  host.start_with?('www.') ? host[4..-1] : host
  @domain = host
  @expiration = expiration
  @reminder = ReminderDomain.task_from_domain(@domain)
  @whois_data = nil
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



4
5
6
# File 'lib/reminder/domain.rb', line 4

def domain
  @domain
end

#expirationObject (readonly)

Returns the value of attribute expiration.



4
5
6
# File 'lib/reminder/domain.rb', line 4

def expiration
  @expiration
end

#whois_dataObject (readonly)

Returns the value of attribute whois_data.



4
5
6
# File 'lib/reminder/domain.rb', line 4

def whois_data
  @whois_data
end

Class Method Details

.task_from_domain(domain) ⇒ Object



17
18
19
# File 'lib/reminder/domain.rb', line 17

def task_from_domain(domain)
  Lita::Handlers::Reminder.runner.reminders.select { |task| task.task == "domain expiration #{domain}"}.first
end