Class: Ridley::EncryptedDataBagItem
- Inherits:
-
Object
- Object
- Ridley::EncryptedDataBagItem
- Defined in:
- lib/ridley/resources/encrypted_data_bag_item.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#data_bag ⇒ Object
readonly
Returns the value of attribute data_bag.
Class Method Summary collapse
-
.find(connection, data_bag, object) ⇒ nil, Ridley::DataBagItem
Finds a data bag item and decrypts it.
-
.find!(connection, data_bag, object) ⇒ nil, Ridley::DataBagItem
Finds a data bag item and decrypts it.
Instance Method Summary collapse
-
#initialize(connection, data_bag, attributes = {}) ⇒ EncryptedDataBagItem
constructor
A new instance of EncryptedDataBagItem.
- #to_s ⇒ Object
Constructor Details
#initialize(connection, data_bag, attributes = {}) ⇒ EncryptedDataBagItem
Returns a new instance of EncryptedDataBagItem.
40 41 42 43 44 |
# File 'lib/ridley/resources/encrypted_data_bag_item.rb', line 40 def initialize(connection, data_bag, attributes = {}) @connection = connection @data_bag = data_bag @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
35 36 37 |
# File 'lib/ridley/resources/encrypted_data_bag_item.rb', line 35 def attributes @attributes end |
#data_bag ⇒ Object (readonly)
Returns the value of attribute data_bag.
34 35 36 |
# File 'lib/ridley/resources/encrypted_data_bag_item.rb', line 34 def data_bag @data_bag end |
Class Method Details
.find(connection, data_bag, object) ⇒ nil, Ridley::DataBagItem
Finds a data bag item and decrypts it.
11 12 13 14 15 |
# File 'lib/ridley/resources/encrypted_data_bag_item.rb', line 11 def find(connection, data_bag, object) find!(connection, data_bag, object) rescue Errors::HTTPNotFound nil end |
.find!(connection, data_bag, object) ⇒ nil, Ridley::DataBagItem
Finds a data bag item and decrypts it. Throws an exception if the item doesn’t exist.
27 28 29 30 31 |
# File 'lib/ridley/resources/encrypted_data_bag_item.rb', line 27 def find!(connection, data_bag, object) data_bag_item = DataBagItem.find!(connection, data_bag, object) data_bag_item.decrypt new(connection, data_bag, data_bag_item.attributes) end |
Instance Method Details
#to_s ⇒ Object
46 47 48 |
# File 'lib/ridley/resources/encrypted_data_bag_item.rb', line 46 def to_s self.attributes end |