Class: ProviderKit::EncryptedSettings

Inherits:
Settings
  • Object
show all
Defined in:
lib/provider_kit/encrypted_settings.rb

Overview

Serializable object to read/write from account settings fields (encrypted)

Instance Attribute Summary

Attributes inherited from Settings

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Settings

#[], #[]=, #include?, #initialize, #inspect, #method_missing, #respond_to?, #to_h, #to_json, #update

Constructor Details

This class inherits a constructor from ProviderKit::Settings

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ProviderKit::Settings

Class Method Details

.dump(data) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/provider_kit/encrypted_settings.rb', line 11

def self.dump(data)
  case data
  when self
    data.to_value
  else
    new(data).to_value
  end
end

.load(data) ⇒ Object



20
21
22
# File 'lib/provider_kit/encrypted_settings.rb', line 20

def self.load(data)
  new(data.presence)
end

Instance Method Details

#to_valueObject



7
8
9
# File 'lib/provider_kit/encrypted_settings.rb', line 7

def to_value
  encrypt_data_for_storage
end