Class: TurksatkabloCli::OnlineOperations::Auth
- Inherits:
-
Object
- Object
- TurksatkabloCli::OnlineOperations::Auth
- Includes:
- Singleton, Helpers
- Defined in:
- lib/turksatkablo_cli/online_operations/auth.rb
Constant Summary collapse
- FILE_NAME =
'.turksatkablo'.freeze
Instance Attribute Summary collapse
-
#login_data ⇒ Object
Returns the value of attribute login_data.
-
#login_type ⇒ Object
readonly
Returns the value of attribute login_type.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize ⇒ Auth
constructor
A new instance of Auth.
- #read_file ⇒ Object
- #save_login_info ⇒ Object
Methods included from Helpers
#add_line, #agent, #check_is_installed?, #check_ruby_version, #internet_connection?, #require_all, #which
Constructor Details
Instance Attribute Details
#login_data ⇒ Object
Returns the value of attribute login_data.
12 13 14 |
# File 'lib/turksatkablo_cli/online_operations/auth.rb', line 12 def login_data @login_data end |
#login_type ⇒ Object (readonly)
Returns the value of attribute login_type.
11 12 13 |
# File 'lib/turksatkablo_cli/online_operations/auth.rb', line 11 def login_type @login_type end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/turksatkablo_cli/online_operations/auth.rb', line 11 def path @path end |
Instance Method Details
#get ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/turksatkablo_cli/online_operations/auth.rb', line 33 def get return read_file if File.exists?(@path) begin if agent.get_login save_login_info end rescue Exception => e puts "Bir sorun oluştu." end end |
#read_file ⇒ Object
45 46 47 |
# File 'lib/turksatkablo_cli/online_operations/auth.rb', line 45 def read_file YAML.load(decryption(File.read(@path))) end |
#save_login_info ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/turksatkablo_cli/online_operations/auth.rb', line 23 def save_login_info login_info = { :radio_btn_value => agent.radio_btn_value, :username => agent.username, :password => agent.password } save_file(login_info) if @path puts "Bilgileriniz bilgisayarınızda şifrelenerek saklandı." if File.exists?(@path) login_info end |