Class: Merge::Ats::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ats/types/application.rb

Overview

# The Application Object

### Description
The Application Object is used to represent a candidate's journey through a
particular Job's recruiting process. If a Candidate applies for multiple Jobs,
there will be a separate Application for each Job if the third-party integration
allows it.
### Usage Example
Fetch from the `LIST Applications` endpoint and filter by `ID` to show all
applications.

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, candidate: OMIT, job: OMIT, applied_at: OMIT, rejected_at: OMIT, offers: OMIT, source: OMIT, credited_to: OMIT, screening_question_answers: OMIT, current_stage: OMIT, reject_reason: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) ⇒ Merge::Ats::Application



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
126
127
128
129
130
131
132
133
134
135
# File 'lib/merge_ruby_client/ats/types/application.rb', line 94

def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, candidate: OMIT, job: OMIT,
               applied_at: OMIT, rejected_at: OMIT, offers: OMIT, source: OMIT, credited_to: OMIT, screening_question_answers: OMIT, current_stage: OMIT, reject_reason: 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
  @candidate = candidate if candidate != OMIT
  @job = job if job != OMIT
  @applied_at = applied_at if applied_at != OMIT
  @rejected_at = rejected_at if rejected_at != OMIT
  @offers = offers if offers != OMIT
  @source = source if source != OMIT
  @credited_to = credited_to if credited_to != OMIT
  @screening_question_answers = screening_question_answers if screening_question_answers != OMIT
  @current_stage = current_stage if current_stage != OMIT
  @reject_reason = reject_reason if reject_reason != 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,
    "candidate": candidate,
    "job": job,
    "applied_at": applied_at,
    "rejected_at": rejected_at,
    "offers": offers,
    "source": source,
    "credited_to": credited_to,
    "screening_question_answers": screening_question_answers,
    "current_stage": current_stage,
    "reject_reason": reject_reason,
    "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)



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

def additional_properties
  @additional_properties
end

#applied_atDateTime (readonly)



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

def applied_at
  @applied_at
end

#candidateMerge::Ats::ApplicationCandidate (readonly)



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

def candidate
  @candidate
end

#created_atDateTime (readonly)



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

def created_at
  @created_at
end

#credited_toMerge::Ats::ApplicationCreditedTo (readonly)



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

def credited_to
  @credited_to
end

#current_stageMerge::Ats::ApplicationCurrentStage (readonly)



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

def current_stage
  @current_stage
end

#field_mappingsHash{String => Object} (readonly)



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

def field_mappings
  @field_mappings
end

#idString (readonly)



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

def id
  @id
end

#jobMerge::Ats::ApplicationJob (readonly)



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

def job
  @job
end

#modified_atDateTime (readonly)



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

def modified_at
  @modified_at
end

#offersArray<Merge::Ats::ApplicationOffersItem> (readonly)



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

def offers
  @offers
end

#reject_reasonMerge::Ats::ApplicationRejectReason (readonly)



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

def reject_reason
  @reject_reason
end

#rejected_atDateTime (readonly)



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

def rejected_at
  @rejected_at
end

#remote_dataArray<Merge::Ats::RemoteData> (readonly)



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

def remote_data
  @remote_data
end

#remote_idString (readonly)



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

def remote_id
  @remote_id
end

#remote_was_deletedBoolean (readonly)



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

def remote_was_deleted
  @remote_was_deleted
end

#screening_question_answersArray<Merge::Ats::ApplicationScreeningQuestionAnswersItem> (readonly)



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

def screening_question_answers
  @screening_question_answers
end

#sourceString (readonly)



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

def source
  @source
end

Class Method Details

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

Deserialize a JSON object to an instance of Application



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

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?)
  if parsed_json["candidate"].nil?
    candidate = nil
  else
    candidate = parsed_json["candidate"].to_json
    candidate = Merge::Ats::ApplicationCandidate.from_json(json_object: candidate)
  end
  if parsed_json["job"].nil?
    job = nil
  else
    job = parsed_json["job"].to_json
    job = Merge::Ats::ApplicationJob.from_json(json_object: job)
  end
  applied_at = (DateTime.parse(parsed_json["applied_at"]) unless parsed_json["applied_at"].nil?)
  rejected_at = (DateTime.parse(parsed_json["rejected_at"]) unless parsed_json["rejected_at"].nil?)
  offers = parsed_json["offers"]&.map do |item|
    item = item.to_json
    Merge::Ats::ApplicationOffersItem.from_json(json_object: item)
  end
  source = parsed_json["source"]
  if parsed_json["credited_to"].nil?
    credited_to = nil
  else
    credited_to = parsed_json["credited_to"].to_json
    credited_to = Merge::Ats::ApplicationCreditedTo.from_json(json_object: credited_to)
  end
  screening_question_answers = parsed_json["screening_question_answers"]&.map do |item|
    item = item.to_json
    Merge::Ats::ApplicationScreeningQuestionAnswersItem.from_json(json_object: item)
  end
  if parsed_json["current_stage"].nil?
    current_stage = nil
  else
    current_stage = parsed_json["current_stage"].to_json
    current_stage = Merge::Ats::ApplicationCurrentStage.from_json(json_object: current_stage)
  end
  if parsed_json["reject_reason"].nil?
    reject_reason = nil
  else
    reject_reason = parsed_json["reject_reason"].to_json
    reject_reason = Merge::Ats::ApplicationRejectReason.from_json(json_object: reject_reason)
  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,
    candidate: candidate,
    job: job,
    applied_at: applied_at,
    rejected_at: rejected_at,
    offers: offers,
    source: source,
    credited_to: credited_to,
    screening_question_answers: screening_question_answers,
    current_stage: current_stage,
    reject_reason: reject_reason,
    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.


230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/merge_ruby_client/ats/types/application.rb', line 230

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.candidate.nil? || Merge::Ats::ApplicationCandidate.validate_raw(obj: obj.candidate)
  obj.job.nil? || Merge::Ats::ApplicationJob.validate_raw(obj: obj.job)
  obj.applied_at&.is_a?(DateTime) != false || raise("Passed value for field obj.applied_at is not the expected type, validation failed.")
  obj.rejected_at&.is_a?(DateTime) != false || raise("Passed value for field obj.rejected_at is not the expected type, validation failed.")
  obj.offers&.is_a?(Array) != false || raise("Passed value for field obj.offers is not the expected type, validation failed.")
  obj.source&.is_a?(String) != false || raise("Passed value for field obj.source is not the expected type, validation failed.")
  obj.credited_to.nil? || Merge::Ats::ApplicationCreditedTo.validate_raw(obj: obj.credited_to)
  obj.screening_question_answers&.is_a?(Array) != false || raise("Passed value for field obj.screening_question_answers is not the expected type, validation failed.")
  obj.current_stage.nil? || Merge::Ats::ApplicationCurrentStage.validate_raw(obj: obj.current_stage)
  obj.reject_reason.nil? || Merge::Ats::ApplicationRejectReason.validate_raw(obj: obj.reject_reason)
  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 Application to a JSON object



220
221
222
# File 'lib/merge_ruby_client/ats/types/application.rb', line 220

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