Skip to content

Instantly share code, notes, and snippets.

@bodqhrohro
Created August 15, 2023 21:24
Show Gist options
  • Save bodqhrohro/fa72cf3dfb421449571e43910abfa461 to your computer and use it in GitHub Desktop.
Save bodqhrohro/fa72cf3dfb421449571e43910abfa461 to your computer and use it in GitHub Desktop.
Lifecell balance checker
#!/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