Class: Merge::Ats::Candidate
- Inherits:
-
Object
- Object
- Merge::Ats::Candidate
- Defined in:
- lib/merge_ruby_client/ats/types/candidate.rb
Overview
# The Candidate Object
### Description
The `Candidate` object is used to represent profile information about a given
Candidate. Because it is specific to a Candidate, this information stays
constant across applications.
### Usage Example
Fetch from the `LIST Candidates` endpoint and filter by `ID` to show all
candidates.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#applications ⇒ Array<Merge::Ats::CandidateApplicationsItem>
readonly
Array of ‘Application` object IDs.
-
#attachments ⇒ Array<Merge::Ats::CandidateAttachmentsItem>
readonly
Array of ‘Attachment` object IDs.
-
#can_email ⇒ Boolean
readonly
Whether or not the candidate can be emailed.
-
#company ⇒ String
readonly
The candidate’s current company.
-
#created_at ⇒ DateTime
readonly
The datetime that this object was created by Merge.
- #email_addresses ⇒ Array<Merge::Ats::EmailAddress> readonly
- #field_mappings ⇒ Hash{String => Object} readonly
-
#first_name ⇒ String
readonly
The candidate’s first name.
- #id ⇒ String readonly
-
#is_private ⇒ Boolean
readonly
Whether or not the candidate is private.
-
#last_interaction_at ⇒ DateTime
readonly
When the most recent interaction with the candidate occurred.
-
#last_name ⇒ String
readonly
The candidate’s last name.
-
#locations ⇒ Array<String>
readonly
The candidate’s locations.
-
#modified_at ⇒ DateTime
readonly
The datetime that this object was modified by Merge.
- #phone_numbers ⇒ Array<Merge::Ats::PhoneNumber> readonly
-
#remote_created_at ⇒ DateTime
readonly
When the third party’s candidate was created.
- #remote_data ⇒ Array<Merge::Ats::RemoteData> readonly
-
#remote_id ⇒ String
readonly
The third-party API ID of the matching object.
-
#remote_updated_at ⇒ DateTime
readonly
When the third party’s candidate was updated.
- #remote_was_deleted ⇒ Boolean readonly
-
#tags ⇒ Array<String>
readonly
Array of ‘Tag` names as strings.
-
#title ⇒ String
readonly
The candidate’s current title.
- #urls ⇒ Array<Merge::Ats::Url> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Ats::Candidate
Deserialize a JSON object to an instance of Candidate.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, first_name: OMIT, last_name: OMIT, company: OMIT, title: OMIT, remote_created_at: OMIT, remote_updated_at: OMIT, last_interaction_at: OMIT, is_private: OMIT, can_email: OMIT, locations: OMIT, phone_numbers: OMIT, email_addresses: OMIT, urls: OMIT, tags: OMIT, applications: OMIT, attachments: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) ⇒ Merge::Ats::Candidate constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Candidate to a JSON object.
Constructor Details
#initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, first_name: OMIT, last_name: OMIT, company: OMIT, title: OMIT, remote_created_at: OMIT, remote_updated_at: OMIT, last_interaction_at: OMIT, is_private: OMIT, can_email: OMIT, locations: OMIT, phone_numbers: OMIT, email_addresses: OMIT, urls: OMIT, tags: OMIT, applications: OMIT, attachments: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) ⇒ Merge::Ats::Candidate
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 103 def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, first_name: OMIT, last_name: OMIT, company: OMIT, title: OMIT, remote_created_at: OMIT, remote_updated_at: OMIT, last_interaction_at: OMIT, is_private: OMIT, can_email: OMIT, locations: OMIT, phone_numbers: OMIT, email_addresses: OMIT, urls: OMIT, tags: OMIT, applications: OMIT, attachments: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) @id = id if id != OMIT @remote_id = remote_id if remote_id != OMIT @created_at = created_at if created_at != OMIT @modified_at = modified_at if modified_at != OMIT @first_name = first_name if first_name != OMIT @last_name = last_name if last_name != OMIT @company = company if company != OMIT @title = title if title != OMIT @remote_created_at = remote_created_at if remote_created_at != OMIT @remote_updated_at = remote_updated_at if remote_updated_at != OMIT @last_interaction_at = last_interaction_at if last_interaction_at != OMIT @is_private = is_private if is_private != OMIT @can_email = can_email if can_email != OMIT @locations = locations if locations != OMIT @phone_numbers = phone_numbers if phone_numbers != OMIT @email_addresses = email_addresses if email_addresses != OMIT @urls = urls if urls != OMIT @tags = if != OMIT @applications = applications if applications != OMIT @attachments = if != OMIT @remote_was_deleted = remote_was_deleted if remote_was_deleted != OMIT @field_mappings = field_mappings if field_mappings != OMIT @remote_data = remote_data if remote_data != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "remote_id": remote_id, "created_at": created_at, "modified_at": modified_at, "first_name": first_name, "last_name": last_name, "company": company, "title": title, "remote_created_at": remote_created_at, "remote_updated_at": remote_updated_at, "last_interaction_at": last_interaction_at, "is_private": is_private, "can_email": can_email, "locations": locations, "phone_numbers": phone_numbers, "email_addresses": email_addresses, "urls": urls, "tags": , "applications": applications, "attachments": , "remote_was_deleted": remote_was_deleted, "field_mappings": field_mappings, "remote_data": remote_data }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
71 72 73 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 71 def additional_properties @additional_properties end |
#applications ⇒ Array<Merge::Ats::CandidateApplicationsItem> (readonly)
Returns Array of ‘Application` object IDs.
61 62 63 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 61 def applications @applications end |
#attachments ⇒ Array<Merge::Ats::CandidateAttachmentsItem> (readonly)
Returns Array of ‘Attachment` object IDs.
63 64 65 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 63 def @attachments end |
#can_email ⇒ Boolean (readonly)
Returns Whether or not the candidate can be emailed.
49 50 51 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 49 def can_email @can_email end |
#company ⇒ String (readonly)
Returns The candidate’s current company.
37 38 39 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 37 def company @company end |
#created_at ⇒ DateTime (readonly)
Returns The datetime that this object was created by Merge.
29 30 31 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 29 def created_at @created_at end |
#email_addresses ⇒ Array<Merge::Ats::EmailAddress> (readonly)
55 56 57 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 55 def email_addresses @email_addresses end |
#field_mappings ⇒ Hash{String => Object} (readonly)
67 68 69 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 67 def field_mappings @field_mappings end |
#first_name ⇒ String (readonly)
Returns The candidate’s first name.
33 34 35 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 33 def first_name @first_name end |
#id ⇒ String (readonly)
25 26 27 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 25 def id @id end |
#is_private ⇒ Boolean (readonly)
Returns Whether or not the candidate is private.
47 48 49 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 47 def is_private @is_private end |
#last_interaction_at ⇒ DateTime (readonly)
Returns When the most recent interaction with the candidate occurred.
45 46 47 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 45 def last_interaction_at @last_interaction_at end |
#last_name ⇒ String (readonly)
Returns The candidate’s last name.
35 36 37 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 35 def last_name @last_name end |
#locations ⇒ Array<String> (readonly)
Returns The candidate’s locations.
51 52 53 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 51 def locations @locations end |
#modified_at ⇒ DateTime (readonly)
Returns The datetime that this object was modified by Merge.
31 32 33 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 31 def modified_at @modified_at end |
#phone_numbers ⇒ Array<Merge::Ats::PhoneNumber> (readonly)
53 54 55 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 53 def phone_numbers @phone_numbers end |
#remote_created_at ⇒ DateTime (readonly)
Returns When the third party’s candidate was created.
41 42 43 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 41 def remote_created_at @remote_created_at end |
#remote_data ⇒ Array<Merge::Ats::RemoteData> (readonly)
69 70 71 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 69 def remote_data @remote_data end |
#remote_id ⇒ String (readonly)
Returns The third-party API ID of the matching object.
27 28 29 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 27 def remote_id @remote_id end |
#remote_updated_at ⇒ DateTime (readonly)
Returns When the third party’s candidate was updated.
43 44 45 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 43 def remote_updated_at @remote_updated_at end |
#remote_was_deleted ⇒ Boolean (readonly)
65 66 67 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 65 def remote_was_deleted @remote_was_deleted end |
#tags ⇒ Array<String> (readonly)
Returns Array of ‘Tag` names as strings.
59 60 61 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 59 def @tags end |
#title ⇒ String (readonly)
Returns The candidate’s current title.
39 40 41 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 39 def title @title end |
#urls ⇒ Array<Merge::Ats::Url> (readonly)
57 58 59 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 57 def urls @urls end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Ats::Candidate
Deserialize a JSON object to an instance of Candidate
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 162 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] remote_id = parsed_json["remote_id"] created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?) modified_at = (DateTime.parse(parsed_json["modified_at"]) unless parsed_json["modified_at"].nil?) first_name = parsed_json["first_name"] last_name = parsed_json["last_name"] company = parsed_json["company"] title = parsed_json["title"] remote_created_at = unless parsed_json["remote_created_at"].nil? DateTime.parse(parsed_json["remote_created_at"]) end remote_updated_at = unless parsed_json["remote_updated_at"].nil? DateTime.parse(parsed_json["remote_updated_at"]) end last_interaction_at = unless parsed_json["last_interaction_at"].nil? DateTime.parse(parsed_json["last_interaction_at"]) end is_private = parsed_json["is_private"] can_email = parsed_json["can_email"] locations = parsed_json["locations"] phone_numbers = parsed_json["phone_numbers"]&.map do |item| item = item.to_json Merge::Ats::PhoneNumber.from_json(json_object: item) end email_addresses = parsed_json["email_addresses"]&.map do |item| item = item.to_json Merge::Ats::EmailAddress.from_json(json_object: item) end urls = parsed_json["urls"]&.map do |item| item = item.to_json Merge::Ats::Url.from_json(json_object: item) end = parsed_json["tags"] applications = parsed_json["applications"]&.map do |item| item = item.to_json Merge::Ats::CandidateApplicationsItem.from_json(json_object: item) end = parsed_json["attachments"]&.map do |item| item = item.to_json Merge::Ats::CandidateAttachmentsItem.from_json(json_object: item) end remote_was_deleted = parsed_json["remote_was_deleted"] field_mappings = parsed_json["field_mappings"] remote_data = parsed_json["remote_data"]&.map do |item| item = item.to_json Merge::Ats::RemoteData.from_json(json_object: item) end new( id: id, remote_id: remote_id, created_at: created_at, modified_at: modified_at, first_name: first_name, last_name: last_name, company: company, title: title, remote_created_at: remote_created_at, remote_updated_at: remote_updated_at, last_interaction_at: last_interaction_at, is_private: is_private, can_email: can_email, locations: locations, phone_numbers: phone_numbers, email_addresses: email_addresses, urls: urls, tags: , applications: applications, attachments: , remote_was_deleted: remote_was_deleted, field_mappings: field_mappings, remote_data: remote_data, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 253 def self.validate_raw(obj:) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.remote_id&.is_a?(String) != false || raise("Passed value for field obj.remote_id is not the expected type, validation failed.") obj.created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.modified_at&.is_a?(DateTime) != false || raise("Passed value for field obj.modified_at is not the expected type, validation failed.") obj.first_name&.is_a?(String) != false || raise("Passed value for field obj.first_name is not the expected type, validation failed.") obj.last_name&.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.") obj.company&.is_a?(String) != false || raise("Passed value for field obj.company is not the expected type, validation failed.") obj.title&.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.") obj.remote_created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.remote_created_at is not the expected type, validation failed.") obj.remote_updated_at&.is_a?(DateTime) != false || raise("Passed value for field obj.remote_updated_at is not the expected type, validation failed.") obj.last_interaction_at&.is_a?(DateTime) != false || raise("Passed value for field obj.last_interaction_at is not the expected type, validation failed.") obj.is_private&.is_a?(Boolean) != false || raise("Passed value for field obj.is_private is not the expected type, validation failed.") obj.can_email&.is_a?(Boolean) != false || raise("Passed value for field obj.can_email is not the expected type, validation failed.") obj.locations&.is_a?(Array) != false || raise("Passed value for field obj.locations is not the expected type, validation failed.") obj.phone_numbers&.is_a?(Array) != false || raise("Passed value for field obj.phone_numbers is not the expected type, validation failed.") obj.email_addresses&.is_a?(Array) != false || raise("Passed value for field obj.email_addresses is not the expected type, validation failed.") obj.urls&.is_a?(Array) != false || raise("Passed value for field obj.urls is not the expected type, validation failed.") obj.&.is_a?(Array) != false || raise("Passed value for field obj.tags is not the expected type, validation failed.") obj.applications&.is_a?(Array) != false || raise("Passed value for field obj.applications is not the expected type, validation failed.") obj.&.is_a?(Array) != false || raise("Passed value for field obj.attachments is not the expected type, validation failed.") obj.remote_was_deleted&.is_a?(Boolean) != false || raise("Passed value for field obj.remote_was_deleted is not the expected type, validation failed.") obj.field_mappings&.is_a?(Hash) != false || raise("Passed value for field obj.field_mappings is not the expected type, validation failed.") obj.remote_data&.is_a?(Array) != false || raise("Passed value for field obj.remote_data is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Candidate to a JSON object
243 244 245 |
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 243 def to_json(*_args) @_field_set&.to_json end |