Class: Fountain::Api::Labels
- Inherits:
-
Object
- Object
- Fountain::Api::Labels
- Extended by:
- RequestHelper
- Defined in:
- lib/fountain/api/labels.rb
Overview
Fountain Label Management API
Constant Summary
Constants included from RequestHelper
RequestHelper::DEFAULT_REQUEST_OPTIONS
Class Method Summary collapse
-
.applicant_labels(applicant_id) ⇒ [Fountain::Label]
List Labels for an Applicant.
-
.stage_labels(stage_id) ⇒ [Fountain::Label]
List Labels for a Stage.
-
.update_applicant_label(applicant_id, title, update_options = {}) ⇒ [Fountain::Label]
Update Label for an Applicant.
Methods included from RequestHelper
Class Method Details
.applicant_labels(applicant_id) ⇒ [Fountain::Label]
List Labels for an Applicant
18 19 20 21 |
# File 'lib/fountain/api/labels.rb', line 18 def self.applicant_labels(applicant_id) response = request_json("/v2/applicants/#{applicant_id}/labels") response['labels'].map { |hash| Fountain::Label.new hash } end |
.stage_labels(stage_id) ⇒ [Fountain::Label]
List Labels for a Stage
48 49 50 51 |
# File 'lib/fountain/api/labels.rb', line 48 def self.stage_labels(stage_id) response = request_json("/v2/stages/#{stage_id}/labels") response['labels'].map { |hash| Fountain::Label.new hash } end |
.update_applicant_label(applicant_id, title, update_options = {}) ⇒ [Fountain::Label]
Update Label for an Applicant
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fountain/api/labels.rb', line 31 def self.update_applicant_label(applicant_id, title, = {}) = Util.slice_hash(, :completed, :completed_at) if [:completed_at].is_a? Date [:completed_at] = [:completed_at].strftime('%F') end response = request_json( "/v2/applicants/#{applicant_id}/labels/#{CGI.escape(title)}", method: :put, body: ) response['labels'].map { |hash| Fountain::Label.new hash } end |