Class: Merge::Ats::CandidateRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ats/types/candidate_request.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(first_name: OMIT, last_name: OMIT, company: OMIT, title: 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_template_id: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Ats::CandidateRequest

Parameters:

  • 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.

  • 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::PhoneNumberRequest>) (defaults to: OMIT)
  • email_addresses (Array<Merge::Ats::EmailAddressRequest>) (defaults to: OMIT)
  • urls (Array<Merge::Ats::UrlRequest>) (defaults to: OMIT)
  • tags (Array<String>) (defaults to: OMIT)

    Array of ‘Tag` names as strings.

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

    Array of ‘Application` object IDs.

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

    Array of ‘Attachment` object IDs.

  • remote_template_id (String) (defaults to: OMIT)
  • integration_params (Hash{String => Object}) (defaults to: OMIT)
  • linked_account_params (Hash{String => Object}) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 84

def initialize(first_name: OMIT, last_name: OMIT, company: OMIT, title: 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_template_id: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil)
  @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
  @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_template_id = remote_template_id if remote_template_id != OMIT
  @integration_params = integration_params if integration_params != OMIT
  @linked_account_params =  if  != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "first_name": first_name,
    "last_name": last_name,
    "company": company,
    "title": title,
    "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_template_id": remote_template_id,
    "integration_params": integration_params,
    "linked_account_params": 
  }.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



58
59
60
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 58

def additional_properties
  @additional_properties
end

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

Returns Array of ‘Application` object IDs.

Returns:



48
49
50
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 48

def applications
  @applications
end

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

Returns Array of ‘Attachment` object IDs.

Returns:



50
51
52
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 50

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.



36
37
38
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 36

def can_email
  @can_email
end

#companyString (readonly)

Returns The candidate’s current company.

Returns:

  • (String)

    The candidate’s current company.



28
29
30
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 28

def company
  @company
end

#email_addressesArray<Merge::Ats::EmailAddressRequest> (readonly)



42
43
44
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 42

def email_addresses
  @email_addresses
end

#first_nameString (readonly)

Returns The candidate’s first name.

Returns:

  • (String)

    The candidate’s first name.



24
25
26
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 24

def first_name
  @first_name
end

#integration_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


54
55
56
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 54

def integration_params
  @integration_params
end

#is_privateBoolean (readonly)

Returns Whether or not the candidate is private.

Returns:

  • (Boolean)

    Whether or not the candidate is private.



34
35
36
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 34

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.



32
33
34
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 32

def last_interaction_at
  @last_interaction_at
end

#last_nameString (readonly)

Returns The candidate’s last name.

Returns:

  • (String)

    The candidate’s last name.



26
27
28
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 26

def last_name
  @last_name
end

#linked_account_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


56
57
58
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 56

def 
  @linked_account_params
end

#locationsArray<String> (readonly)

Returns The candidate’s locations.

Returns:

  • (Array<String>)

    The candidate’s locations.



38
39
40
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 38

def locations
  @locations
end

#phone_numbersArray<Merge::Ats::PhoneNumberRequest> (readonly)

Returns:



40
41
42
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 40

def phone_numbers
  @phone_numbers
end

#remote_template_idString (readonly)

Returns:

  • (String)


52
53
54
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 52

def remote_template_id
  @remote_template_id
end

#tagsArray<String> (readonly)

Returns Array of ‘Tag` names as strings.

Returns:

  • (Array<String>)

    Array of ‘Tag` names as strings.



46
47
48
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 46

def tags
  @tags
end

#titleString (readonly)

Returns The candidate’s current title.

Returns:

  • (String)

    The candidate’s current title.



30
31
32
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 30

def title
  @title
end

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

Returns:



44
45
46
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 44

def urls
  @urls
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Ats::CandidateRequest

Deserialize a JSON object to an instance of CandidateRequest

Parameters:

  • json_object (String)

Returns:



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
157
158
159
160
161
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
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 131

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  first_name = parsed_json["first_name"]
  last_name = parsed_json["last_name"]
  company = parsed_json["company"]
  title = parsed_json["title"]
  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::PhoneNumberRequest.from_json(json_object: item)
  end
  email_addresses = parsed_json["email_addresses"]&.map do |item|
    item = item.to_json
    Merge::Ats::EmailAddressRequest.from_json(json_object: item)
  end
  urls = parsed_json["urls"]&.map do |item|
    item = item.to_json
    Merge::Ats::UrlRequest.from_json(json_object: item)
  end
  tags = parsed_json["tags"]
  applications = parsed_json["applications"]&.map do |item|
    item = item.to_json
    Merge::Ats::CandidateRequestApplicationsItem.from_json(json_object: item)
  end
  attachments = parsed_json["attachments"]&.map do |item|
    item = item.to_json
    Merge::Ats::CandidateRequestAttachmentsItem.from_json(json_object: item)
  end
  remote_template_id = parsed_json["remote_template_id"]
  integration_params = parsed_json["integration_params"]
   = parsed_json["linked_account_params"]
  new(
    first_name: first_name,
    last_name: last_name,
    company: company,
    title: title,
    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_template_id: remote_template_id,
    integration_params: integration_params,
    linked_account_params: ,
    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)


203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 203

def self.validate_raw(obj:)
  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.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_template_id&.is_a?(String) != false || raise("Passed value for field obj.remote_template_id is not the expected type, validation failed.")
  obj.integration_params&.is_a?(Hash) != false || raise("Passed value for field obj.integration_params is not the expected type, validation failed.")
  obj.&.is_a?(Hash) != false || raise("Passed value for field obj.linked_account_params is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CandidateRequest to a JSON object

Returns:

  • (String)


193
194
195
# File 'lib/merge_ruby_client/ats/types/candidate_request.rb', line 193

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