Module: Event::RequestDescriptorUpdateEvent
- Included in:
- Event
- Defined in:
- app/models/event/request_descriptor_update_event.rb
Class Method Summary collapse
Instance Method Summary collapse
- #library_creation_descriptor? ⇒ Boolean
- #pass_or_fail_event? ⇒ Boolean
- #set_request_metadata ⇒ Object
- #update_metadata_for_request ⇒ Object
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 |
# File 'app/models/event/request_descriptor_update_event.rb', line 3 def self.included(base) base.after_create( :update_metadata_for_request, if: lambda { |event| event.eventful.is_a?(Request) and event.descriptor_key.present? } ) end |
Instance Method Details
#library_creation_descriptor? ⇒ Boolean
14 15 16 |
# File 'app/models/event/request_descriptor_update_event.rb', line 14 def library_creation_descriptor? %w[library_creation_complete multiplexed_library_creation].include?(descriptor_key) end |
#pass_or_fail_event? ⇒ Boolean
10 11 12 |
# File 'app/models/event/request_descriptor_update_event.rb', line 10 def pass_or_fail_event? %w[fail pass].include?(family) end |
#set_request_metadata ⇒ Object
18 19 20 21 |
# File 'app/models/event/request_descriptor_update_event.rb', line 18 def eventful.[descriptor_key] = content eventful..save! end |
#update_metadata_for_request ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/event/request_descriptor_update_event.rb', line 23 def unless pass_or_fail_event? if request.failed? || request.cancelled? return end return if pass_or_fail_event? library_creation_descriptor? ? request.pass! : request.start! end |