smplkit 3.0.117 → 3.0.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/retry_policies_api.rb +364 -0
  3. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/api/runs_api.rb +9 -6
  4. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/error.rb +213 -0
  5. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/error_response.rb +167 -0
  6. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job.rb +12 -1
  7. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/job_environment.rb +12 -1
  8. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_on.rb +185 -0
  9. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy.rb +396 -0
  10. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_create_request.rb +165 -0
  11. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_create_resource.rb +237 -0
  12. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_list_response.rb +193 -0
  13. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_request.rb +165 -0
  14. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_resource.rb +186 -0
  15. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/retry_policy_response.rb +165 -0
  16. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run.rb +15 -4
  17. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_list_meta.rb +1 -1
  18. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client/models/run_retry.rb +193 -0
  19. data/lib/smplkit/_generated/jobs/lib/smplkit_jobs_client.rb +12 -0
  20. data/lib/smplkit/_generated/jobs/spec/api/retry_policies_api_spec.rb +100 -0
  21. data/lib/smplkit/_generated/jobs/spec/api/runs_api_spec.rb +4 -3
  22. data/lib/smplkit/_generated/jobs/spec/models/error_response_spec.rb +36 -0
  23. data/lib/smplkit/_generated/jobs/spec/models/error_spec.rb +54 -0
  24. data/lib/smplkit/_generated/jobs/spec/models/job_environment_spec.rb +6 -0
  25. data/lib/smplkit/_generated/jobs/spec/models/job_spec.rb +6 -0
  26. data/lib/smplkit/_generated/jobs/spec/models/retry_on_spec.rb +46 -0
  27. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_create_request_spec.rb +36 -0
  28. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_create_resource_spec.rb +52 -0
  29. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_list_response_spec.rb +42 -0
  30. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_request_spec.rb +36 -0
  31. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_resource_spec.rb +48 -0
  32. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_response_spec.rb +36 -0
  33. data/lib/smplkit/_generated/jobs/spec/models/retry_policy_spec.rb +94 -0
  34. data/lib/smplkit/_generated/jobs/spec/models/run_retry_spec.rb +42 -0
  35. data/lib/smplkit/_generated/jobs/spec/models/run_spec.rb +7 -1
  36. metadata +25 -1
@@ -0,0 +1,213 @@
1
+ =begin
2
+ #smplkit Jobs API
3
+
4
+ #Scheduled HTTP job execution API for smplkit.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Jobs
17
+ # Single JSON:API error object.
18
+ class Error < ApiModelBase
19
+ attr_accessor :status
20
+
21
+ attr_accessor :title
22
+
23
+ attr_accessor :detail
24
+
25
+ attr_accessor :source
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'status' => :'status',
31
+ :'title' => :'title',
32
+ :'detail' => :'detail',
33
+ :'source' => :'source'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'status' => :'String',
51
+ :'title' => :'String',
52
+ :'detail' => :'String',
53
+ :'source' => :'Hash<String, Object>'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ :'detail',
61
+ :'source'
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::Error` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ acceptable_attribute_map = self.class.acceptable_attribute_map
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!acceptable_attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::Error`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'status')
82
+ self.status = attributes[:'status']
83
+ else
84
+ self.status = nil
85
+ end
86
+
87
+ if attributes.key?(:'title')
88
+ self.title = attributes[:'title']
89
+ else
90
+ self.title = nil
91
+ end
92
+
93
+ if attributes.key?(:'detail')
94
+ self.detail = attributes[:'detail']
95
+ end
96
+
97
+ if attributes.key?(:'source')
98
+ if (value = attributes[:'source']).is_a?(Hash)
99
+ self.source = value
100
+ end
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
108
+ invalid_properties = Array.new
109
+ if @status.nil?
110
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
111
+ end
112
+
113
+ if @title.nil?
114
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
115
+ end
116
+
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ warn '[DEPRECATED] the `valid?` method is obsolete'
124
+ return false if @status.nil?
125
+ return false if @title.nil?
126
+ true
127
+ end
128
+
129
+ # Custom attribute writer method with validation
130
+ # @param [Object] status Value to be assigned
131
+ def status=(status)
132
+ if status.nil?
133
+ fail ArgumentError, 'status cannot be nil'
134
+ end
135
+
136
+ @status = status
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] title Value to be assigned
141
+ def title=(title)
142
+ if title.nil?
143
+ fail ArgumentError, 'title cannot be nil'
144
+ end
145
+
146
+ @title = title
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ status == o.status &&
155
+ title == o.title &&
156
+ detail == o.detail &&
157
+ source == o.source
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(o)
163
+ self == o
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Integer] Hash code
168
+ def hash
169
+ [status, title, detail, source].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ attributes = attributes.transform_keys(&:to_sym)
178
+ transformed_hash = {}
179
+ openapi_types.each_pair do |key, type|
180
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = nil
182
+ elsif type =~ /\AArray<(.*)>/i
183
+ # check to ensure the input is an array given that the attribute
184
+ # is documented as an array but the input is not
185
+ if attributes[attribute_map[key]].is_a?(Array)
186
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
187
+ end
188
+ elsif !attributes[attribute_map[key]].nil?
189
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
190
+ end
191
+ end
192
+ new(transformed_hash)
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ end
212
+
213
+ end
@@ -0,0 +1,167 @@
1
+ =begin
2
+ #smplkit Jobs API
3
+
4
+ #Scheduled HTTP job execution API for smplkit.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Jobs
17
+ # JSON:API error response envelope.
18
+ class ErrorResponse < ApiModelBase
19
+ attr_accessor :errors
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'errors' => :'errors'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'errors' => :'Array<Error>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::ErrorResponse` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'errors')
68
+ if (value = attributes[:'errors']).is_a?(Array)
69
+ self.errors = value
70
+ end
71
+ else
72
+ self.errors = nil
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
80
+ invalid_properties = Array.new
81
+ if @errors.nil?
82
+ invalid_properties.push('invalid value for "errors", errors cannot be nil.')
83
+ end
84
+
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ warn '[DEPRECATED] the `valid?` method is obsolete'
92
+ return false if @errors.nil?
93
+ true
94
+ end
95
+
96
+ # Custom attribute writer method with validation
97
+ # @param [Object] errors Value to be assigned
98
+ def errors=(errors)
99
+ if errors.nil?
100
+ fail ArgumentError, 'errors cannot be nil'
101
+ end
102
+
103
+ @errors = errors
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ errors == o.errors
112
+ end
113
+
114
+ # @see the `==` method
115
+ # @param [Object] Object to be compared
116
+ def eql?(o)
117
+ self == o
118
+ end
119
+
120
+ # Calculates hash code according to all attributes.
121
+ # @return [Integer] Hash code
122
+ def hash
123
+ [errors].hash
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def self.build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ attributes = attributes.transform_keys(&:to_sym)
132
+ transformed_hash = {}
133
+ openapi_types.each_pair do |key, type|
134
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = nil
136
+ elsif type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[attribute_map[key]].is_a?(Array)
140
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
141
+ end
142
+ elsif !attributes[attribute_map[key]].nil?
143
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
144
+ end
145
+ end
146
+ new(transformed_hash)
147
+ end
148
+
149
+ # Returns the object in the form of hash
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_hash
152
+ hash = {}
153
+ self.class.attribute_map.each_pair do |attr, param|
154
+ value = self.send(attr)
155
+ if value.nil?
156
+ is_nullable = self.class.openapi_nullable.include?(attr)
157
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
158
+ end
159
+
160
+ hash[param] = _to_hash(value)
161
+ end
162
+ hash
163
+ end
164
+
165
+ end
166
+
167
+ end
@@ -40,6 +40,9 @@ module SmplkitGeneratedClient::Jobs
40
40
  # How overlapping runs are handled. `ALLOW` (the only value today) permits them.
41
41
  attr_accessor :concurrency_policy
42
42
 
43
+ # The base retry policy for failed runs — the `id` of a retry policy (or the built-in `Default`), overridable per environment. Omit (or send `null`) to use `Default`, which never retries — so a job that sets nothing behaves exactly as before retries existed.
44
+ attr_accessor :retry_policy
45
+
43
46
  # How the job runs, derived from its base `schedule`: `recurring` for a cron schedule (fires on a repeating cadence), `manual` for no schedule (never auto-fires; runs only when triggered), or `one_off` for a `now` or datetime schedule (runs a single time, then is spent).
44
47
  attr_accessor :kind
45
48
 
@@ -88,6 +91,7 @@ module SmplkitGeneratedClient::Jobs
88
91
  :'configuration' => :'configuration',
89
92
  :'environments' => :'environments',
90
93
  :'concurrency_policy' => :'concurrency_policy',
94
+ :'retry_policy' => :'retry_policy',
91
95
  :'kind' => :'kind',
92
96
  :'created_at' => :'created_at',
93
97
  :'updated_at' => :'updated_at',
@@ -117,6 +121,7 @@ module SmplkitGeneratedClient::Jobs
117
121
  :'configuration' => :'JobHttpConfiguration',
118
122
  :'environments' => :'Hash<String, JobEnvironment>',
119
123
  :'concurrency_policy' => :'String',
124
+ :'retry_policy' => :'String',
120
125
  :'kind' => :'String',
121
126
  :'created_at' => :'Time',
122
127
  :'updated_at' => :'Time',
@@ -131,6 +136,7 @@ module SmplkitGeneratedClient::Jobs
131
136
  :'description',
132
137
  :'schedule',
133
138
  :'timezone',
139
+ :'retry_policy',
134
140
  :'kind',
135
141
  :'created_at',
136
142
  :'updated_at',
@@ -197,6 +203,10 @@ module SmplkitGeneratedClient::Jobs
197
203
  self.concurrency_policy = 'ALLOW'
198
204
  end
199
205
 
206
+ if attributes.key?(:'retry_policy')
207
+ self.retry_policy = attributes[:'retry_policy']
208
+ end
209
+
200
210
  if attributes.key?(:'kind')
201
211
  self.kind = attributes[:'kind']
202
212
  end
@@ -345,6 +355,7 @@ module SmplkitGeneratedClient::Jobs
345
355
  configuration == o.configuration &&
346
356
  environments == o.environments &&
347
357
  concurrency_policy == o.concurrency_policy &&
358
+ retry_policy == o.retry_policy &&
348
359
  kind == o.kind &&
349
360
  created_at == o.created_at &&
350
361
  updated_at == o.updated_at &&
@@ -361,7 +372,7 @@ module SmplkitGeneratedClient::Jobs
361
372
  # Calculates hash code according to all attributes.
362
373
  # @return [Integer] Hash code
363
374
  def hash
364
- [name, description, type, schedule, timezone, configuration, environments, concurrency_policy, kind, created_at, updated_at, deleted_at, version].hash
375
+ [name, description, type, schedule, timezone, configuration, environments, concurrency_policy, retry_policy, kind, created_at, updated_at, deleted_at, version].hash
365
376
  end
366
377
 
367
378
  # Builds the object from hash
@@ -28,6 +28,9 @@ module SmplkitGeneratedClient::Jobs
28
28
  # Per-environment HTTP request override. Omit to inherit the job's base `configuration`. When present, it fully replaces the base configuration for runs in this environment.
29
29
  attr_accessor :configuration
30
30
 
31
+ # Per-environment retry-policy override — the `id` of a retry policy (or `Default`). Omit to inherit the job's base `retry_policy`. When present, runs in this environment retry according to this policy instead of the base.
32
+ attr_accessor :retry_policy
33
+
31
34
  # The next scheduled fire time in this environment. `null` when the environment is not enabled, or once a one-off run has fired.
32
35
  attr_accessor :next_run_at
33
36
 
@@ -38,6 +41,7 @@ module SmplkitGeneratedClient::Jobs
38
41
  :'schedule' => :'schedule',
39
42
  :'timezone' => :'timezone',
40
43
  :'configuration' => :'configuration',
44
+ :'retry_policy' => :'retry_policy',
41
45
  :'next_run_at' => :'next_run_at'
42
46
  }
43
47
  end
@@ -59,6 +63,7 @@ module SmplkitGeneratedClient::Jobs
59
63
  :'schedule' => :'String',
60
64
  :'timezone' => :'String',
61
65
  :'configuration' => :'JobHttpConfiguration',
66
+ :'retry_policy' => :'String',
62
67
  :'next_run_at' => :'Time'
63
68
  }
64
69
  end
@@ -69,6 +74,7 @@ module SmplkitGeneratedClient::Jobs
69
74
  :'schedule',
70
75
  :'timezone',
71
76
  :'configuration',
77
+ :'retry_policy',
72
78
  :'next_run_at'
73
79
  ])
74
80
  end
@@ -107,6 +113,10 @@ module SmplkitGeneratedClient::Jobs
107
113
  self.configuration = attributes[:'configuration']
108
114
  end
109
115
 
116
+ if attributes.key?(:'retry_policy')
117
+ self.retry_policy = attributes[:'retry_policy']
118
+ end
119
+
110
120
  if attributes.key?(:'next_run_at')
111
121
  self.next_run_at = attributes[:'next_run_at']
112
122
  end
@@ -136,6 +146,7 @@ module SmplkitGeneratedClient::Jobs
136
146
  schedule == o.schedule &&
137
147
  timezone == o.timezone &&
138
148
  configuration == o.configuration &&
149
+ retry_policy == o.retry_policy &&
139
150
  next_run_at == o.next_run_at
140
151
  end
141
152
 
@@ -148,7 +159,7 @@ module SmplkitGeneratedClient::Jobs
148
159
  # Calculates hash code according to all attributes.
149
160
  # @return [Integer] Hash code
150
161
  def hash
151
- [enabled, schedule, timezone, configuration, next_run_at].hash
162
+ [enabled, schedule, timezone, configuration, retry_policy, next_run_at].hash
152
163
  end
153
164
 
154
165
  # Builds the object from hash
@@ -0,0 +1,185 @@
1
+ =begin
2
+ #smplkit Jobs API
3
+
4
+ #Scheduled HTTP job execution API for smplkit.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SmplkitGeneratedClient::Jobs
17
+ # Which failures a policy retries. An empty policy (both lists empty or absent) retries nothing.
18
+ class RetryOn < ApiModelBase
19
+ # Response status codes that should be retried when a run fails because the response did not match the job's success status (for example `[429, 503]` to retry on rate-limit and unavailable). Each is a 3-digit HTTP status code. Empty matches no status.
20
+ attr_accessor :statuses
21
+
22
+ # Failure reasons that should be retried: `TIMEOUT` (the run did not complete in time), `CONNECTION_ERROR` (the endpoint could not be reached), or `NON_SUCCESS_STATUS` (any non-success response, regardless of `statuses`). Empty matches no reason.
23
+ attr_accessor :reasons
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'statuses' => :'statuses',
51
+ :'reasons' => :'reasons'
52
+ }
53
+ end
54
+
55
+ # Returns attribute mapping this model knows about
56
+ def self.acceptable_attribute_map
57
+ attribute_map
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ acceptable_attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'statuses' => :'Array<Integer>',
69
+ :'reasons' => :'Array<String>'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Jobs::RetryOn` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ acceptable_attribute_map = self.class.acceptable_attribute_map
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!acceptable_attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Jobs::RetryOn`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'statuses')
96
+ if (value = attributes[:'statuses']).is_a?(Array)
97
+ self.statuses = value
98
+ end
99
+ end
100
+
101
+ if attributes.key?(:'reasons')
102
+ if (value = attributes[:'reasons']).is_a?(Array)
103
+ self.reasons = value
104
+ end
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ true
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(o)
126
+ return true if self.equal?(o)
127
+ self.class == o.class &&
128
+ statuses == o.statuses &&
129
+ reasons == o.reasons
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [statuses, reasons].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ attributes = attributes.transform_keys(&:to_sym)
150
+ transformed_hash = {}
151
+ openapi_types.each_pair do |key, type|
152
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = nil
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[attribute_map[key]].is_a?(Array)
158
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
159
+ end
160
+ elsif !attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
162
+ end
163
+ end
164
+ new(transformed_hash)
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ if value.nil?
174
+ is_nullable = self.class.openapi_nullable.include?(attr)
175
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
176
+ end
177
+
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ end
184
+
185
+ end