Sha256: 4e0b3332d39460f04c369dd548d535537857405e0126416a60ff3e119bf1b66a
Contents?: true
Size: 799 Bytes
Versions: 51
Compression:
Stored size: 799 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 begin resource = collection.find(@params[:id]) 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 collection @params[:collection].singularize.camelize.constantize end end end
Version data entries
51 entries across 51 versions & 1 rubygems