Class: Nylas::NeuralCleanConversation
- Includes:
- Model
- Defined in:
- lib/nylas/neural_clean_conversation.rb
Overview
Structure to represent a the Neural Clean Conversations object.
Constant Summary collapse
- IMAGE_REGEX =
/[(']cid:(.*?)[)']/.freeze
Constants inherited from Message
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
-
#extract_images ⇒ Object
Parses image file IDs found in the clean conversation object and returns an array of File objects returned from the File API.
Methods included from Model
#auth_method, #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
#extract_images ⇒ Object
Parses image file IDs found in the clean conversation object and returns an array of File objects returned from the File API
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/nylas/neural_clean_conversation.rb', line 19 def extract_images return if conversation.nil? files = [] matches = conversation.scan(IMAGE_REGEX) matches.each do |match| # After applying the regex, if there are IDs found they would be # in the form of => 'cid:xxxx' (including apostrophes), so we discard # everything before and after the file ID (denoted as xxxx above) files.push(api.files.find(match)) end files end |