Class: Merge::Ats::PatchedCandidateRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ats/types/patched_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::PatchedCandidateRequest



82
83
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
# File 'lib/merge_ruby_client/ats/types/patched_candidate_request.rb', line 82

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)



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

def additional_properties
  @additional_properties
end

#applicationsArray<String> (readonly)



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

def applications
  @applications
end

#attachmentsArray<String> (readonly)



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

def attachments
  @attachments
end

#can_emailBoolean (readonly)



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

def can_email
  @can_email
end

#companyString (readonly)



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

def company
  @company
end

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



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

def email_addresses
  @email_addresses
end

#first_nameString (readonly)



22
23
24
# File 'lib/merge_ruby_client/ats/types/patched_candidate_request.rb', line 22

def first_name
  @first_name
end

#integration_paramsHash{String => Object} (readonly)



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

def integration_params
  @integration_params
end

#is_privateBoolean (readonly)



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

def is_private
  @is_private
end

#last_interaction_atDateTime (readonly)



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

def last_interaction_at
  @last_interaction_at
end

#last_nameString (readonly)



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

def last_name
  @last_name
end

#linked_account_paramsHash{String => Object} (readonly)



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

def 
  @linked_account_params
end

#locationsArray<String> (readonly)



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

def locations
  @locations
end

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



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

def phone_numbers
  @phone_numbers
end

#remote_template_idString (readonly)



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

def remote_template_id
  @remote_template_id
end

#tagsArray<String> (readonly)



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

def tags
  @tags
end

#titleString (readonly)



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

def title
  @title
end

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



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

def urls
  @urls
end

Class Method Details

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

Deserialize a JSON object to an instance of PatchedCandidateRequest



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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/merge_ruby_client/ats/types/patched_candidate_request.rb', line 129

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"]
  attachments = parsed_json["attachments"]
  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.


195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/merge_ruby_client/ats/types/patched_candidate_request.rb', line 195

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 PatchedCandidateRequest to a JSON object



185
186
187
# File 'lib/merge_ruby_client/ats/types/patched_candidate_request.rb', line 185

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