class FileApiClient
Public Instance Methods
get_file()
click to toggle source
# File lib/dynalist/file_api_client.rb, line 5 def get_file response = @conn.post "#{@base}file/list", {token: @token}.to_json check_response!(response) json = JSON.parse(response.body, symbolize_names: true) FileTree.instance.root_id = json[:root_file_id] json[:files].map do |file| instance = if file[:type] == 'folder' Folder.new(file) else Document.new(file) end FileTree.add(instance) instance end end
move_file(queries)
click to toggle source
# File lib/dynalist/file_api_client.rb, line 23 def move_file(queries) changes = queries.map(&:to_query) response = @conn.post "#{@base}file/edit", {token: @token, changes: changes}.to_json check_response!(response) JSON.parse(response.body, symbolize_names: true)[:results] end