Class: Merge::Ats::Eeoc

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

Overview

# The EEOC Object

### Description
The `EEOC` object is used to represent the Equal Employment Opportunity
Commission information for a candidate (race, gender, veteran status, disability
status).
### Usage Example
Fetch from the `LIST EEOCs` endpoint and filter by `candidate` to show all EEOC
information for a candidate.

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, submitted_at: OMIT, race: OMIT, gender: OMIT, veteran_status: OMIT, disability_status: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) ⇒ Merge::Ats::Eeoc



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

def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, candidate: OMIT,
               submitted_at: OMIT, race: OMIT, gender: OMIT, veteran_status: OMIT, disability_status: 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
  @submitted_at =  if  != OMIT
  @race = race if race != OMIT
  @gender = gender if gender != OMIT
  @veteran_status = veteran_status if veteran_status != OMIT
  @disability_status = disability_status if disability_status != 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,
    "submitted_at": ,
    "race": race,
    "gender": gender,
    "veteran_status": veteran_status,
    "disability_status": disability_status,
    "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)



76
77
78
# File 'lib/merge_ruby_client/ats/types/eeoc.rb', line 76

def additional_properties
  @additional_properties
end

#candidateMerge::Ats::EeocCandidate (readonly)



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

def candidate
  @candidate
end

#created_atDateTime (readonly)



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

def created_at
  @created_at
end

#disability_statusMerge::Ats::DisabilityStatusEnum (readonly)



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

def disability_status
  @disability_status
end

#field_mappingsHash{String => Object} (readonly)



72
73
74
# File 'lib/merge_ruby_client/ats/types/eeoc.rb', line 72

def field_mappings
  @field_mappings
end

#genderMerge::Ats::GenderEnum (readonly)



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

def gender
  @gender
end

#idString (readonly)



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

def id
  @id
end

#modified_atDateTime (readonly)



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

def modified_at
  @modified_at
end

#raceMerge::Ats::RaceEnum (readonly)



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

def race
  @race
end

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



74
75
76
# File 'lib/merge_ruby_client/ats/types/eeoc.rb', line 74

def remote_data
  @remote_data
end

#remote_idString (readonly)



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

def remote_id
  @remote_id
end

#remote_was_deletedBoolean (readonly)



70
71
72
# File 'lib/merge_ruby_client/ats/types/eeoc.rb', line 70

def remote_was_deleted
  @remote_was_deleted
end

#submitted_atDateTime (readonly)



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

def 
  @submitted_at
end

#veteran_statusMerge::Ats::VeteranStatusEnum (readonly)



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

def veteran_status
  @veteran_status
end

Class Method Details

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

Deserialize a JSON object to an instance of Eeoc



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

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::EeocCandidate.from_json(json_object: candidate)
  end
   = (DateTime.parse(parsed_json["submitted_at"]) unless parsed_json["submitted_at"].nil?)
  race = parsed_json["race"]
  gender = parsed_json["gender"]
  veteran_status = parsed_json["veteran_status"]
  disability_status = parsed_json["disability_status"]
  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,
    submitted_at: ,
    race: race,
    gender: gender,
    veteran_status: veteran_status,
    disability_status: disability_status,
    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.


217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/merge_ruby_client/ats/types/eeoc.rb', line 217

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::EeocCandidate.validate_raw(obj: obj.candidate)
  obj.&.is_a?(DateTime) != false || raise("Passed value for field obj.submitted_at is not the expected type, validation failed.")
  obj.race&.is_a?(Merge::Ats::RaceEnum) != false || raise("Passed value for field obj.race is not the expected type, validation failed.")
  obj.gender&.is_a?(Merge::Ats::GenderEnum) != false || raise("Passed value for field obj.gender is not the expected type, validation failed.")
  obj.veteran_status&.is_a?(Merge::Ats::VeteranStatusEnum) != false || raise("Passed value for field obj.veteran_status is not the expected type, validation failed.")
  obj.disability_status&.is_a?(Merge::Ats::DisabilityStatusEnum) != false || raise("Passed value for field obj.disability_status 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 Eeoc to a JSON object



207
208
209
# File 'lib/merge_ruby_client/ats/types/eeoc.rb', line 207

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