Class: SpectranetUser

Inherits:
Object
  • Object
show all
Includes:
BrowserLike
Defined in:
lib/datameter/spectranet_user.rb

Constant Summary collapse

URL =
'http://selfcare.spectranet.com.ng'
FORM_ID =
'id4'
DATA_BALANCE_XPATH =
%q{//table[@class='dataTable']/tr[1]/td[2]/label}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BrowserLike

#browser, #find_in_page, #page, #visit_link

Constructor Details

#initialize(username, password) ⇒ SpectranetUser

Returns a new instance of SpectranetUser.



10
11
12
13
# File 'lib/datameter/spectranet_user.rb', line 10

def initialize username, password
	@username = username
	@password = password
end

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



4
5
6
# File 'lib/datameter/spectranet_user.rb', line 4

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



4
5
6
# File 'lib/datameter/spectranet_user.rb', line 4

def username
  @username
end

Instance Method Details

#get_data_balanceObject



15
16
17
18
19
# File 'lib/datameter/spectranet_user.rb', line 15

def get_data_balance
	visit_link URL
	balance = find_in_page FORM_ID, {'signInForm.username' => username, 'signInForm.password' => password}, DATA_BALANCE_XPATH
	if balance != 0 then return balance else return nil end
end