Class: SpectranetUser
- Inherits:
-
Object
- Object
- SpectranetUser
- 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
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #get_data_balance ⇒ Object
-
#initialize(username, password) ⇒ SpectranetUser
constructor
A new instance of SpectranetUser.
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
#password ⇒ Object (readonly)
Returns the value of attribute password.
4 5 6 |
# File 'lib/datameter/spectranet_user.rb', line 4 def password @password end |
#username ⇒ Object (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_balance ⇒ Object
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 |