Class: Spree::Adyen::Presenters::Communications::Base
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Spree::Adyen::Presenters::Communications::Base
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?
Instance Method Summary
collapse
Instance Method Details
#created_at_s ⇒ Object
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_class ⇒ Object
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_fields ⇒ Object
27
28
29
|
# File 'app/models/spree/adyen/presenters/communications/base.rb', line 27
def present_fields
fields.compact
end
|
#to_model ⇒ Object
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_path ⇒ Object
19
20
21
|
# File 'app/models/spree/adyen/presenters/communications/base.rb', line 19
def to_partial_path
"spree/adyen/communication/communication"
end
|