psi_eligibility 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +123 -0
  4. data/Rakefile +8 -0
  5. data/docs/AdditionalAttributeModel.md +9 -0
  6. data/docs/CandidateModel.md +24 -0
  7. data/docs/DefaultApi.md +411 -0
  8. data/docs/EligibilityModel.md +13 -0
  9. data/docs/EligibilityResponseModel.md +8 -0
  10. data/docs/ErrorModel.md +9 -0
  11. data/docs/ExistingEligibilityModel.md +18 -0
  12. data/docs/TestLaunchInfoModel.md +8 -0
  13. data/git_push.sh +55 -0
  14. data/lib/psi_eligibility.rb +47 -0
  15. data/lib/psi_eligibility/api/default_api.rb +454 -0
  16. data/lib/psi_eligibility/api_client.rb +389 -0
  17. data/lib/psi_eligibility/api_error.rb +38 -0
  18. data/lib/psi_eligibility/configuration.rb +216 -0
  19. data/lib/psi_eligibility/models/additional_attribute_model.rb +195 -0
  20. data/lib/psi_eligibility/models/candidate_model.rb +350 -0
  21. data/lib/psi_eligibility/models/eligibility_model.rb +246 -0
  22. data/lib/psi_eligibility/models/eligibility_response_model.rb +184 -0
  23. data/lib/psi_eligibility/models/error_model.rb +194 -0
  24. data/lib/psi_eligibility/models/existing_eligibility_model.rb +320 -0
  25. data/lib/psi_eligibility/models/test_launch_info_model.rb +183 -0
  26. data/lib/psi_eligibility/version.rb +15 -0
  27. data/psi_eligibility-1.0.0.gem +0 -0
  28. data/psi_eligibility.gemspec +45 -0
  29. data/spec/api/default_api_spec.rb +130 -0
  30. data/spec/api_client_spec.rb +226 -0
  31. data/spec/configuration_spec.rb +42 -0
  32. data/spec/models/additional_attribute_model_spec.rb +47 -0
  33. data/spec/models/candidate_model_spec.rb +137 -0
  34. data/spec/models/eligibility_model_spec.rb +71 -0
  35. data/spec/models/eligibility_response_model_spec.rb +41 -0
  36. data/spec/models/error_model_spec.rb +47 -0
  37. data/spec/models/existing_eligibility_model_spec.rb +105 -0
  38. data/spec/models/test_launch_info_model_spec.rb +41 -0
  39. data/spec/spec_helper.rb +111 -0
  40. metadata +272 -0
@@ -0,0 +1,320 @@
1
+ =begin
2
+ #PSI Candidate Rest Eligibility Service
3
+
4
+ #PSIs REST based service to modify candidate test eligibilities.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.10
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PsiEligibility
16
+ # An existing eligibility record.
17
+ class ExistingEligibilityModel
18
+ # The last date possible for the candidate to schedule on. Java ISO_OFFSET_DATE_TIME format.
19
+ attr_accessor :eligibility_end_date
20
+
21
+ attr_accessor :candidate
22
+
23
+ # If required, specific portion codes may be supplied.
24
+ attr_accessor :portion_codes
25
+
26
+ # The first date possible for the candidate to schedule on. Java ISO_OFFSET_DATE_TIME format.
27
+ attr_accessor :schedule_start_date
28
+
29
+ # Any pertinent message about why a candidate is not eligibile to scheduled yet. Common reasons can be because they have been blocked, have pending special accommodations or other similar reasons. Will be null if candidate is eligible to schedule.
30
+ attr_accessor :eligibility_status_message
31
+
32
+ # The client specific test code for the eligibility to be created against.
33
+ attr_accessor :test_code
34
+
35
+ # Whether or not this candidate is eligibile to be scheduled.
36
+ attr_accessor :eligible_to_schedule
37
+
38
+ # PSI's unique identifier for this eligibility.
39
+ attr_accessor :psi_eligiblity_id
40
+
41
+ # Datetime when the eligibility was created. ISO 8601 format similar to Java ISO_OFFSET_DATE_TIME format.
42
+ attr_accessor :created_datetime
43
+
44
+ # Client's unique identifier for this eligibility if provided.
45
+ attr_accessor :client_eligibility_id
46
+
47
+ # Only set on this object when returned back to client. Setting this has no effect when provided as part of a create or update. This is the 4 different eligibility statuses available for a candidate: REG01 is Registration Pending, REG02 is Registration approved, REG03 is Cancelled, REG04 is Scheduled
48
+ attr_accessor :status
49
+
50
+ class EnumAttributeValidator
51
+ attr_reader :datatype
52
+ attr_reader :allowable_values
53
+
54
+ def initialize(datatype, allowable_values)
55
+ @allowable_values = allowable_values.map do |value|
56
+ case datatype.to_s
57
+ when /Integer/i
58
+ value.to_i
59
+ when /Float/i
60
+ value.to_f
61
+ else
62
+ value
63
+ end
64
+ end
65
+ end
66
+
67
+ def valid?(value)
68
+ !value || allowable_values.include?(value)
69
+ end
70
+ end
71
+
72
+ # Attribute mapping from ruby-style variable name to JSON key.
73
+ def self.attribute_map
74
+ {
75
+ :'eligibility_end_date' => :'eligibility_end_date',
76
+ :'candidate' => :'candidate',
77
+ :'portion_codes' => :'portion_codes',
78
+ :'schedule_start_date' => :'schedule_start_date',
79
+ :'eligibility_status_message' => :'eligibility_status_message',
80
+ :'test_code' => :'test_code',
81
+ :'eligible_to_schedule' => :'eligible_to_schedule',
82
+ :'psi_eligiblity_id' => :'psi_eligiblity_id',
83
+ :'created_datetime' => :'created_datetime',
84
+ :'client_eligibility_id' => :'client_eligibility_id',
85
+ :'status' => :'status'
86
+ }
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.swagger_types
91
+ {
92
+ :'eligibility_end_date' => :'String',
93
+ :'candidate' => :'CandidateModel',
94
+ :'portion_codes' => :'Array<String>',
95
+ :'schedule_start_date' => :'String',
96
+ :'eligibility_status_message' => :'String',
97
+ :'test_code' => :'String',
98
+ :'eligible_to_schedule' => :'BOOLEAN',
99
+ :'psi_eligiblity_id' => :'String',
100
+ :'created_datetime' => :'String',
101
+ :'client_eligibility_id' => :'String',
102
+ :'status' => :'String'
103
+ }
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ return unless attributes.is_a?(Hash)
110
+
111
+ # convert string to symbol for hash key
112
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
113
+
114
+ if attributes.has_key?(:'eligibility_end_date')
115
+ self.eligibility_end_date = attributes[:'eligibility_end_date']
116
+ end
117
+
118
+ if attributes.has_key?(:'candidate')
119
+ self.candidate = attributes[:'candidate']
120
+ end
121
+
122
+ if attributes.has_key?(:'portion_codes')
123
+ if (value = attributes[:'portion_codes']).is_a?(Array)
124
+ self.portion_codes = value
125
+ end
126
+ end
127
+
128
+ if attributes.has_key?(:'schedule_start_date')
129
+ self.schedule_start_date = attributes[:'schedule_start_date']
130
+ end
131
+
132
+ if attributes.has_key?(:'eligibility_status_message')
133
+ self.eligibility_status_message = attributes[:'eligibility_status_message']
134
+ end
135
+
136
+ if attributes.has_key?(:'test_code')
137
+ self.test_code = attributes[:'test_code']
138
+ end
139
+
140
+ if attributes.has_key?(:'eligible_to_schedule')
141
+ self.eligible_to_schedule = attributes[:'eligible_to_schedule']
142
+ end
143
+
144
+ if attributes.has_key?(:'psi_eligiblity_id')
145
+ self.psi_eligiblity_id = attributes[:'psi_eligiblity_id']
146
+ end
147
+
148
+ if attributes.has_key?(:'created_datetime')
149
+ self.created_datetime = attributes[:'created_datetime']
150
+ end
151
+
152
+ if attributes.has_key?(:'client_eligibility_id')
153
+ self.client_eligibility_id = attributes[:'client_eligibility_id']
154
+ end
155
+
156
+ if attributes.has_key?(:'status')
157
+ self.status = attributes[:'status']
158
+ end
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properties with the reasons
163
+ def list_invalid_properties
164
+ invalid_properties = Array.new
165
+ invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+ status_validator = EnumAttributeValidator.new('String', ['REG01', 'REG02', 'REG03', 'REG04'])
172
+ return false unless status_validator.valid?(@status)
173
+ true
174
+ end
175
+
176
+ # Custom attribute writer method checking allowed values (enum).
177
+ # @param [Object] status Object to be assigned
178
+ def status=(status)
179
+ validator = EnumAttributeValidator.new('String', ['REG01', 'REG02', 'REG03', 'REG04'])
180
+ unless validator.valid?(status)
181
+ fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
182
+ end
183
+ @status = status
184
+ end
185
+
186
+ # Checks equality by comparing each attribute.
187
+ # @param [Object] Object to be compared
188
+ def ==(o)
189
+ return true if self.equal?(o)
190
+ self.class == o.class &&
191
+ eligibility_end_date == o.eligibility_end_date &&
192
+ candidate == o.candidate &&
193
+ portion_codes == o.portion_codes &&
194
+ schedule_start_date == o.schedule_start_date &&
195
+ eligibility_status_message == o.eligibility_status_message &&
196
+ test_code == o.test_code &&
197
+ eligible_to_schedule == o.eligible_to_schedule &&
198
+ psi_eligiblity_id == o.psi_eligiblity_id &&
199
+ created_datetime == o.created_datetime &&
200
+ client_eligibility_id == o.client_eligibility_id &&
201
+ status == o.status
202
+ end
203
+
204
+ # @see the `==` method
205
+ # @param [Object] Object to be compared
206
+ def eql?(o)
207
+ self == o
208
+ end
209
+
210
+ # Calculates hash code according to all attributes.
211
+ # @return [Fixnum] Hash code
212
+ def hash
213
+ [eligibility_end_date, candidate, portion_codes, schedule_start_date, eligibility_status_message, test_code, eligible_to_schedule, psi_eligiblity_id, created_datetime, client_eligibility_id, status].hash
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ self.class.swagger_types.each_pair do |key, type|
222
+ if type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
227
+ end
228
+ elsif !attributes[self.class.attribute_map[key]].nil?
229
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
231
+ end
232
+
233
+ self
234
+ end
235
+
236
+ # Deserializes the data based on type
237
+ # @param string type Data type
238
+ # @param string value Value to be deserialized
239
+ # @return [Object] Deserialized data
240
+ def _deserialize(type, value)
241
+ case type.to_sym
242
+ when :DateTime
243
+ DateTime.parse(value)
244
+ when :Date
245
+ Date.parse(value)
246
+ when :String
247
+ value.to_s
248
+ when :Integer
249
+ value.to_i
250
+ when :Float
251
+ value.to_f
252
+ when :BOOLEAN
253
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
+ true
255
+ else
256
+ false
257
+ end
258
+ when :Object
259
+ # generic object (usually a Hash), return directly
260
+ value
261
+ when /\AArray<(?<inner_type>.+)>\z/
262
+ inner_type = Regexp.last_match[:inner_type]
263
+ value.map { |v| _deserialize(inner_type, v) }
264
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
+ k_type = Regexp.last_match[:k_type]
266
+ v_type = Regexp.last_match[:v_type]
267
+ {}.tap do |hash|
268
+ value.each do |k, v|
269
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
+ end
271
+ end
272
+ else # model
273
+ temp_model = PsiEligibility.const_get(type).new
274
+ temp_model.build_from_hash(value)
275
+ end
276
+ end
277
+
278
+ # Returns the string representation of the object
279
+ # @return [String] String presentation of the object
280
+ def to_s
281
+ to_hash.to_s
282
+ end
283
+
284
+ # to_body is an alias to to_hash (backward compatibility)
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_body
287
+ to_hash
288
+ end
289
+
290
+ # Returns the object in the form of hash
291
+ # @return [Hash] Returns the object in the form of hash
292
+ def to_hash
293
+ hash = {}
294
+ self.class.attribute_map.each_pair do |attr, param|
295
+ value = self.send(attr)
296
+ next if value.nil?
297
+ hash[param] = _to_hash(value)
298
+ end
299
+ hash
300
+ end
301
+
302
+ # Outputs non-array value in the form of hash
303
+ # For object, use to_hash. Otherwise, just return the value
304
+ # @param [Object] value Any valid value
305
+ # @return [Hash] Returns the value in the form of hash
306
+ def _to_hash(value)
307
+ if value.is_a?(Array)
308
+ value.compact.map { |v| _to_hash(v) }
309
+ elsif value.is_a?(Hash)
310
+ {}.tap do |hash|
311
+ value.each { |k, v| hash[k] = _to_hash(v) }
312
+ end
313
+ elsif value.respond_to? :to_hash
314
+ value.to_hash
315
+ else
316
+ value
317
+ end
318
+ end
319
+ end
320
+ end
@@ -0,0 +1,183 @@
1
+ =begin
2
+ #PSI Candidate Rest Eligibility Service
3
+
4
+ #PSIs REST based service to modify candidate test eligibilities.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.10
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module PsiEligibility
16
+ class TestLaunchInfoModel
17
+ attr_accessor :test_launch_url
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'test_launch_url' => :'test_launch_url'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.swagger_types
28
+ {
29
+ :'test_launch_url' => :'String'
30
+ }
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ return unless attributes.is_a?(Hash)
37
+
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
40
+
41
+ if attributes.has_key?(:'test_launch_url')
42
+ self.test_launch_url = attributes[:'test_launch_url']
43
+ end
44
+ end
45
+
46
+ # Show invalid properties with the reasons. Usually used together with valid?
47
+ # @return Array for valid properties with the reasons
48
+ def list_invalid_properties
49
+ invalid_properties = Array.new
50
+ invalid_properties
51
+ end
52
+
53
+ # Check to see if the all the properties in the model are valid
54
+ # @return true if the model is valid
55
+ def valid?
56
+ true
57
+ end
58
+
59
+ # Checks equality by comparing each attribute.
60
+ # @param [Object] Object to be compared
61
+ def ==(o)
62
+ return true if self.equal?(o)
63
+ self.class == o.class &&
64
+ test_launch_url == o.test_launch_url
65
+ end
66
+
67
+ # @see the `==` method
68
+ # @param [Object] Object to be compared
69
+ def eql?(o)
70
+ self == o
71
+ end
72
+
73
+ # Calculates hash code according to all attributes.
74
+ # @return [Fixnum] Hash code
75
+ def hash
76
+ [test_launch_url].hash
77
+ end
78
+
79
+ # Builds the object from hash
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ # @return [Object] Returns the model itself
82
+ def build_from_hash(attributes)
83
+ return nil unless attributes.is_a?(Hash)
84
+ self.class.swagger_types.each_pair do |key, type|
85
+ if type =~ /\AArray<(.*)>/i
86
+ # check to ensure the input is an array given that the the attribute
87
+ # is documented as an array but the input is not
88
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
89
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
90
+ end
91
+ elsif !attributes[self.class.attribute_map[key]].nil?
92
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
93
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
94
+ end
95
+
96
+ self
97
+ end
98
+
99
+ # Deserializes the data based on type
100
+ # @param string type Data type
101
+ # @param string value Value to be deserialized
102
+ # @return [Object] Deserialized data
103
+ def _deserialize(type, value)
104
+ case type.to_sym
105
+ when :DateTime
106
+ DateTime.parse(value)
107
+ when :Date
108
+ Date.parse(value)
109
+ when :String
110
+ value.to_s
111
+ when :Integer
112
+ value.to_i
113
+ when :Float
114
+ value.to_f
115
+ when :BOOLEAN
116
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
117
+ true
118
+ else
119
+ false
120
+ end
121
+ when :Object
122
+ # generic object (usually a Hash), return directly
123
+ value
124
+ when /\AArray<(?<inner_type>.+)>\z/
125
+ inner_type = Regexp.last_match[:inner_type]
126
+ value.map { |v| _deserialize(inner_type, v) }
127
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
128
+ k_type = Regexp.last_match[:k_type]
129
+ v_type = Regexp.last_match[:v_type]
130
+ {}.tap do |hash|
131
+ value.each do |k, v|
132
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
133
+ end
134
+ end
135
+ else # model
136
+ temp_model = PsiEligibility.const_get(type).new
137
+ temp_model.build_from_hash(value)
138
+ end
139
+ end
140
+
141
+ # Returns the string representation of the object
142
+ # @return [String] String presentation of the object
143
+ def to_s
144
+ to_hash.to_s
145
+ end
146
+
147
+ # to_body is an alias to to_hash (backward compatibility)
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_body
150
+ to_hash
151
+ end
152
+
153
+ # Returns the object in the form of hash
154
+ # @return [Hash] Returns the object in the form of hash
155
+ def to_hash
156
+ hash = {}
157
+ self.class.attribute_map.each_pair do |attr, param|
158
+ value = self.send(attr)
159
+ next if value.nil?
160
+ hash[param] = _to_hash(value)
161
+ end
162
+ hash
163
+ end
164
+
165
+ # Outputs non-array value in the form of hash
166
+ # For object, use to_hash. Otherwise, just return the value
167
+ # @param [Object] value Any valid value
168
+ # @return [Hash] Returns the value in the form of hash
169
+ def _to_hash(value)
170
+ if value.is_a?(Array)
171
+ value.compact.map { |v| _to_hash(v) }
172
+ elsif value.is_a?(Hash)
173
+ {}.tap do |hash|
174
+ value.each { |k, v| hash[k] = _to_hash(v) }
175
+ end
176
+ elsif value.respond_to? :to_hash
177
+ value.to_hash
178
+ else
179
+ value
180
+ end
181
+ end
182
+ end
183
+ end