lib/api_thread.rb in nylas-2.0.0 vs lib/api_thread.rb in nylas-2.0.1
- old
+ new
@@ -32,11 +32,11 @@
label = Label.new(@_api)
label.inflate(label_json)
label
end
- if not folder.nil?
+ if not folder.nil? and folder.is_a?(Hash)
folder = Folder.new(@_api)
folder.inflate(@folder)
@folder = folder
end
end
@@ -50,17 +50,25 @@
end
def as_json(options = {})
hash = {}
+ if not @unread.nil?
+ hash["unread"] = @unread
+ end
+
+ if not @starred.nil?
+ hash["starred"] = @starred
+ end
+
if not @labels.nil? and @labels != []
- hash["labels"] = @labels.map do |label|
+ hash["label_ids"] = @labels.map do |label|
label.id
end
end
if not @folder.nil?
- hash["folder"] = @folder.id
+ hash["folder_id"] = @folder.id
end
hash
end