Class: Encryptable
- Inherits:
-
Object
- Object
- Encryptable
- Defined in:
- lib/models/encryptable.rb
Instance Attribute Summary collapse
-
#folder ⇒ Object
Returns the value of attribute folder.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ose_secret ⇒ Object
readonly
Returns the value of attribute ose_secret.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name: nil, username: nil, password: nil, ose_secret: nil, type: nil, id: nil) ⇒ Encryptable
constructor
A new instance of Encryptable.
- #to_json(*_args) ⇒ Object
- #to_osesecret ⇒ Object
- #to_yaml ⇒ Object
Constructor Details
#initialize(name: nil, username: nil, password: nil, ose_secret: nil, type: nil, id: nil) ⇒ Encryptable
Returns a new instance of Encryptable.
7 8 9 10 11 12 13 14 15 |
# File 'lib/models/encryptable.rb', line 7 def initialize(name: nil, username: nil, password: nil, ose_secret: nil, type: nil, id: nil) @id = id @name = name @username = username @password = password @ose_secret = ose_secret @type = type || 'credentials' end |
Instance Attribute Details
#folder ⇒ Object
Returns the value of attribute folder.
5 6 7 |
# File 'lib/models/encryptable.rb', line 5 def folder @folder end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/models/encryptable.rb', line 4 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/models/encryptable.rb', line 4 def name @name end |
#ose_secret ⇒ Object (readonly)
Returns the value of attribute ose_secret.
4 5 6 |
# File 'lib/models/encryptable.rb', line 4 def ose_secret @ose_secret end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
4 5 6 |
# File 'lib/models/encryptable.rb', line 4 def password @password end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/models/encryptable.rb', line 4 def type @type end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
4 5 6 |
# File 'lib/models/encryptable.rb', line 4 def username @username end |
Class Method Details
.find(id) ⇒ Object
30 31 32 |
# File 'lib/models/encryptable.rb', line 30 def find(id) EncryptableSerializer.from_json(CryptopusAdapter.new.get("encryptables/#{id}")) end |
.find_by_name_and_folder_id(name, id) ⇒ Object
34 35 36 37 38 |
# File 'lib/models/encryptable.rb', line 34 def find_by_name_and_folder_id(name, id) Folder.find(id).encryptables.find do |encryptable| encryptable.name.downcase == name.downcase end end |
.from_json(json) ⇒ Object
40 41 42 |
# File 'lib/models/encryptable.rb', line 40 def from_json(json) EncryptableSerializer.from_json(json) end |
Instance Method Details
#to_json(*_args) ⇒ Object
17 18 19 |
# File 'lib/models/encryptable.rb', line 17 def to_json(*_args) EncryptableSerializer.to_json(self) end |
#to_osesecret ⇒ Object
25 26 27 |
# File 'lib/models/encryptable.rb', line 25 def to_osesecret EncryptableSerializer.to_osesecret(self) end |
#to_yaml ⇒ Object
21 22 23 |
# File 'lib/models/encryptable.rb', line 21 def to_yaml EncryptableSerializer.to_yaml(self) end |