Class: Merge::Ats::JobPosting

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

Overview

# The JobPosting Object

### Description
The `JobPosting` object represents an external announcement on a job board
created by an organization to attract qualified candidates to apply for a
specific `Job` opening
### Usage Example
Fetch from the `LIST JobPostings` 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, title: OMIT, job_posting_urls: OMIT, job: OMIT, status: OMIT, content: OMIT, remote_created_at: OMIT, remote_updated_at: OMIT, is_internal: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) ⇒ Merge::Ats::JobPosting

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.

  • title (String) (defaults to: OMIT)

    The job posting’s title.

  • job_posting_urls (Array<Merge::Ats::JobPostingJobPostingUrlsItem>) (defaults to: OMIT)

    The Url object is used to represent hyperlinks for a candidate to apply to a given job.

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

    ID of ‘Job` object for this `JobPosting`.

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

    The job posting’s status.

    • ‘PUBLISHED` - PUBLISHED

    • ‘CLOSED` - CLOSED

    • ‘DRAFT` - DRAFT

    • ‘INTERNAL` - INTERNAL

    • ‘PENDING` - PENDING

  • content (String) (defaults to: OMIT)

    The job posting’s content.

  • remote_created_at (DateTime) (defaults to: OMIT)

    When the third party’s job posting was created.

  • remote_updated_at (DateTime) (defaults to: OMIT)

    When the third party’s job posting was updated.

  • is_internal (Boolean) (defaults to: OMIT)

    Indicates whether the job posting is internal or external.

  • 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



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

def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, title: OMIT,
               job_posting_urls: OMIT, job: OMIT, status: OMIT, content: OMIT, remote_created_at: OMIT, remote_updated_at: OMIT, is_internal: 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
  @title = title if title != OMIT
  @job_posting_urls = job_posting_urls if job_posting_urls != OMIT
  @job = job if job != OMIT
  @status = status if status != OMIT
  @content = content if content != OMIT
  @remote_created_at = remote_created_at if remote_created_at != OMIT
  @remote_updated_at = remote_updated_at if remote_updated_at != OMIT
  @is_internal = is_internal if is_internal != 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,
    "title": title,
    "job_posting_urls": job_posting_urls,
    "job": job,
    "status": status,
    "content": content,
    "remote_created_at": remote_created_at,
    "remote_updated_at": remote_updated_at,
    "is_internal": is_internal,
    "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



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

def additional_properties
  @additional_properties
end

#contentString (readonly)

Returns The job posting’s content.

Returns:

  • (String)

    The job posting’s content.



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

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



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

def created_at
  @created_at
end

#field_mappingsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


55
56
57
# File 'lib/merge_ruby_client/ats/types/job_posting.rb', line 55

def field_mappings
  @field_mappings
end

#idString (readonly)

Returns:

  • (String)


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

def id
  @id
end

#is_internalBoolean (readonly)

Returns Indicates whether the job posting is internal or external.

Returns:

  • (Boolean)

    Indicates whether the job posting is internal or external.



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

def is_internal
  @is_internal
end

#jobMerge::Ats::JobPostingJob (readonly)

Returns ID of ‘Job` object for this `JobPosting`.

Returns:



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

def job
  @job
end

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

Returns The Url object is used to represent hyperlinks for a candidate to apply to a given job.

Returns:



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

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



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

def modified_at
  @modified_at
end

#remote_created_atDateTime (readonly)

Returns When the third party’s job posting was created.

Returns:

  • (DateTime)

    When the third party’s job posting was created.



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

def remote_created_at
  @remote_created_at
end

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

Returns:



57
58
59
# File 'lib/merge_ruby_client/ats/types/job_posting.rb', line 57

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.



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

def remote_id
  @remote_id
end

#remote_updated_atDateTime (readonly)

Returns When the third party’s job posting was updated.

Returns:

  • (DateTime)

    When the third party’s job posting was updated.



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

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.



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

def remote_was_deleted
  @remote_was_deleted
end

#statusMerge::Ats::JobPostingStatusEnum (readonly)

Returns The job posting’s status.

  • ‘PUBLISHED` - PUBLISHED

  • ‘CLOSED` - CLOSED

  • ‘DRAFT` - DRAFT

  • ‘INTERNAL` - INTERNAL

  • ‘PENDING` - PENDING.

Returns:

  • (Merge::Ats::JobPostingStatusEnum)

    The job posting’s status.

    • ‘PUBLISHED` - PUBLISHED

    • ‘CLOSED` - CLOSED

    • ‘DRAFT` - DRAFT

    • ‘INTERNAL` - INTERNAL

    • ‘PENDING` - PENDING



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

def status
  @status
end

#titleString (readonly)

Returns The job posting’s title.

Returns:

  • (String)

    The job posting’s title.



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

def title
  @title
end

Class Method Details

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

Deserialize a JSON object to an instance of JobPosting

Parameters:

  • json_object (String)

Returns:



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
181
182
183
184
# File 'lib/merge_ruby_client/ats/types/job_posting.rb', line 133

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?)
  title = parsed_json["title"]
  job_posting_urls = parsed_json["job_posting_urls"]&.map do |item|
    item = item.to_json
    Merge::Ats::JobPostingJobPostingUrlsItem.from_json(json_object: item)
  end
  if parsed_json["job"].nil?
    job = nil
  else
    job = parsed_json["job"].to_json
    job = Merge::Ats::JobPostingJob.from_json(json_object: job)
  end
  status = parsed_json["status"]
  content = parsed_json["content"]
  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
  is_internal = parsed_json["is_internal"]
  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,
    title: title,
    job_posting_urls: job_posting_urls,
    job: job,
    status: status,
    content: content,
    remote_created_at: remote_created_at,
    remote_updated_at: remote_updated_at,
    is_internal: is_internal,
    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)


199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/merge_ruby_client/ats/types/job_posting.rb', line 199

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.title&.is_a?(String) != false || raise("Passed value for field obj.title 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.job.nil? || Merge::Ats::JobPostingJob.validate_raw(obj: obj.job)
  obj.status&.is_a?(Merge::Ats::JobPostingStatusEnum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.content&.is_a?(String) != false || raise("Passed value for field obj.content 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.is_internal&.is_a?(Boolean) != false || raise("Passed value for field obj.is_internal 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 JobPosting to a JSON object

Returns:

  • (String)


189
190
191
# File 'lib/merge_ruby_client/ats/types/job_posting.rb', line 189

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