Class: SmartRecruiters::ReportsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/smartrecruiters/resources/reports.rb

Constant Summary collapse

REPORT_API =
'reporting-api/v201804/reports'

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from SmartRecruiters::Resource

Instance Method Details

#generate_report(report_id:) ⇒ Object



20
21
22
# File 'lib/smartrecruiters/resources/reports.rb', line 20

def generate_report(report_id:)
  Report.new post_request("#{REPORT_API}/#{report_id}/files", body: {}).body
end

#list(**params) ⇒ Object



6
7
8
9
# File 'lib/smartrecruiters/resources/reports.rb', line 6

def list(**params)
  response = get_request(REPORT_API.to_s, params: params)
  Collection.from_response(response, type: Report)
end

#retrieve(report_id:) ⇒ Object



11
12
13
# File 'lib/smartrecruiters/resources/reports.rb', line 11

def retrieve(report_id:)
  Report.new get_request("#{REPORT_API}/#{report_id}").body
end

#retrieve_files(report_id:) ⇒ Object



15
16
17
18
# File 'lib/smartrecruiters/resources/reports.rb', line 15

def retrieve_files(report_id:)
  response = get_request("#{REPORT_API}/#{report_id}/files")
  Collection.from_response(response, type: ReportFile)
end

#retrieve_recent_file(report_id:) ⇒ Object



24
25
26
# File 'lib/smartrecruiters/resources/reports.rb', line 24

def retrieve_recent_file(report_id:)
  ReportFile.new get_request("#{REPORT_API}/#{report_id}/files/recent").body
end

#retrieve_recent_file_data(report_id:) ⇒ Object



28
29
30
31
# File 'lib/smartrecruiters/resources/reports.rb', line 28

def retrieve_recent_file_data(report_id:)
  response = get_request("#{REPORT_API}/#{report_id}/files/recent/data").body
  Object.new JSON.parse(response)
end