merge_ats_client 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -3
- data/docs/AccountToken.md +3 -1
- data/docs/ApplicationsApi.md +0 -82
- data/docs/Attachment.md +2 -0
- data/docs/AttachmentRequest.md +26 -0
- data/docs/AttachmentTypeEnum.md +15 -0
- data/docs/AttachmentsApi.md +80 -0
- data/docs/AvailableActions.md +1 -1
- data/docs/Candidate.md +2 -2
- data/docs/CandidateRequest.md +5 -1
- data/docs/InterviewsApi.md +80 -0
- data/docs/JobsApi.md +3 -1
- data/docs/ModelOperation.md +3 -1
- data/docs/PaginatedSyncStatusList.md +22 -0
- data/docs/RemoteUserRequest.md +30 -0
- data/docs/ScheduledInterviewRequest.md +38 -0
- data/docs/ScorecardRequest.md +30 -0
- data/docs/ScorecardsApi.md +80 -0
- data/docs/SyncStatus.md +1 -1
- data/docs/SyncStatusApi.md +89 -11
- data/docs/SyncStatusStatusEnum.md +15 -0
- data/docs/UsersApi.md +81 -0
- data/lib/merge_ats_client/api/applications_api.rb +0 -82
- data/lib/merge_ats_client/api/attachments_api.rb +76 -0
- data/lib/merge_ats_client/api/interviews_api.rb +76 -0
- data/lib/merge_ats_client/api/jobs_api.rb +7 -0
- data/lib/merge_ats_client/api/scorecards_api.rb +76 -0
- data/lib/merge_ats_client/api/sync_status_api.rb +78 -10
- data/lib/merge_ats_client/api/users_api.rb +79 -0
- data/lib/merge_ats_client/api_client.rb +1 -1
- data/lib/merge_ats_client/models/account_token.rb +18 -4
- data/lib/merge_ats_client/models/activity.rb +1 -1
- data/lib/merge_ats_client/models/application.rb +1 -1
- data/lib/merge_ats_client/models/attachment.rb +13 -2
- data/lib/merge_ats_client/models/attachment_request.rb +279 -0
- data/lib/merge_ats_client/models/attachment_type_enum.rb +39 -0
- data/lib/merge_ats_client/models/candidate.rb +1 -1
- data/lib/merge_ats_client/models/candidate_request.rb +26 -4
- data/lib/merge_ats_client/models/data_passthrough_request.rb +1 -0
- data/lib/merge_ats_client/models/eeoc.rb +1 -1
- data/lib/merge_ats_client/models/end_user_details_request.rb +1 -5
- data/lib/merge_ats_client/models/job.rb +1 -1
- data/lib/merge_ats_client/models/job_interview_stage.rb +1 -1
- data/lib/merge_ats_client/models/model_operation.rb +20 -4
- data/lib/merge_ats_client/models/offer.rb +1 -1
- data/lib/merge_ats_client/models/paginated_sync_status_list.rb +240 -0
- data/lib/merge_ats_client/models/remote_user_request.rb +302 -0
- data/lib/merge_ats_client/models/scheduled_interview.rb +1 -1
- data/lib/merge_ats_client/models/scheduled_interview_request.rb +331 -0
- data/lib/merge_ats_client/models/scorecard.rb +1 -1
- data/lib/merge_ats_client/models/scorecard_request.rb +287 -0
- data/lib/merge_ats_client/models/sync_status.rb +1 -1
- data/lib/merge_ats_client/models/sync_status_status_enum.rb +37 -0
- data/lib/merge_ats_client/version.rb +2 -2
- data/lib/merge_ats_client.rb +7 -3
- data/spec/api/delete_account_api_spec.rb +46 -0
- data/spec/api/generate_key_api_spec.rb +46 -0
- data/spec/api/issues_api_spec.rb +65 -0
- data/spec/models/attachment_request_spec.rb +58 -0
- data/spec/models/attachment_type_enum_spec.rb +28 -0
- data/spec/models/generate_remote_key_request_spec.rb +1 -1
- data/spec/models/issue_spec.rb +70 -0
- data/spec/models/issue_status_enum_spec.rb +28 -0
- data/spec/models/paginated_issue_list_spec.rb +46 -0
- data/spec/models/paginated_sync_status_list_spec.rb +46 -0
- data/spec/models/remote_data_request_spec.rb +40 -0
- data/spec/models/remote_user_request_spec.rb +70 -0
- data/spec/models/scheduled_interview_request_spec.rb +94 -0
- data/spec/models/scorecard_request_spec.rb +70 -0
- data/spec/models/sync_status_status_enum_spec.rb +28 -0
- data/test_ats.rb +13 -13
- data/test_signature.rb +2 -2
- metadata +44 -3
- data/merge_ats_client-1.0.0.gem +0 -0
@@ -0,0 +1,240 @@
|
|
1
|
+
=begin
|
2
|
+
#Merge ATS API
|
3
|
+
|
4
|
+
#The unified API for building rich integrations with multiple Applicant Tracking System platforms.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
Contact: hello@merge.dev
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.1.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MergeATSClient
|
17
|
+
class PaginatedSyncStatusList
|
18
|
+
attr_accessor :_next
|
19
|
+
|
20
|
+
attr_accessor :previous
|
21
|
+
|
22
|
+
attr_accessor :results
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'_next' => :'next',
|
28
|
+
:'previous' => :'previous',
|
29
|
+
:'results' => :'results'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'_next' => :'String',
|
42
|
+
:'previous' => :'String',
|
43
|
+
:'results' => :'Array<SyncStatus>'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
:'_next',
|
51
|
+
:'previous',
|
52
|
+
])
|
53
|
+
end
|
54
|
+
|
55
|
+
# Initializes the object
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
57
|
+
def initialize(attributes = {})
|
58
|
+
if (!attributes.is_a?(Hash))
|
59
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MergeATSClient::PaginatedSyncStatusList` initialize method"
|
60
|
+
end
|
61
|
+
|
62
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
63
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
64
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
65
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MergeATSClient::PaginatedSyncStatusList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
66
|
+
end
|
67
|
+
h[k.to_sym] = v
|
68
|
+
}
|
69
|
+
|
70
|
+
if attributes.key?(:'_next')
|
71
|
+
self._next = attributes[:'_next']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'previous')
|
75
|
+
self.previous = attributes[:'previous']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'results')
|
79
|
+
if (value = attributes[:'results']).is_a?(Array)
|
80
|
+
self.results = value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
86
|
+
# @return Array for valid properties with the reasons
|
87
|
+
def list_invalid_properties
|
88
|
+
invalid_properties = Array.new
|
89
|
+
invalid_properties
|
90
|
+
end
|
91
|
+
|
92
|
+
# Check to see if the all the properties in the model are valid
|
93
|
+
# @return true if the model is valid
|
94
|
+
def valid?
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
# Checks equality by comparing each attribute.
|
99
|
+
# @param [Object] Object to be compared
|
100
|
+
def ==(o)
|
101
|
+
return true if self.equal?(o)
|
102
|
+
self.class == o.class &&
|
103
|
+
_next == o._next &&
|
104
|
+
previous == o.previous &&
|
105
|
+
results == o.results
|
106
|
+
end
|
107
|
+
|
108
|
+
# @see the `==` method
|
109
|
+
# @param [Object] Object to be compared
|
110
|
+
def eql?(o)
|
111
|
+
self == o
|
112
|
+
end
|
113
|
+
|
114
|
+
# Calculates hash code according to all attributes.
|
115
|
+
# @return [Integer] Hash code
|
116
|
+
def hash
|
117
|
+
[_next, previous, results].hash
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def self.build_from_hash(attributes)
|
124
|
+
new.build_from_hash(attributes)
|
125
|
+
end
|
126
|
+
|
127
|
+
# Builds the object from hash
|
128
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
129
|
+
# @return [Object] Returns the model itself
|
130
|
+
def build_from_hash(attributes)
|
131
|
+
return nil unless attributes.is_a?(Hash)
|
132
|
+
self.class.openapi_types.each_pair do |key, type|
|
133
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
134
|
+
self.send("#{key}=", nil)
|
135
|
+
elsif type =~ /\AArray<(.*)>/i
|
136
|
+
# check to ensure the input is an array given that the attribute
|
137
|
+
# is documented as an array but the input is not
|
138
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
139
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
140
|
+
end
|
141
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
142
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
self
|
147
|
+
end
|
148
|
+
|
149
|
+
# Deserializes the data based on type
|
150
|
+
# @param string type Data type
|
151
|
+
# @param string value Value to be deserialized
|
152
|
+
# @return [Object] Deserialized data
|
153
|
+
def _deserialize(type, value)
|
154
|
+
case type.to_sym
|
155
|
+
when :Time
|
156
|
+
Time.parse(value)
|
157
|
+
when :Date
|
158
|
+
Date.parse(value)
|
159
|
+
when :String
|
160
|
+
value.to_s
|
161
|
+
when :Integer
|
162
|
+
value.to_i
|
163
|
+
when :Float
|
164
|
+
value.to_f
|
165
|
+
when :Boolean
|
166
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
167
|
+
true
|
168
|
+
else
|
169
|
+
false
|
170
|
+
end
|
171
|
+
when :Object
|
172
|
+
# generic object (usually a Hash), return directly
|
173
|
+
value
|
174
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
175
|
+
inner_type = Regexp.last_match[:inner_type]
|
176
|
+
value.map { |v| _deserialize(inner_type, v) }
|
177
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
178
|
+
k_type = Regexp.last_match[:k_type]
|
179
|
+
v_type = Regexp.last_match[:v_type]
|
180
|
+
{}.tap do |hash|
|
181
|
+
value.each do |k, v|
|
182
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
else # model
|
186
|
+
# models (e.g. Pet) or oneOf
|
187
|
+
klass = MergeATSClient.const_get(type)
|
188
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the string representation of the object
|
193
|
+
# @return [String] String presentation of the object
|
194
|
+
def to_s
|
195
|
+
to_hash.to_s
|
196
|
+
end
|
197
|
+
|
198
|
+
# to_body is an alias to to_hash (backward compatibility)
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
200
|
+
def to_body
|
201
|
+
to_hash
|
202
|
+
end
|
203
|
+
|
204
|
+
# Returns the object in the form of hash
|
205
|
+
# @return [Hash] Returns the object in the form of hash
|
206
|
+
def to_hash
|
207
|
+
hash = {}
|
208
|
+
self.class.attribute_map.each_pair do |attr, param|
|
209
|
+
value = self.send(attr)
|
210
|
+
if value.nil?
|
211
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
212
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
213
|
+
end
|
214
|
+
|
215
|
+
hash[param] = _to_hash(value)
|
216
|
+
end
|
217
|
+
hash
|
218
|
+
end
|
219
|
+
|
220
|
+
# Outputs non-array value in the form of hash
|
221
|
+
# For object, use to_hash. Otherwise, just return the value
|
222
|
+
# @param [Object] value Any valid value
|
223
|
+
# @return [Hash] Returns the value in the form of hash
|
224
|
+
def _to_hash(value)
|
225
|
+
if value.is_a?(Array)
|
226
|
+
value.compact.map { |v| _to_hash(v) }
|
227
|
+
elsif value.is_a?(Hash)
|
228
|
+
{}.tap do |hash|
|
229
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
230
|
+
end
|
231
|
+
elsif value.respond_to? :to_hash
|
232
|
+
value.to_hash
|
233
|
+
else
|
234
|
+
value
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
239
|
+
|
240
|
+
end
|
@@ -0,0 +1,302 @@
|
|
1
|
+
=begin
|
2
|
+
#Merge ATS API
|
3
|
+
|
4
|
+
#The unified API for building rich integrations with multiple Applicant Tracking System platforms.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
Contact: hello@merge.dev
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.1.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module MergeATSClient
|
17
|
+
# # The RemoteUser Object ### Description The `RemoteUser` object is used to represent a third party user. ### Usage Example Fetch from the `LIST RemoteUsers` endpoint to show all users for a third party.
|
18
|
+
class RemoteUserRequest
|
19
|
+
# The third-party API ID of the matching object.
|
20
|
+
attr_accessor :remote_id
|
21
|
+
|
22
|
+
# The user's first name.
|
23
|
+
attr_accessor :first_name
|
24
|
+
|
25
|
+
# The user's last name.
|
26
|
+
attr_accessor :last_name
|
27
|
+
|
28
|
+
# The user's email.
|
29
|
+
attr_accessor :email
|
30
|
+
|
31
|
+
# Whether the user's account had been disabled.
|
32
|
+
attr_accessor :disabled
|
33
|
+
|
34
|
+
# When the third party's user was created.
|
35
|
+
attr_accessor :remote_created_at
|
36
|
+
|
37
|
+
# The user's role.
|
38
|
+
attr_accessor :access_role
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'remote_id' => :'remote_id',
|
44
|
+
:'first_name' => :'first_name',
|
45
|
+
:'last_name' => :'last_name',
|
46
|
+
:'email' => :'email',
|
47
|
+
:'disabled' => :'disabled',
|
48
|
+
:'remote_created_at' => :'remote_created_at',
|
49
|
+
:'access_role' => :'access_role'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Returns all the JSON keys this model knows about
|
54
|
+
def self.acceptable_attributes
|
55
|
+
attribute_map.values
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute type mapping.
|
59
|
+
def self.openapi_types
|
60
|
+
{
|
61
|
+
:'remote_id' => :'String',
|
62
|
+
:'first_name' => :'String',
|
63
|
+
:'last_name' => :'String',
|
64
|
+
:'email' => :'String',
|
65
|
+
:'disabled' => :'Boolean',
|
66
|
+
:'remote_created_at' => :'Time',
|
67
|
+
:'access_role' => :'AccessRoleEnum'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# List of attributes with nullable: true
|
72
|
+
def self.openapi_nullable
|
73
|
+
Set.new([
|
74
|
+
:'remote_id',
|
75
|
+
:'first_name',
|
76
|
+
:'last_name',
|
77
|
+
:'email',
|
78
|
+
:'disabled',
|
79
|
+
:'remote_created_at',
|
80
|
+
:'access_role'
|
81
|
+
])
|
82
|
+
end
|
83
|
+
|
84
|
+
# Initializes the object
|
85
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
86
|
+
def initialize(attributes = {})
|
87
|
+
if (!attributes.is_a?(Hash))
|
88
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MergeATSClient::RemoteUserRequest` initialize method"
|
89
|
+
end
|
90
|
+
|
91
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
92
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
93
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
94
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MergeATSClient::RemoteUserRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
95
|
+
end
|
96
|
+
h[k.to_sym] = v
|
97
|
+
}
|
98
|
+
|
99
|
+
if attributes.key?(:'remote_id')
|
100
|
+
self.remote_id = attributes[:'remote_id']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'first_name')
|
104
|
+
self.first_name = attributes[:'first_name']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'last_name')
|
108
|
+
self.last_name = attributes[:'last_name']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'email')
|
112
|
+
self.email = attributes[:'email']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'disabled')
|
116
|
+
self.disabled = attributes[:'disabled']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'remote_created_at')
|
120
|
+
self.remote_created_at = attributes[:'remote_created_at']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'access_role')
|
124
|
+
self.access_role = attributes[:'access_role']
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
129
|
+
# @return Array for valid properties with the reasons
|
130
|
+
def list_invalid_properties
|
131
|
+
invalid_properties = Array.new
|
132
|
+
if !@email.nil? && @email.to_s.length > 254
|
133
|
+
invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 254.')
|
134
|
+
end
|
135
|
+
|
136
|
+
invalid_properties
|
137
|
+
end
|
138
|
+
|
139
|
+
# Check to see if the all the properties in the model are valid
|
140
|
+
# @return true if the model is valid
|
141
|
+
def valid?
|
142
|
+
return false if !@email.nil? && @email.to_s.length > 254
|
143
|
+
true
|
144
|
+
end
|
145
|
+
|
146
|
+
# Custom attribute writer method with validation
|
147
|
+
# @param [Object] email Value to be assigned
|
148
|
+
def email=(email)
|
149
|
+
if !email.nil? && email.to_s.length > 254
|
150
|
+
fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 254.'
|
151
|
+
end
|
152
|
+
|
153
|
+
@email = email
|
154
|
+
end
|
155
|
+
|
156
|
+
# Checks equality by comparing each attribute.
|
157
|
+
# @param [Object] Object to be compared
|
158
|
+
def ==(o)
|
159
|
+
return true if self.equal?(o)
|
160
|
+
self.class == o.class &&
|
161
|
+
remote_id == o.remote_id &&
|
162
|
+
first_name == o.first_name &&
|
163
|
+
last_name == o.last_name &&
|
164
|
+
email == o.email &&
|
165
|
+
disabled == o.disabled &&
|
166
|
+
remote_created_at == o.remote_created_at &&
|
167
|
+
access_role == o.access_role
|
168
|
+
end
|
169
|
+
|
170
|
+
# @see the `==` method
|
171
|
+
# @param [Object] Object to be compared
|
172
|
+
def eql?(o)
|
173
|
+
self == o
|
174
|
+
end
|
175
|
+
|
176
|
+
# Calculates hash code according to all attributes.
|
177
|
+
# @return [Integer] Hash code
|
178
|
+
def hash
|
179
|
+
[remote_id, first_name, last_name, email, disabled, remote_created_at, access_role].hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Builds the object from hash
|
183
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
184
|
+
# @return [Object] Returns the model itself
|
185
|
+
def self.build_from_hash(attributes)
|
186
|
+
new.build_from_hash(attributes)
|
187
|
+
end
|
188
|
+
|
189
|
+
# Builds the object from hash
|
190
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
191
|
+
# @return [Object] Returns the model itself
|
192
|
+
def build_from_hash(attributes)
|
193
|
+
return nil unless attributes.is_a?(Hash)
|
194
|
+
self.class.openapi_types.each_pair do |key, type|
|
195
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
196
|
+
self.send("#{key}=", nil)
|
197
|
+
elsif type =~ /\AArray<(.*)>/i
|
198
|
+
# check to ensure the input is an array given that the attribute
|
199
|
+
# is documented as an array but the input is not
|
200
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
201
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
202
|
+
end
|
203
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
204
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
self
|
209
|
+
end
|
210
|
+
|
211
|
+
# Deserializes the data based on type
|
212
|
+
# @param string type Data type
|
213
|
+
# @param string value Value to be deserialized
|
214
|
+
# @return [Object] Deserialized data
|
215
|
+
def _deserialize(type, value)
|
216
|
+
case type.to_sym
|
217
|
+
when :Time
|
218
|
+
Time.parse(value)
|
219
|
+
when :Date
|
220
|
+
Date.parse(value)
|
221
|
+
when :String
|
222
|
+
value.to_s
|
223
|
+
when :Integer
|
224
|
+
value.to_i
|
225
|
+
when :Float
|
226
|
+
value.to_f
|
227
|
+
when :Boolean
|
228
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
229
|
+
true
|
230
|
+
else
|
231
|
+
false
|
232
|
+
end
|
233
|
+
when :Object
|
234
|
+
# generic object (usually a Hash), return directly
|
235
|
+
value
|
236
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
237
|
+
inner_type = Regexp.last_match[:inner_type]
|
238
|
+
value.map { |v| _deserialize(inner_type, v) }
|
239
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
240
|
+
k_type = Regexp.last_match[:k_type]
|
241
|
+
v_type = Regexp.last_match[:v_type]
|
242
|
+
{}.tap do |hash|
|
243
|
+
value.each do |k, v|
|
244
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
else # model
|
248
|
+
# models (e.g. Pet) or oneOf
|
249
|
+
klass = MergeATSClient.const_get(type)
|
250
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns the string representation of the object
|
255
|
+
# @return [String] String presentation of the object
|
256
|
+
def to_s
|
257
|
+
to_hash.to_s
|
258
|
+
end
|
259
|
+
|
260
|
+
# to_body is an alias to to_hash (backward compatibility)
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
262
|
+
def to_body
|
263
|
+
to_hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Returns the object in the form of hash
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
268
|
+
def to_hash
|
269
|
+
hash = {}
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
271
|
+
value = self.send(attr)
|
272
|
+
if value.nil?
|
273
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
274
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
275
|
+
end
|
276
|
+
|
277
|
+
hash[param] = _to_hash(value)
|
278
|
+
end
|
279
|
+
hash
|
280
|
+
end
|
281
|
+
|
282
|
+
# Outputs non-array value in the form of hash
|
283
|
+
# For object, use to_hash. Otherwise, just return the value
|
284
|
+
# @param [Object] value Any valid value
|
285
|
+
# @return [Hash] Returns the value in the form of hash
|
286
|
+
def _to_hash(value)
|
287
|
+
if value.is_a?(Array)
|
288
|
+
value.compact.map { |v| _to_hash(v) }
|
289
|
+
elsif value.is_a?(Hash)
|
290
|
+
{}.tap do |hash|
|
291
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
292
|
+
end
|
293
|
+
elsif value.respond_to? :to_hash
|
294
|
+
value.to_hash
|
295
|
+
else
|
296
|
+
value
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
end
|
301
|
+
|
302
|
+
end
|