Class: Fountain::Api::Notes

Inherits:
Object
  • Object
show all
Extended by:
RequestHelper
Defined in:
lib/fountain/api/notes.rb

Overview

Fountain Note Management API

Constant Summary

Constants included from RequestHelper

RequestHelper::DEFAULT_REQUEST_OPTIONS

Class Method Summary collapse

Methods included from RequestHelper

request, request_json

Class Method Details

.create(applicant_id, content) ⇒ Fountain::Note

Create a Note for an Applicant

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

  • content (String)

    Content for the note

Returns:



25
26
27
28
29
30
31
32
33
# File 'lib/fountain/api/notes.rb', line 25

def self.create(applicant_id, content)
  response = request_json(
    "/v2/applicants/#{applicant_id}/notes",
    method: :post,
    expected_response: [Net::HTTPCreated, Net::HTTPOK],
    body: { content: content }
  )
  Fountain::Note.new response
end

.delete(applicant_id, note_id) ⇒ Boolean

Delete Applicant Note

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

  • note_id (String)

    ID of the Fountain note

Returns:

  • (Boolean)


40
41
42
43
44
45
46
47
# File 'lib/fountain/api/notes.rb', line 40

def self.delete(applicant_id, note_id)
  response = request(
    "/v2/applicants/#{applicant_id}/notes/#{note_id}",
    method: :delete
  )
  check_response response
  true
end

.list(applicant_id) ⇒ [Fountain::Note]

List Notes for an Applicant

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

Returns:



15
16
17
18
# File 'lib/fountain/api/notes.rb', line 15

def self.list(applicant_id)
  response = request_json("/v2/applicants/#{applicant_id}/notes")
  response['notes'].map { |hash| Fountain::Note.new hash }
end

.update(applicant_id, note_id, content) ⇒ Fountain::Note

Update Applicant Note

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

  • note_id (String)

    ID of the Fountain note

  • content (String)

    Content for the note

Returns:



55
56
57
58
59
60
61
62
# File 'lib/fountain/api/notes.rb', line 55

def self.update(applicant_id, note_id, content)
  response = request_json(
    "/v2/applicants/#{applicant_id}/notes/#{note_id}",
    method: :put,
    body: { content: content }
  )
  Fountain::Note.new response
end