Class: ArchivedRemoteObject::Archive::RestoredObject

Inherits:
Object
  • Object
show all
Defined in:
lib/archived_remote_object/archive/restored_object.rb

Instance Method Summary collapse

Constructor Details

#initialize(key:, archived_object: Archive::ArchivedObject.new(key: key)) ⇒ RestoredObject

Returns a new instance of RestoredObject.



7
8
9
10
11
12
# File 'lib/archived_remote_object/archive/restored_object.rb', line 7

def initialize(
  key:,
  archived_object: Archive::ArchivedObject.new(key: key)
)
  self.archived_object = archived_object
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/archived_remote_object/archive/restored_object.rb', line 14

def call
  assign_attributes

  if attributes.status == :archived
    archived_object.restore
    attributes.status = :restoration_initiated
  end

  attributes
end