Class: Merge::Ats::ApplicationRequest

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

Parameters:



75
76
77
78
79
80
81
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
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 75

def initialize(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_template_id: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil)
  @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_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 = {
    "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_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



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

def additional_properties
  @additional_properties
end

#applied_atDateTime (readonly)

Returns When the application was submitted.

Returns:

  • (DateTime)

    When the application was submitted.



31
32
33
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 31

def applied_at
  @applied_at
end

#candidateMerge::Ats::ApplicationRequestCandidate (readonly)

Returns The candidate applying.

Returns:



27
28
29
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 27

def candidate
  @candidate
end

#credited_toMerge::Ats::ApplicationRequestCreditedTo (readonly)

Returns The user credited for this application.

Returns:



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

def credited_to
  @credited_to
end

#current_stageMerge::Ats::ApplicationRequestCurrentStage (readonly)

Returns The application’s current stage.

Returns:



43
44
45
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 43

def current_stage
  @current_stage
end

#integration_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


49
50
51
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 49

def integration_params
  @integration_params
end

#jobMerge::Ats::ApplicationRequestJob (readonly)

Returns The job being applied for.

Returns:



29
30
31
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 29

def job
  @job
end

#linked_account_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


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

def 
  @linked_account_params
end

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



35
36
37
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 35

def offers
  @offers
end

#reject_reasonMerge::Ats::ApplicationRequestRejectReason (readonly)

Returns The application’s reason for rejection.

Returns:



45
46
47
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 45

def reject_reason
  @reject_reason
end

#rejected_atDateTime (readonly)

Returns When the application was rejected.

Returns:

  • (DateTime)

    When the application was rejected.



33
34
35
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 33

def rejected_at
  @rejected_at
end

#remote_template_idString (readonly)

Returns:

  • (String)


47
48
49
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 47

def remote_template_id
  @remote_template_id
end

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



41
42
43
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 41

def screening_question_answers
  @screening_question_answers
end

#sourceString (readonly)

Returns The application’s source.

Returns:

  • (String)

    The application’s source.



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

def source
  @source
end

Class Method Details

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

Deserialize a JSON object to an instance of ApplicationRequest

Parameters:

  • json_object (String)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["candidate"].nil?
    candidate = nil
  else
    candidate = parsed_json["candidate"].to_json
    candidate = Merge::Ats::ApplicationRequestCandidate.from_json(json_object: candidate)
  end
  if parsed_json["job"].nil?
    job = nil
  else
    job = parsed_json["job"].to_json
    job = Merge::Ats::ApplicationRequestJob.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::ApplicationRequestOffersItem.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::ApplicationRequestCreditedTo.from_json(json_object: credited_to)
  end
  screening_question_answers = parsed_json["screening_question_answers"]&.map do |item|
    item = item.to_json
    Merge::Ats::ApplicationRequestScreeningQuestionAnswersItem.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::ApplicationRequestCurrentStage.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::ApplicationRequestRejectReason.from_json(json_object: reject_reason)
  end
  remote_template_id = parsed_json["remote_template_id"]
  integration_params = parsed_json["integration_params"]
   = parsed_json["linked_account_params"]
  new(
    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_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)


192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 192

def self.validate_raw(obj:)
  obj.candidate.nil? || Merge::Ats::ApplicationRequestCandidate.validate_raw(obj: obj.candidate)
  obj.job.nil? || Merge::Ats::ApplicationRequestJob.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::ApplicationRequestCreditedTo.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::ApplicationRequestCurrentStage.validate_raw(obj: obj.current_stage)
  obj.reject_reason.nil? || Merge::Ats::ApplicationRequestRejectReason.validate_raw(obj: obj.reject_reason)
  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 ApplicationRequest to a JSON object

Returns:

  • (String)


182
183
184
# File 'lib/merge_ruby_client/ats/types/application_request.rb', line 182

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