Class: Nylas::NeuralCategorizer

Inherits:
Message
  • Object
show all
Includes:
Model
Defined in:
lib/nylas/neural_categorizer.rb

Overview

Structure to represent a the Neural Categorizer object.

Constant Summary

Constants inherited from Message

Message::UPDATABLE_ATTRIBUTES

Instance Attribute Summary

Attributes included from Model

#api

Instance Method Summary collapse

Methods included from Model

#create, #destroy, #execute, included, #model_class, #persisted?, #reload, #resource_path, #resources_path, #save, #save_all_attributes, #to_json, #update, #update_all_attributes

Methods inherited from Message

#expanded, #handle_folder, #save, #starred?, #unread?, #update, #update_folder

Instance Method Details

#recategorize(category) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/nylas/neural_categorizer.rb', line 18

def recategorize(category)
  body = { message_id: id, category: category }
  api.execute(
    method: :post,
    path: "#{resources_path}/feedback",
    payload: JSON.dump(body)
  )
  list = api.neural.categorize([id])
  list[0]
end