Module: RemoteNoteDataService

Includes:
ResponseDataHelper
Included in:
DataServiceAutoLoader
Defined in:
lib/metasploit/framework/data_service/remote/http/remote_note_data_service.rb

Constant Summary collapse

NOTE_API_PATH =
'/api/v1/notes'
NOTE_MDM_CLASS =
'Mdm::Note'

Instance Method Summary collapse

Methods included from ResponseDataHelper

#json_to_hash, #json_to_mdm_object, #process_file, #to_ar

Instance Method Details

#delete_note(opts) ⇒ Object



27
28
29
# File 'lib/metasploit/framework/data_service/remote/http/remote_note_data_service.rb', line 27

def delete_note(opts)
  json_to_mdm_object(self.delete_data(NOTE_API_PATH, opts), NOTE_MDM_CLASS)
end

#notes(opts) ⇒ Object



9
10
11
12
# File 'lib/metasploit/framework/data_service/remote/http/remote_note_data_service.rb', line 9

def notes(opts)
  path = get_path_select(opts, NOTE_API_PATH)
  json_to_mdm_object(self.get_data(path, nil, opts), NOTE_MDM_CLASS)
end

#report_note(opts) ⇒ Object



14
15
16
# File 'lib/metasploit/framework/data_service/remote/http/remote_note_data_service.rb', line 14

def report_note(opts)
  json_to_mdm_object(self.post_data(NOTE_API_PATH, opts), NOTE_MDM_CLASS).first
end

#update_note(opts) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/metasploit/framework/data_service/remote/http/remote_note_data_service.rb', line 18

def update_note(opts)
  path = NOTE_API_PATH
  if opts && opts[:id]
    id = opts.delete(:id)
    path = "#{NOTE_API_PATH}/#{id}"
  end
  json_to_mdm_object(self.put_data(path, opts), NOTE_MDM_CLASS)
end