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

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.

  • candidate (Merge::Ats::ApplicationCandidate) (defaults to: OMIT)

    The candidate applying.

  • job (Merge::Ats::ApplicationJob) (defaults to: OMIT)

    The job being applied for.

  • applied_at (DateTime) (defaults to: OMIT)

    When the application was submitted.

  • rejected_at (DateTime) (defaults to: OMIT)

    When the application was rejected.

  • offers (Array<Merge::Ats::ApplicationOffersItem>) (defaults to: OMIT)
  • source (String) (defaults to: OMIT)

    The application’s source.

  • credited_to (Merge::Ats::ApplicationCreditedTo) (defaults to: OMIT)

    The user credited for this application.

  • screening_question_answers (Array<Merge::Ats::ApplicationScreeningQuestionAnswersItem>) (defaults to: OMIT)
  • current_stage (Merge::Ats::ApplicationCurrentStage) (defaults to: OMIT)

    The application’s current stage.

  • reject_reason (Merge::Ats::ApplicationRejectReason) (defaults to: OMIT)

    The application’s reason for rejection.

  • 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



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
126
127
128
129
# File 'lib/merge_ruby_client/ats/types/application.rb', line 88

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)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#applied_atDateTime (readonly)

Returns When the application was submitted.

Returns:

  • (DateTime)

    When the application was submitted.



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

def applied_at
  @applied_at
end

#candidateMerge::Ats::ApplicationCandidate (readonly)

Returns The candidate applying.

Returns:



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

def candidate
  @candidate
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.



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)

Returns The user credited for this application.

Returns:



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)

Returns The application’s current stage.

Returns:



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)

Returns:

  • (Hash{String => Object})


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

def field_mappings
  @field_mappings
end

#idString (readonly)

Returns:

  • (String)


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

def id
  @id
end

#jobMerge::Ats::ApplicationJob (readonly)

Returns The job being applied for.

Returns:



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

def job
  @job
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.



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)

Returns The application’s reason for rejection.

Returns:



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

def reject_reason
  @reject_reason
end

#rejected_atDateTime (readonly)

Returns When the application was rejected.

Returns:

  • (DateTime)

    When the application was rejected.



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)

Returns:



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

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.



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

def remote_id
  @remote_id
end

#remote_was_deletedBoolean (readonly)

Returns:

  • (Boolean)


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

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)

Returns The application’s source.

Returns:

  • (String)

    The application’s source.



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

Parameters:

  • json_object (String)

Returns:



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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/merge_ruby_client/ats/types/application.rb', line 135

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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/merge_ruby_client/ats/types/application.rb', line 224

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

Returns:

  • (String)


214
215
216
# File 'lib/merge_ruby_client/ats/types/application.rb', line 214

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