Class: ForestLiana::IntercomController

Inherits:
ApplicationController show all
Defined in:
app/controllers/forest_liana/intercom_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_user_from_jwt, #forest_user, papertrail?, #route_not_found, #serialize_model, #serialize_models

Instance Method Details

#attributesObject



13
14
15
16
17
18
19
20
# File 'app/controllers/forest_liana/intercom_controller.rb', line 13

def attributes
  getter = IntercomAttributesGetter.new(params)
  getter.perform

  render serializer: nil, json: serialize_model(getter.records, {
    context: { type: get_serializer_type('intercom_attributes') }
  })
end

#get_serializer_type(suffix) ⇒ Object



22
23
24
# File 'app/controllers/forest_liana/intercom_controller.rb', line 22

def get_serializer_type(suffix)
  "#{params[:collection]}_#{suffix}"
end

#user_conversationsObject



3
4
5
6
7
8
9
10
11
# File 'app/controllers/forest_liana/intercom_controller.rb', line 3

def user_conversations
  getter = IntercomConversationsGetter.new(params)
  getter.perform

  render serializer: nil, json: serialize_models(getter.records, {
    context: { type: get_serializer_type('intercom_conversations') },
    count: getter.count
  })
end