Class: TurksatkabloCli::OnlineOperations::Auth

Inherits:
Object
  • Object
show all
Includes:
Singleton, Helpers
Defined in:
lib/turksatkablo_cli/online_operations/auth.rb

Constant Summary collapse

FILE_NAME =
'.turksatkablo'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#add_line, #agent, #check_is_installed?, #check_ruby_version, #internet_connection?, #require_all, #which

Constructor Details

#initializeAuth

Returns a new instance of Auth.



18
19
20
21
# File 'lib/turksatkablo_cli/online_operations/auth.rb', line 18

def initialize
  @path = File.join(File.expand_path('~'), FILE_NAME)
  @login_data = get
end

Instance Attribute Details

#login_dataObject

Returns the value of attribute login_data.



12
13
14
# File 'lib/turksatkablo_cli/online_operations/auth.rb', line 12

def 
  @login_data
end

#login_typeObject (readonly)

Returns the value of attribute login_type.



11
12
13
# File 'lib/turksatkablo_cli/online_operations/auth.rb', line 11

def 
  @login_type
end

#pathObject (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

#getObject



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.
      

    end
  rescue Exception => e
    puts "Bir sorun oluştu."
  end
end

#read_fileObject



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_infoObject



23
24
25
26
27
28
29
30
31
# File 'lib/turksatkablo_cli/online_operations/auth.rb', line 23

def 
  = { :radio_btn_value => agent.radio_btn_value, :username => agent.username,
  :password => agent.password }

  save_file() if @path
  puts "Bilgileriniz bilgisayarınızda şifrelenerek saklandı." if File.exists?(@path)

  
end