Class: Sufia::Arkivo::Actor
- Inherits:
-
Object
- Object
- Sufia::Arkivo::Actor
- Defined in:
- lib/sufia/arkivo/actor.rb
Instance Attribute Summary collapse
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #create_file_from_item ⇒ Object
- #destroy_file(gf) ⇒ Object
-
#initialize(user, item) ⇒ Actor
constructor
A new instance of Actor.
- #update_file_from_item(gf) ⇒ Object
Constructor Details
#initialize(user, item) ⇒ Actor
Returns a new instance of Actor.
14 15 16 17 |
# File 'lib/sufia/arkivo/actor.rb', line 14 def initialize(user, item) @user = user @item = item end |
Instance Attribute Details
#item ⇒ Object (readonly)
Returns the value of attribute item.
12 13 14 |
# File 'lib/sufia/arkivo/actor.rb', line 12 def item @item end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
12 13 14 |
# File 'lib/sufia/arkivo/actor.rb', line 12 def user @user end |
Instance Method Details
#create_file_from_item ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/sufia/arkivo/actor.rb', line 19 def create_file_from_item batch = Batch.create file_actor = Sufia::GenericFile::Actor.new(::GenericFile.new, user) file_actor.(batch.id) store_checksum(file_actor.generic_file) file_actor.create_content(file, item['file']['filename'], file_path, item['file']['contentType']) BatchUpdateJob.new(user.user_key, batch.id, item['metadata']['title'], attributes, default_visibility).run file_actor.generic_file end |
#destroy_file(gf) ⇒ Object
38 39 40 |
# File 'lib/sufia/arkivo/actor.rb', line 38 def destroy_file(gf) gf.destroy end |
#update_file_from_item(gf) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/sufia/arkivo/actor.rb', line 29 def update_file_from_item(gf) file_actor = Sufia::GenericFile::Actor.new(gf, user) (file_actor) file_actor.(attributes, default_visibility) store_checksum(file_actor.generic_file) file_actor.update_content(file, file_path) file_actor.generic_file end |