Class: Merge::Ats::Job

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

Overview

# The Job Object

### Description
The `Job` object can be used to track any jobs that are currently or will be
open/closed for applications.
### Usage Example
Fetch from the `LIST Jobs` endpoint to show all job postings.

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, name: OMIT, description: OMIT, code: OMIT, status: OMIT, type: OMIT, job_postings: OMIT, job_posting_urls: OMIT, remote_created_at: OMIT, remote_updated_at: OMIT, confidential: OMIT, departments: OMIT, offices: OMIT, hiring_managers: OMIT, recruiters: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) ⇒ Merge::Ats::Job

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.

  • name (String) (defaults to: OMIT)

    The job’s name.

  • description (String) (defaults to: OMIT)

    The job’s description.

  • code (String) (defaults to: OMIT)

    The job’s code. Typically an additional identifier used to reference the particular job that is displayed on the ATS.

  • status (Merge::Ats::JobStatusEnum) (defaults to: OMIT)

    The job’s status.

    • ‘OPEN` - OPEN

    • ‘CLOSED` - CLOSED

    • ‘DRAFT` - DRAFT

    • ‘ARCHIVED` - ARCHIVED

    • ‘PENDING` - PENDING

  • type (Merge::Ats::JobTypeEnum) (defaults to: OMIT)

    The job’s type.

    • ‘POSTING` - POSTING

    • ‘REQUISITION` - REQUISITION

    • ‘PROFILE` - PROFILE

  • job_postings (Array<String>) (defaults to: OMIT)

    IDs of ‘JobPosting` objects that serve as job postings for this `Job`.

  • job_posting_urls (Array<Merge::Ats::Url>) (defaults to: OMIT)
  • remote_created_at (DateTime) (defaults to: OMIT)

    When the third party’s job was created.

  • remote_updated_at (DateTime) (defaults to: OMIT)

    When the third party’s job was updated.

  • confidential (Boolean) (defaults to: OMIT)

    Whether the job is confidential.

  • departments (Array<Merge::Ats::JobDepartmentsItem>) (defaults to: OMIT)

    IDs of ‘Department` objects for this `Job`.

  • offices (Array<Merge::Ats::JobOfficesItem>) (defaults to: OMIT)

    IDs of ‘Office` objects for this `Job`.

  • hiring_managers (Array<Merge::Ats::JobHiringManagersItem>) (defaults to: OMIT)

    IDs of ‘RemoteUser` objects that serve as hiring managers for this `Job`.

  • recruiters (Array<Merge::Ats::JobRecruitersItem>) (defaults to: OMIT)

    IDs of ‘RemoteUser` objects that serve as recruiters for this `Job`.

  • remote_was_deleted (Boolean) (defaults to: OMIT)

    Indicates whether or not this object has been deleted in the third party platform.

  • 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



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

def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, name: OMIT, description: OMIT,
               code: OMIT, status: OMIT, type: OMIT, job_postings: OMIT, job_posting_urls: OMIT, remote_created_at: OMIT, remote_updated_at: OMIT, confidential: OMIT, departments: OMIT, offices: OMIT, hiring_managers: OMIT, recruiters: 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
  @name = name if name != OMIT
  @description = description if description != OMIT
  @code = code if code != OMIT
  @status = status if status != OMIT
  @type = type if type != OMIT
  @job_postings = job_postings if job_postings != OMIT
  @job_posting_urls = job_posting_urls if job_posting_urls != OMIT
  @remote_created_at = remote_created_at if remote_created_at != OMIT
  @remote_updated_at = remote_updated_at if remote_updated_at != OMIT
  @confidential = confidential if confidential != OMIT
  @departments = departments if departments != OMIT
  @offices = offices if offices != OMIT
  @hiring_managers = hiring_managers if hiring_managers != OMIT
  @recruiters = recruiters if recruiters != 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,
    "name": name,
    "description": description,
    "code": code,
    "status": status,
    "type": type,
    "job_postings": job_postings,
    "job_posting_urls": job_posting_urls,
    "remote_created_at": remote_created_at,
    "remote_updated_at": remote_updated_at,
    "confidential": confidential,
    "departments": departments,
    "offices": offices,
    "hiring_managers": hiring_managers,
    "recruiters": recruiters,
    "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



77
78
79
# File 'lib/merge_ruby_client/ats/types/job.rb', line 77

def additional_properties
  @additional_properties
end

#codeString (readonly)

Returns The job’s code. Typically an additional identifier used to reference the particular job that is displayed on the ATS.

Returns:

  • (String)

    The job’s code. Typically an additional identifier used to reference the particular job that is displayed on the ATS.



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

def code
  @code
end

#confidentialBoolean (readonly)

Returns Whether the job is confidential.

Returns:

  • (Boolean)

    Whether the job is confidential.



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

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



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

def created_at
  @created_at
end

#departmentsArray<Merge::Ats::JobDepartmentsItem> (readonly)

Returns IDs of ‘Department` objects for this `Job`.

Returns:



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

def departments
  @departments
end

#descriptionString (readonly)

Returns The job’s description.

Returns:

  • (String)

    The job’s description.



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

def description
  @description
end

#field_mappingsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


73
74
75
# File 'lib/merge_ruby_client/ats/types/job.rb', line 73

def field_mappings
  @field_mappings
end

#hiring_managersArray<Merge::Ats::JobHiringManagersItem> (readonly)

Returns IDs of ‘RemoteUser` objects that serve as hiring managers for this `Job`.

Returns:



66
67
68
# File 'lib/merge_ruby_client/ats/types/job.rb', line 66

def hiring_managers
  @hiring_managers
end

#idString (readonly)

Returns:

  • (String)


25
26
27
# File 'lib/merge_ruby_client/ats/types/job.rb', line 25

def id
  @id
end

#job_posting_urlsArray<Merge::Ats::Url> (readonly)

Returns:



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

def job_posting_urls
  @job_posting_urls
end

#job_postingsArray<String> (readonly)

Returns IDs of ‘JobPosting` objects that serve as job postings for this `Job`.

Returns:

  • (Array<String>)

    IDs of ‘JobPosting` objects that serve as job postings for this `Job`.



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

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



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

def modified_at
  @modified_at
end

#nameString (readonly)

Returns The job’s name.

Returns:

  • (String)

    The job’s name.



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

def name
  @name
end

#officesArray<Merge::Ats::JobOfficesItem> (readonly)

Returns IDs of ‘Office` objects for this `Job`.

Returns:



64
65
66
# File 'lib/merge_ruby_client/ats/types/job.rb', line 64

def offices
  @offices
end

#recruitersArray<Merge::Ats::JobRecruitersItem> (readonly)

Returns IDs of ‘RemoteUser` objects that serve as recruiters for this `Job`.

Returns:



68
69
70
# File 'lib/merge_ruby_client/ats/types/job.rb', line 68

def recruiters
  @recruiters
end

#remote_created_atDateTime (readonly)

Returns When the third party’s job was created.

Returns:

  • (DateTime)

    When the third party’s job was created.



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

def remote_created_at
  @remote_created_at
end

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

Returns:



75
76
77
# File 'lib/merge_ruby_client/ats/types/job.rb', line 75

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.



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

def remote_id
  @remote_id
end

#remote_updated_atDateTime (readonly)

Returns When the third party’s job was updated.

Returns:

  • (DateTime)

    When the third party’s job was updated.



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

def remote_updated_at
  @remote_updated_at
end

#remote_was_deletedBoolean (readonly)

Returns Indicates whether or not this object has been deleted in the third party platform.

Returns:

  • (Boolean)

    Indicates whether or not this object has been deleted in the third party platform.



71
72
73
# File 'lib/merge_ruby_client/ats/types/job.rb', line 71

def remote_was_deleted
  @remote_was_deleted
end

#statusMerge::Ats::JobStatusEnum (readonly)

Returns The job’s status.

  • ‘OPEN` - OPEN

  • ‘CLOSED` - CLOSED

  • ‘DRAFT` - DRAFT

  • ‘ARCHIVED` - ARCHIVED

  • ‘PENDING` - PENDING.

Returns:

  • (Merge::Ats::JobStatusEnum)

    The job’s status.

    • ‘OPEN` - OPEN

    • ‘CLOSED` - CLOSED

    • ‘DRAFT` - DRAFT

    • ‘ARCHIVED` - ARCHIVED

    • ‘PENDING` - PENDING



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

def status
  @status
end

#typeMerge::Ats::JobTypeEnum (readonly)

Returns The job’s type.

  • ‘POSTING` - POSTING

  • ‘REQUISITION` - REQUISITION

  • ‘PROFILE` - PROFILE.

Returns:

  • (Merge::Ats::JobTypeEnum)

    The job’s type.

    • ‘POSTING` - POSTING

    • ‘REQUISITION` - REQUISITION

    • ‘PROFILE` - PROFILE



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

def type
  @type
end

Class Method Details

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

Deserialize a JSON object to an instance of Job

Parameters:

  • json_object (String)

Returns:



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
216
217
218
219
220
221
222
223
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/job.rb', line 172

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?)
  name = parsed_json["name"]
  description = parsed_json["description"]
  code = parsed_json["code"]
  status = parsed_json["status"]
  type = parsed_json["type"]
  job_postings = parsed_json["job_postings"]
  job_posting_urls = parsed_json["job_posting_urls"]&.map do |item|
    item = item.to_json
    Merge::Ats::Url.from_json(json_object: item)
  end
  remote_created_at = unless parsed_json["remote_created_at"].nil?
                        DateTime.parse(parsed_json["remote_created_at"])
                      end
  remote_updated_at = unless parsed_json["remote_updated_at"].nil?
                        DateTime.parse(parsed_json["remote_updated_at"])
                      end
  confidential = parsed_json["confidential"]
  departments = parsed_json["departments"]&.map do |item|
    item = item.to_json
    Merge::Ats::JobDepartmentsItem.from_json(json_object: item)
  end
  offices = parsed_json["offices"]&.map do |item|
    item = item.to_json
    Merge::Ats::JobOfficesItem.from_json(json_object: item)
  end
  hiring_managers = parsed_json["hiring_managers"]&.map do |item|
    item = item.to_json
    Merge::Ats::JobHiringManagersItem.from_json(json_object: item)
  end
  recruiters = parsed_json["recruiters"]&.map do |item|
    item = item.to_json
    Merge::Ats::JobRecruitersItem.from_json(json_object: item)
  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,
    name: name,
    description: description,
    code: code,
    status: status,
    type: type,
    job_postings: job_postings,
    job_posting_urls: job_posting_urls,
    remote_created_at: remote_created_at,
    remote_updated_at: remote_updated_at,
    confidential: confidential,
    departments: departments,
    offices: offices,
    hiring_managers: hiring_managers,
    recruiters: recruiters,
    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)


257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/merge_ruby_client/ats/types/job.rb', line 257

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.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.code&.is_a?(String) != false || raise("Passed value for field obj.code is not the expected type, validation failed.")
  obj.status&.is_a?(Merge::Ats::JobStatusEnum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.type&.is_a?(Merge::Ats::JobTypeEnum) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.job_postings&.is_a?(Array) != false || raise("Passed value for field obj.job_postings is not the expected type, validation failed.")
  obj.job_posting_urls&.is_a?(Array) != false || raise("Passed value for field obj.job_posting_urls is not the expected type, validation failed.")
  obj.remote_created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.remote_created_at is not the expected type, validation failed.")
  obj.remote_updated_at&.is_a?(DateTime) != false || raise("Passed value for field obj.remote_updated_at is not the expected type, validation failed.")
  obj.confidential&.is_a?(Boolean) != false || raise("Passed value for field obj.confidential is not the expected type, validation failed.")
  obj.departments&.is_a?(Array) != false || raise("Passed value for field obj.departments is not the expected type, validation failed.")
  obj.offices&.is_a?(Array) != false || raise("Passed value for field obj.offices is not the expected type, validation failed.")
  obj.hiring_managers&.is_a?(Array) != false || raise("Passed value for field obj.hiring_managers is not the expected type, validation failed.")
  obj.recruiters&.is_a?(Array) != false || raise("Passed value for field obj.recruiters is not the expected type, validation failed.")
  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 Job to a JSON object

Returns:

  • (String)


247
248
249
# File 'lib/merge_ruby_client/ats/types/job.rb', line 247

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