balance 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,7 @@ Balance is a gem automating checking balance for different service providers.
11
11
 
12
12
  === Internet
13
13
 
14
+ * Yota (https://my.yota.ru/selfcare)
14
15
  * Domolink Kaluga (http://radius.kaluga.ru)
15
16
 
16
17
  === Hosting
File without changes
@@ -4,14 +4,14 @@ class Balance::Providers::DomolinkKaluga
4
4
 
5
5
  def check( login, password )
6
6
  agent = Mechanize.new
7
+ agent.verify_mode = OpenSSL::SSL::VERIFY_NONE
7
8
 
8
- login_page = agent.get 'http://cabinet.kaluga.ru/klg/www.PageViewer?page_name=S*START_PAGE'
9
+ login_page = agent.get 'https://room.centertelecom.ru/klg/www.PageViewer?page_name=S*START_PAGE'
9
10
  login_form = login_page.forms.first
10
11
  login_form.field(:name => 'p_logname').value = login.upcase
11
12
  login_form.field(:name => 'p_pwd').value = password
12
13
 
13
- result_page = agent.get login_form.submit.meta.first.href
14
-
14
+ result_page = login_form.submit
15
15
  result_page.parser.css('.dat').text.match(/\d+\.\d+/)[0].to_f
16
16
  end
17
17
 
@@ -5,10 +5,12 @@ class Balance::Providers::MegafonMoscow
5
5
  def check( number, password )
6
6
  agent = Mechanize.new
7
7
  agent.user_agent = 'Mozilla/5.0 (Linux; U; Android 2.2; en-us; Desire_A8181 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'
8
- agent.get 'https://www.serviceguide.megafonmoscow.ru/'
9
8
 
10
- p = agent.post 'https://www.serviceguide.megafonmoscow.ru/ps/scc/mobile/', 'MOBILE_MODE' => 'AUTH', 'LOGIN' => number, 'PASSWORD' => password
11
- p.parser.css('#statusbalance').text.match(/\d+\.\d+/)[0].to_f
9
+ lp = agent.post 'https://moscowsg.megafon.ru/ps/scc/php/check.php?CHANNEL=WWW', 'LOGIN' => number, 'PASSWORD' => password
10
+ sid = Nokogiri::XML(lp.body).css('SESSION_ID').text
11
+
12
+ p = agent.post 'https://moscowsg.megafon.ru/SCWWW/ACCOUNT_INFO', 'CHANNEL' => 'WWW', 'P_USER_LANG_ID' => 1, 'find' => '', 'SESSION_ID' => sid
13
+ p.parser.css('.balance_good').text.match(/-?\d+\.\d+/)[0].to_f
12
14
  end
13
15
 
14
16
  end
@@ -0,0 +1,19 @@
1
+ require 'mechanize'
2
+
3
+ class Balance::Providers::Yota
4
+
5
+ def check( login, password )
6
+ agent = Mechanize.new
7
+
8
+ login_page = agent.get 'https://my.yota.ru/selfcare/login'
9
+ login_form = login_page.forms[1]
10
+ login_form.field(:name => 'IDToken1').value = login
11
+ login_form.field(:name => 'IDToken2').value = password
12
+ login_form.field(:name => 'IDToken3').value = password
13
+
14
+ login_form.submit.parser.css('.account-money dd')[0].text.match(/\d+\.\d+/)[0].to_f
15
+ end
16
+
17
+ end
18
+
19
+ Balance.add_provider! 'yota', Balance::Providers::Yota
@@ -1,8 +1,8 @@
1
- module Balance
1
+ class Balance
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,49 +1,45 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: balance
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Alexey Noskov
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-03-05 00:00:00 +03:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: mechanize
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- description: Balance is a gem automating checking balance for different service providers, such as mobile operators, hosting providers.
36
- email:
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Balance is a gem automating checking balance for different service providers,
31
+ such as mobile operators, hosting providers.
32
+ email:
37
33
  - alexey.noskov@gmail.com
38
- executables:
34
+ executables:
39
35
  - balance
40
36
  extensions: []
41
-
42
- extra_rdoc_files:
37
+ extra_rdoc_files:
43
38
  - README.rdoc
44
39
  - MIT-LICENSE
45
- files:
40
+ files:
46
41
  - lib/balance/version.rb
42
+ - lib/balance/providers/yota.rb
47
43
  - lib/balance/providers/locum_ru.rb
48
44
  - lib/balance/providers/domolink_kaluga.rb
49
45
  - lib/balance/providers/megafon_moscow.rb
@@ -52,46 +48,34 @@ files:
52
48
  - bin/balance
53
49
  - MIT-LICENSE
54
50
  - README.rdoc
55
- has_rdoc: true
56
51
  homepage: http://github.com/alno/balance
57
52
  licenses: []
58
-
59
53
  post_install_message:
60
- rdoc_options:
54
+ rdoc_options:
61
55
  - --line-numbers
62
56
  - --inline-source
63
57
  - --title
64
- - Rayo CMS
58
+ - Balance gem
65
59
  - --main
66
60
  - README.rdoc
67
- require_paths:
61
+ require_paths:
68
62
  - lib
69
- required_ruby_version: !ruby/object:Gem::Requirement
63
+ required_ruby_version: !ruby/object:Gem::Requirement
70
64
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
78
- required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
70
  none: false
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- hash: 23
84
- segments:
85
- - 1
86
- - 3
87
- - 6
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
88
74
  version: 1.3.6
89
75
  requirements: []
90
-
91
76
  rubyforge_project:
92
- rubygems_version: 1.3.7
77
+ rubygems_version: 1.8.23
93
78
  signing_key:
94
79
  specification_version: 3
95
80
  summary: Balance is a gem automating checking balance for different service providers.
96
81
  test_files: []
97
-