Class: TranslationCms::Api::Customers::Feedbacks::Writer
- Inherits:
-
Base
- Object
- JsonApiClient::Resource
- Base
- Base
- TranslationCms::Api::Customers::Feedbacks::Writer
show all
- Defined in:
- lib/translation_cms/api/customers/feedbacks/writer.rb
Defined Under Namespace
Classes: WriterLanguage
Instance Method Summary
collapse
Methods inherited from Base
all!, custom_scope!, default_attributes, destroy, dummy_resource!, #method_missing_with_translations_will_change, parsed!, path_with_custom_scope, resource_type!, update
Instance Method Details
#dst_titles ⇒ Object
37
38
39
40
41
42
|
# File 'lib/translation_cms/api/customers/feedbacks/writer.rb', line 37
def dst_titles
return 'N/A' if writer_languages.blank?
@dst_titles ||= writer_languages.map { |l| l.dst.title }.uniq
.reject { |t| t == src_title }.slice(1..5).join(', ')
end
|
#feedback_params ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/translation_cms/api/customers/feedbacks/writer.rb', line 23
def feedback_params
if defined?(relationships.feedbacks) && feedbacks.present?
feedbacks.first.attributes.to_json(only: [:id, :rate, :content, :updated_at])
else
'null'
end
end
|
#src_title ⇒ Object
31
32
33
34
35
|
# File 'lib/translation_cms/api/customers/feedbacks/writer.rb', line 31
def src_title
return 'N/A' if writer_languages.blank?
@src_title ||= writer_languages.map { |l| l.src.title }.first
end
|