Sha256: e54b5c4c50015df3e9c271896ff568ca6cca03a1851e7e4d5541f0c61810f0c7
Contents?: true
Size: 936 Bytes
Versions: 46
Compression:
Stored size: 936 Bytes
Contents
module ForestLiana class IntercomAttributesGetter attr_accessor :records def initialize(params) @params = params @intercom = ::Intercom::Client.new( app_id: ForestLiana.integrations[:intercom][:app_id], api_key: ForestLiana.integrations[:intercom][:api_key]) end def count @records.count end def perform resource = user_collection.find(@params[:id]) begin user = @intercom.users.find(email: resource.email) user.segments = user.segments.map do |segment| @intercom.segments.find(id: segment.id) end @records = user rescue Intercom::ResourceNotFound end end private def user_collection ForestLiana.integrations .try(:[], :intercom) .try(:[], :user_collection) .try(:constantize) end def user_collection? user_collection.present? end end end
Version data entries
46 entries across 46 versions & 1 rubygems