Class: Freenom::Authenticator

Inherits:
Explorer
  • Object
show all
Defined in:
lib/freenom/dns/explorers/authenticator.rb

Constant Summary collapse

LOGIN_URL =
'https://my.freenom.com/clientarea.php'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ExtendedCapybaraDSL

#text?

Methods included from Expecting

#expecting

Constructor Details

#initialize(username:, password:) ⇒ Authenticator

Returns a new instance of Authenticator.



11
12
13
14
# File 'lib/freenom/dns/explorers/authenticator.rb', line 11

def initialize(username:, password:)
  @username = username
  @password = password
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



9
10
11
# File 'lib/freenom/dns/explorers/authenticator.rb', line 9

def password
  @password
end

#usernameObject

Returns the value of attribute username.



9
10
11
# File 'lib/freenom/dns/explorers/authenticator.rb', line 9

def username
  @username
end

Instance Method Details

#runObject

Raises:



16
17
18
19
20
21
22
23
# File 'lib/freenom/dns/explorers/authenticator.rb', line 16

def run
  visit LOGIN_URL

  return if already_login?

  submit_credential
  raise LoginFailedError if failed_to_login?
end