Class: Stash::Merritt::SubmissionJob
- Inherits:
-
Repo::SubmissionJob
- Object
- Repo::SubmissionJob
- Stash::Merritt::SubmissionJob
- Defined in:
- lib/stash/merritt/submission_job.rb
Instance Attribute Summary collapse
-
#resource_id ⇒ Object
readonly
Returns the value of attribute resource_id.
-
#url_helpers ⇒ Object
readonly
Returns the value of attribute url_helpers.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(resource_id:, url_helpers:) ⇒ SubmissionJob
constructor
A new instance of SubmissionJob.
- #submit! ⇒ Object
Constructor Details
#initialize(resource_id:, url_helpers:) ⇒ SubmissionJob
Returns a new instance of SubmissionJob.
12 13 14 15 |
# File 'lib/stash/merritt/submission_job.rb', line 12 def initialize(resource_id:, url_helpers:) @resource_id = resource_id @url_helpers = url_helpers end |
Instance Attribute Details
#resource_id ⇒ Object (readonly)
Returns the value of attribute resource_id.
9 10 11 |
# File 'lib/stash/merritt/submission_job.rb', line 9 def resource_id @resource_id end |
#url_helpers ⇒ Object (readonly)
Returns the value of attribute url_helpers.
10 11 12 |
# File 'lib/stash/merritt/submission_job.rb', line 10 def url_helpers @url_helpers end |
Instance Method Details
#description ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/stash/merritt/submission_job.rb', line 24 def description @description ||= begin resource = StashEngine::Resource.find(resource_id) description_for(resource) rescue => e log.error("Can't find resource #{resource_id}: #{e}\n#{e.backtrace.join("\n")}") "#{self.class} for missing resource #{resource_id}" end end |
#submit! ⇒ Object
17 18 19 20 21 22 |
# File 'lib/stash/merritt/submission_job.rb', line 17 def submit! log.info("#{Time.now.xmlschema} #{description}") do_submit! rescue => e Stash::Repo::SubmissionResult.failure(resource_id: resource_id, request_desc: description, error: e) end |