Class: FeSipgate
- Inherits:
-
Object
- Object
- FeSipgate
- Defined in:
- lib/fe_sipgate.rb
Instance Method Summary collapse
- #balance ⇒ Object
-
#initialize(debug: false, headless: true, cookies: nil) ⇒ FeSipgate
constructor
A new instance of FeSipgate.
- #login(usernamex = nil, passwordx = nil, username: usernamex, password: passwordx) ⇒ Object
- #quit ⇒ Object
- #save_cookies(file) ⇒ Object
Constructor Details
#initialize(debug: false, headless: true, cookies: nil) ⇒ FeSipgate
Returns a new instance of FeSipgate.
13 14 15 16 17 18 19 |
# File 'lib/fe_sipgate.rb', line 13 def initialize(debug: false, headless: true, cookies: nil) @fw = FerrumWizard.new('https://login.sipgate.com/', headless: headless, cookies: , debug: debug) @fw.scan_page if end |
Instance Method Details
#balance ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/fe_sipgate.rb', line 29 def balance() raise FeSipgateErr, 'not logged in?' unless @fw.browser.title == 'sipgate | App' r = @fw.links.keys.find {|x| x =~ /Balance:/} balance = r[/(?<=Balance: ).*/] end |
#login(usernamex = nil, passwordx = nil, username: usernamex, password: passwordx) ⇒ Object
21 22 23 |
# File 'lib/fe_sipgate.rb', line 21 def login(usernamex=nil, passwordx=nil, username: usernamex, password: passwordx) @fw.login(username, password) end |
#quit ⇒ Object
38 39 40 |
# File 'lib/fe_sipgate.rb', line 38 def quit() @fw.quit end |
#save_cookies(file) ⇒ Object
25 26 27 |
# File 'lib/fe_sipgate.rb', line 25 def (file) @fw. file end |