Created
August 15, 2023 21:24
-
-
Save bodqhrohro/fa72cf3dfb421449571e43910abfa461 to your computer and use it in GitHub Desktop.
Lifecell balance checker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'lifecell_api' | |
# require 'pp' | |
begin | |
life = Lifecell::API.new(msisdn: '380x3xxxxxxx', password: 'xxxxxx') | |
life.sign_in | |
# PP.pp life.balances | |
balance = life.balances['balance'] | |
puts '🐌︎ ' + sprintf('%.3f', balance.detect{|b| b['code']=='Bundle_Internet_3G_Tariff'}['amount'].to_f/1e9) + ' ГБ ' | |
puts '🎁 ' + sprintf('%.3f', balance.detect{|b| b['code']=='Bundle_Internet_3G_Offer'}['amount'].to_f/1e9) + ' ГБ ' | |
#puts '🐌︎ ' + sprintf('%.3f', balance.detect{|b| b['code']=='Bundle_Internet_3G_CMS'}['amount'].to_f/1e9) + ' ГБ' | |
#puts '🌞︎ ' + sprintf('%.3f', balance.detect{|b| b['code']=='Bundle_Internet_3G_Tariff_Weekend'}['amount'].to_f/1e9) + ' ГБ' | |
#puts '🌛︎ ' + sprintf('%.3f', balance.detect{|b| b['code']=='Bundle_Internet_Night'}['amount'].to_f/1e9) + ' ГБ' | |
rescue Lifecell::MethodError | |
puts "ERR_KUMAR" | |
rescue | |
puts "Дисконнект, б**" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment