Class: Delivery::PrintLabels::Result
- Inherits:
-
Data
- Object
- Data
- Delivery::PrintLabels::Result
- Defined in:
- app/services/delivery/print_labels.rb
Instance Attribute Summary collapse
-
#job_ids ⇒ Array<String>
readonly
PrintNode job ids; empty unless a profile printed.
-
#print_profile ⇒ PrintProfile?
readonly
Nil when no profile was selected or the selected one no longer exists.
-
#uploads ⇒ Array<Upload>
readonly
Every document assembled for this print run, whether or not it was piped to a printer.
Instance Method Summary collapse
-
#message ⇒ String?
Operator-facing confirmation, nil when nothing printed.
-
#printed? ⇒ Boolean
Whether the documents actually reached a printer.
Instance Attribute Details
#job_ids ⇒ Array<String> (readonly)
Returns PrintNode job ids; empty unless a profile printed.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/services/delivery/print_labels.rb', line 33 Result = Data.define(:uploads, :print_profile, :job_ids) do # @return [Boolean] whether the documents actually reached a printer def printed? print_profile.present? && job_ids.any? end # @return [String, nil] operator-facing confirmation, nil when nothing printed def return unless printed? "Submitted ship labels upload to print profile #{print_profile.name} [#{print_profile.id}], job #{job_ids.join(', ')}" end end |
#print_profile ⇒ PrintProfile? (readonly)
Returns nil when no profile was selected or the
selected one no longer exists.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/services/delivery/print_labels.rb', line 33 Result = Data.define(:uploads, :print_profile, :job_ids) do # @return [Boolean] whether the documents actually reached a printer def printed? print_profile.present? && job_ids.any? end # @return [String, nil] operator-facing confirmation, nil when nothing printed def return unless printed? "Submitted ship labels upload to print profile #{print_profile.name} [#{print_profile.id}], job #{job_ids.join(', ')}" end end |
#uploads ⇒ Array<Upload> (readonly)
Returns every document assembled for this print run,
whether or not it was piped to a printer.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/services/delivery/print_labels.rb', line 33 Result = Data.define(:uploads, :print_profile, :job_ids) do # @return [Boolean] whether the documents actually reached a printer def printed? print_profile.present? && job_ids.any? end # @return [String, nil] operator-facing confirmation, nil when nothing printed def return unless printed? "Submitted ship labels upload to print profile #{print_profile.name} [#{print_profile.id}], job #{job_ids.join(', ')}" end end |
Instance Method Details
#message ⇒ String?
Returns operator-facing confirmation, nil when nothing printed.
40 41 42 43 44 |
# File 'app/services/delivery/print_labels.rb', line 40 def return unless printed? "Submitted ship labels upload to print profile #{print_profile.name} [#{print_profile.id}], job #{job_ids.join(', ')}" end |
#printed? ⇒ Boolean
Returns whether the documents actually reached a printer.
35 36 37 |
# File 'app/services/delivery/print_labels.rb', line 35 def printed? print_profile.present? && job_ids.any? end |