Class: Tortoise::Configuration

Inherits:
ApplicationRecord show all
Defined in:
lib/tortoise/models/configuration.rb

Instance Method Summary collapse

Instance Method Details

#app_passwordObject



15
16
17
# File 'lib/tortoise/models/configuration.rb', line 15

def app_password
  crypt.decrypt_and_verify(read_attribute(:app_password)) unless read_attribute(:app_password).nil?
end

#app_password=(password) ⇒ Object



11
12
13
# File 'lib/tortoise/models/configuration.rb', line 11

def app_password=(password)
  write_attribute(:app_password, crypt.encrypt_and_sign(password)) unless password.nil?
end

#default_max_retryObject



23
24
25
# File 'lib/tortoise/models/configuration.rb', line 23

def default_max_retry
  max_retry || 5
end

#default_retry_timeObject



19
20
21
# File 'lib/tortoise/models/configuration.rb', line 19

def default_retry_time
  (retry_time || 5).minutes
end

#passwordObject



7
8
9
# File 'lib/tortoise/models/configuration.rb', line 7

def password
  crypt.decrypt_and_verify(read_attribute(:password)) unless read_attribute(:password).nil?
end

#password=(password) ⇒ Object



3
4
5
# File 'lib/tortoise/models/configuration.rb', line 3

def password=(password)
  write_attribute(:password, crypt.encrypt_and_sign(password)) unless password.nil?
end

#to_sObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tortoise/models/configuration.rb', line 27

def to_s
  {
    api_path: api_path,
    token_path: token_path,
    upload_path: upload_path,
    public_informations_path: public_informations_path,
    user: user,
    password: read_attribute(:password),
    app_user: app_user,
    app_password: read_attribute(:app_password)
  }
end