Class: Merge::Ats::Candidate

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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

Parameters:

  • id (String) (defaults to: OMIT)
  • remote_id (String) (defaults to: OMIT)

    The third-party API ID of the matching object.

  • created_at (DateTime) (defaults to: OMIT)

    The datetime that this object was created by Merge.

  • modified_at (DateTime) (defaults to: OMIT)

    The datetime that this object was modified by Merge.

  • first_name (String) (defaults to: OMIT)

    The candidate’s first name.

  • last_name (String) (defaults to: OMIT)

    The candidate’s last name.

  • company (String) (defaults to: OMIT)

    The candidate’s current company.

  • title (String) (defaults to: OMIT)

    The candidate’s current title.

  • remote_created_at (DateTime) (defaults to: OMIT)

    When the third party’s candidate was created.

  • remote_updated_at (DateTime) (defaults to: OMIT)

    When the third party’s candidate was updated.

  • last_interaction_at (DateTime) (defaults to: OMIT)

    When the most recent interaction with the candidate occurred.

  • is_private (Boolean) (defaults to: OMIT)

    Whether or not the candidate is private.

  • can_email (Boolean) (defaults to: OMIT)

    Whether or not the candidate can be emailed.

  • locations (Array<String>) (defaults to: OMIT)

    The candidate’s locations.

  • phone_numbers (Array<Merge::Ats::PhoneNumber>) (defaults to: OMIT)
  • email_addresses (Array<Merge::Ats::EmailAddress>) (defaults to: OMIT)
  • urls (Array<Merge::Ats::Url>) (defaults to: OMIT)
  • tags (Array<String>) (defaults to: OMIT)

    Array of ‘Tag` names as strings.

  • applications (Array<Merge::Ats::CandidateApplicationsItem>) (defaults to: OMIT)

    Array of ‘Application` object IDs.

  • attachments (Array<Merge::Ats::CandidateAttachmentsItem>) (defaults to: OMIT)

    Array of ‘Attachment` object IDs.

  • remote_was_deleted (Boolean) (defaults to: OMIT)
  • field_mappings (Hash{String => Object}) (defaults to: OMIT)
  • remote_data (Array<Merge::Ats::RemoteData>) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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 = tags if tags != OMIT
  @applications = applications if applications != OMIT
  @attachments = attachments if attachments != 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": tags,
    "applications": applications,
    "attachments": 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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#applicationsArray<Merge::Ats::CandidateApplicationsItem> (readonly)

Returns Array of ‘Application` object IDs.

Returns:



61
62
63
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 61

def applications
  @applications
end

#attachmentsArray<Merge::Ats::CandidateAttachmentsItem> (readonly)

Returns Array of ‘Attachment` object IDs.

Returns:



63
64
65
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 63

def attachments
  @attachments
end

#can_emailBoolean (readonly)

Returns Whether or not the candidate can be emailed.

Returns:

  • (Boolean)

    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

#companyString (readonly)

Returns The candidate’s current company.

Returns:

  • (String)

    The candidate’s current company.



37
38
39
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 37

def company
  @company
end

#created_atDateTime (readonly)

Returns The datetime that this object was created by Merge.

Returns:

  • (DateTime)

    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_addressesArray<Merge::Ats::EmailAddress> (readonly)

Returns:



55
56
57
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 55

def email_addresses
  @email_addresses
end

#field_mappingsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


67
68
69
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 67

def field_mappings
  @field_mappings
end

#first_nameString (readonly)

Returns The candidate’s first name.

Returns:

  • (String)

    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

#idString (readonly)

Returns:

  • (String)


25
26
27
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 25

def id
  @id
end

#is_privateBoolean (readonly)

Returns Whether or not the candidate is private.

Returns:

  • (Boolean)

    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_atDateTime (readonly)

Returns When the most recent interaction with the candidate occurred.

Returns:

  • (DateTime)

    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_nameString (readonly)

Returns The candidate’s last name.

Returns:

  • (String)

    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

#locationsArray<String> (readonly)

Returns The candidate’s locations.

Returns:

  • (Array<String>)

    The candidate’s locations.



51
52
53
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 51

def locations
  @locations
end

#modified_atDateTime (readonly)

Returns The datetime that this object was modified by Merge.

Returns:

  • (DateTime)

    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_numbersArray<Merge::Ats::PhoneNumber> (readonly)

Returns:



53
54
55
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 53

def phone_numbers
  @phone_numbers
end

#remote_created_atDateTime (readonly)

Returns When the third party’s candidate was created.

Returns:

  • (DateTime)

    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_dataArray<Merge::Ats::RemoteData> (readonly)

Returns:



69
70
71
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 69

def remote_data
  @remote_data
end

#remote_idString (readonly)

Returns The third-party API ID of the matching object.

Returns:

  • (String)

    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_atDateTime (readonly)

Returns When the third party’s candidate was updated.

Returns:

  • (DateTime)

    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_deletedBoolean (readonly)

Returns:

  • (Boolean)


65
66
67
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 65

def remote_was_deleted
  @remote_was_deleted
end

#tagsArray<String> (readonly)

Returns Array of ‘Tag` names as strings.

Returns:

  • (Array<String>)

    Array of ‘Tag` names as strings.



59
60
61
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 59

def tags
  @tags
end

#titleString (readonly)

Returns The candidate’s current title.

Returns:

  • (String)

    The candidate’s current title.



39
40
41
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 39

def title
  @title
end

#urlsArray<Merge::Ats::Url> (readonly)

Returns:



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

Parameters:

  • json_object (String)

Returns:



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
  tags = parsed_json["tags"]
  applications = parsed_json["applications"]&.map do |item|
    item = item.to_json
    Merge::Ats::CandidateApplicationsItem.from_json(json_object: item)
  end
  attachments = 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: tags,
    applications: applications,
    attachments: 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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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.tags&.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.attachments&.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

Returns:

  • (String)


243
244
245
# File 'lib/merge_ruby_client/ats/types/candidate.rb', line 243

def to_json(*_args)
  @_field_set&.to_json
end