Class: Spree::Adyen::Presenters::Communications::Base

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/models/spree/adyen/presenters/communications/base.rb

Overview

Base presenters for generic server-api communication representation

All communication presenters are expected to implement fields success? processed? inbound?

Direct Known Subclasses

AdyenNotification, HppSource, LogEntry

Instance Method Summary collapse

Instance Method Details

#created_at_sObject



23
24
25
# File 'app/models/spree/adyen/presenters/communications/base.rb', line 23

def created_at_s
  created_at.strftime "%d %b %H:%M:%S.%4N"
end

#css_classObject



31
32
33
34
35
36
37
38
39
# File 'app/models/spree/adyen/presenters/communications/base.rb', line 31

def css_class
  [
    success? ? "success" : "failure",
    processed? ? "processed" : "unprocessed",
    inbound? ? "received" : "sent"
  ].
  map { |klass| css_prefix klass }.
  join(" ")
end

#present_fieldsObject



27
28
29
# File 'app/models/spree/adyen/presenters/communications/base.rb', line 27

def present_fields
  fields.compact
end

#to_modelObject

force to_partial_path to be called on the delegator and not the delgatee



15
16
17
# File 'app/models/spree/adyen/presenters/communications/base.rb', line 15

def to_model
  self
end

#to_partial_pathObject



19
20
21
# File 'app/models/spree/adyen/presenters/communications/base.rb', line 19

def to_partial_path
  "spree/adyen/communication/communication"
end