Module: PaperclipLambda::Attachment::InstanceMethods
- Defined in:
- lib/paperclip_lambda/attachment.rb
Instance Method Summary collapse
- #process_update_in_lambda(options = {}) ⇒ Object
- #queue_all_for_delete_with_lambda ⇒ Object
- #save_with_lambda ⇒ Object
Instance Method Details
#process_update_in_lambda(options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/paperclip_lambda/attachment.rb', line 26 def process_update_in_lambda( = {}) lambda_definitions = instance.class.paperclip_definitions[name][:lambda] attributes_hash = { } lambda_definitions[:attributes].each do |attribute| attributes_hash[attribute] = instance.send(attribute) end payload = { path: path, old_path: [:old_path], bucket: instance.send(name).[:bucket], attributes: attributes_hash } PaperclipLambda::Client.new(lambda_definitions[:function_name], payload) if instance.respond_to?(:"#{name}_processing?") instance.send("#{name}_processing=", false) instance.class.where(instance.class.primary_key => instance.id).update_all({ "#{name}_processing" => false }) end end |
#queue_all_for_delete_with_lambda ⇒ Object
49 50 51 52 |
# File 'lib/paperclip_lambda/attachment.rb', line 49 def queue_all_for_delete_with_lambda instance.prepare_enqueueing_for_deletion(name) queue_all_for_delete_without_lambda end |
#save_with_lambda ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/paperclip_lambda/attachment.rb', line 16 def save_with_lambda was_dirty = @dirty save_without_lambda.tap do if was_dirty instance.prepare_enqueueing_for(name) end end end |