Class: Labimotion::ApplicationEntity

Inherits:
Grape::Entity
  • Object
show all
Defined in:
lib/labimotion/entities/application_entity.rb

Overview

ApplicationEntity

Defined Under Namespace

Classes: MissingCurrentUserError

Constant Summary collapse

CUSTOM_ENTITY_OPTIONS =
%i[anonymize_below anonymize_with].freeze

Class Method Summary collapse

Class Method Details

.expose!(*args) ⇒ Object



12
13
14
15
16
17
# File 'lib/labimotion/entities/application_entity.rb', line 12

def self.expose!(*args)
  fields = args.first
  options = args.last.is_a?(Hash) ? args.pop : {}
  options = merge_options(options) # merges additional params set in #with_options
  expose_fields_with_anonymization!(fields, options)
end

.expose_timestamps(timestamp_fields: %i[created_at updated_at],, **additional_args) ⇒ Object

rubocop:enable Metrics/MethodLength



41
42
43
44
45
# File 'lib/labimotion/entities/application_entity.rb', line 41

def self.expose_timestamps(timestamp_fields: %i[created_at updated_at], **additional_args)
  timestamp_fields.each do |field|
    expose field, format_with: :eln_timestamp, **additional_args
  end
end