Class: Search::RmaTextPresenter

Inherits:
RmaPresenter
  • Object
show all
Defined in:
app/presenters/search/rma_text_presenter.rb

Overview

Text-only variant of RmaPresenter for RMA search results.

See Also:

Instance Method Summary collapse

Instance Method Details

Returns the customer name and account number as plain text.

Returns:

  • (String, nil)

    customer label, or nil if the required columns are unavailable



17
18
19
20
21
# File 'app/presenters/search/rma_text_presenter.rb', line 17

def customer_link
  return unless r.has_columns?(:customer_full_name, :customer_id)

  "#{r.customer_full_name} (CN#{r.customer_id})"
end

Returns the original order reference number as plain text.

Returns:

  • (String, nil)

    order reference number, or nil if the required columns are unavailable



26
27
28
29
30
# File 'app/presenters/search/rma_text_presenter.rb', line 26

def order_link
  return unless r.has_columns?(:original_order_reference_number, :original_order_id)

  r.original_order_reference_number
end

#returned_reasonsString

Returns the returned reasons joined by semicolons.

Returns:

  • (String)

    formatted returned reasons



35
36
37
# File 'app/presenters/search/rma_text_presenter.rb', line 35

def returned_reasons
  RmaReasonCode.where(code: r.returned_reasons).order(:code).map { |rrc| "#{rrc.code} - #{rrc.description}" }.join(';')
end

Returns the RMA number as plain text.

Returns:

  • (String)

    the RMA number



10
11
12
# File 'app/presenters/search/rma_text_presenter.rb', line 10

def rma_link
  r.rma_number
end