Class: Balance::Providers::DomolinkKaluga

Inherits:
Object
  • Object
show all
Defined in:
lib/balance/providers/domolink_kaluga.rb

Instance Method Summary collapse

Instance Method Details

#check(login, password) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/balance/providers/domolink_kaluga.rb', line 5

def check( , password )
  agent = Mechanize.new
  agent.verify_mode = OpenSSL::SSL::VERIFY_NONE

   = agent.get 'https://room.centertelecom.ru/klg/www.PageViewer?page_name=S*START_PAGE'
   = .forms.first
  .field(:name => 'p_logname').value = .upcase
  .field(:name => 'p_pwd').value = password

  result_page = .submit
  result_page.parser.css('.dat').text.match(/\d+\.\d+/)[0].to_f
end