iron_functions 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/README.md +109 -0
  4. data/VERSION +1 -0
  5. data/docs/App.md +8 -0
  6. data/docs/AppWrapper.md +8 -0
  7. data/docs/AppsApi.md +197 -0
  8. data/docs/AppsWrapper.md +8 -0
  9. data/docs/Error.md +8 -0
  10. data/docs/ErrorBody.md +9 -0
  11. data/docs/NewTasksWrapper.md +8 -0
  12. data/docs/Route.md +11 -0
  13. data/docs/RouteWrapper.md +8 -0
  14. data/docs/RoutesApi.md +208 -0
  15. data/docs/RoutesWrapper.md +10 -0
  16. data/docs/Task.md +16 -0
  17. data/docs/TaskWrapper.md +8 -0
  18. data/docs/TasksApi.md +57 -0
  19. data/docs/TasksWrapper.md +10 -0
  20. data/git_push.sh +67 -0
  21. data/iron_functions.gemspec +55 -0
  22. data/lib/iron_functions/api/apps_api.rb +262 -0
  23. data/lib/iron_functions/api/routes_api.rb +273 -0
  24. data/lib/iron_functions/api/tasks_api.rb +90 -0
  25. data/lib/iron_functions/api_client.rb +378 -0
  26. data/lib/iron_functions/api_error.rb +47 -0
  27. data/lib/iron_functions/configuration.rb +207 -0
  28. data/lib/iron_functions/models/app.rb +200 -0
  29. data/lib/iron_functions/models/app_wrapper.rb +200 -0
  30. data/lib/iron_functions/models/apps_wrapper.rb +202 -0
  31. data/lib/iron_functions/models/error.rb +199 -0
  32. data/lib/iron_functions/models/error_body.rb +208 -0
  33. data/lib/iron_functions/models/new_tasks_wrapper.rb +202 -0
  34. data/lib/iron_functions/models/route.rb +230 -0
  35. data/lib/iron_functions/models/route_wrapper.rb +200 -0
  36. data/lib/iron_functions/models/routes_wrapper.rb +221 -0
  37. data/lib/iron_functions/models/task.rb +315 -0
  38. data/lib/iron_functions/models/task_wrapper.rb +200 -0
  39. data/lib/iron_functions/models/tasks_wrapper.rb +221 -0
  40. data/lib/iron_functions/version.rb +26 -0
  41. data/lib/iron_functions.rb +65 -0
  42. data/spec/api/apps_api_spec.rb +94 -0
  43. data/spec/api/routes_api_spec.rb +97 -0
  44. data/spec/api/tasks_api_spec.rb +58 -0
  45. data/spec/api_client_spec.rb +237 -0
  46. data/spec/configuration_spec.rb +53 -0
  47. data/spec/models/app_spec.rb +53 -0
  48. data/spec/models/app_wrapper_spec.rb +53 -0
  49. data/spec/models/apps_wrapper_spec.rb +53 -0
  50. data/spec/models/error_body_spec.rb +59 -0
  51. data/spec/models/error_spec.rb +53 -0
  52. data/spec/models/new_tasks_wrapper_spec.rb +53 -0
  53. data/spec/models/route_spec.rb +71 -0
  54. data/spec/models/route_wrapper_spec.rb +53 -0
  55. data/spec/models/routes_wrapper_spec.rb +65 -0
  56. data/spec/models/task_spec.rb +105 -0
  57. data/spec/models/task_wrapper_spec.rb +53 -0
  58. data/spec/models/tasks_wrapper_spec.rb +65 -0
  59. data/spec/spec_helper.rb +122 -0
  60. metadata +300 -0
@@ -0,0 +1,315 @@
1
+ =begin
2
+ #IronFunctions
3
+
4
+ #null
5
+
6
+ OpenAPI spec version: 0.0.5
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module IronFunctions
27
+
28
+ class Task
29
+ # Group this task belongs to.
30
+ attr_accessor :group_name
31
+
32
+ # The error message, if status is 'error'. This is errors due to things outside the task itself. Errors from user code will be found in the log.
33
+ attr_accessor :error
34
+
35
+ # Machine usable reason for task being in this state. Valid values for error status are `timeout | killed | bad_exit`. Valid values for cancelled status are `client_request`. For everything else, this is undefined.
36
+ attr_accessor :reason
37
+
38
+ # Time when task was submitted. Always in UTC.
39
+ attr_accessor :created_at
40
+
41
+ # Time when task started execution. Always in UTC.
42
+ attr_accessor :started_at
43
+
44
+ # Time when task completed, whether it was successul or failed. Always in UTC.
45
+ attr_accessor :completed_at
46
+
47
+ # If this field is set, then this task is a retry of the ID in this field.
48
+ attr_accessor :retry_of
49
+
50
+ # If this field is set, then this task was retried by the task referenced in this field.
51
+ attr_accessor :retry_at
52
+
53
+ # Env vars for the task. Comes from the ones set on the Group.
54
+ attr_accessor :env_vars
55
+
56
+ class EnumAttributeValidator
57
+ attr_reader :datatype
58
+ attr_reader :allowable_values
59
+
60
+ def initialize(datatype, allowable_values)
61
+ @allowable_values = allowable_values.map do |value|
62
+ case datatype.to_s
63
+ when /Integer/i
64
+ value.to_i
65
+ when /Float/i
66
+ value.to_f
67
+ else
68
+ value
69
+ end
70
+ end
71
+ end
72
+
73
+ def valid?(value)
74
+ !value || allowable_values.include?(value)
75
+ end
76
+ end
77
+
78
+ # Attribute mapping from ruby-style variable name to JSON key.
79
+ def self.attribute_map
80
+ {
81
+ :'group_name' => :'group_name',
82
+ :'error' => :'error',
83
+ :'reason' => :'reason',
84
+ :'created_at' => :'created_at',
85
+ :'started_at' => :'started_at',
86
+ :'completed_at' => :'completed_at',
87
+ :'retry_of' => :'retry_of',
88
+ :'retry_at' => :'retry_at',
89
+ :'env_vars' => :'env_vars'
90
+ }
91
+ end
92
+
93
+ # Attribute type mapping.
94
+ def self.swagger_types
95
+ {
96
+ :'group_name' => :'String',
97
+ :'error' => :'String',
98
+ :'reason' => :'String',
99
+ :'created_at' => :'DateTime',
100
+ :'started_at' => :'DateTime',
101
+ :'completed_at' => :'DateTime',
102
+ :'retry_of' => :'String',
103
+ :'retry_at' => :'String',
104
+ :'env_vars' => :'Hash<String, String>'
105
+ }
106
+ end
107
+
108
+ # Initializes the object
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ def initialize(attributes = {})
111
+ return unless attributes.is_a?(Hash)
112
+
113
+ # convert string to symbol for hash key
114
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
115
+
116
+ if attributes.has_key?(:'group_name')
117
+ self.group_name = attributes[:'group_name']
118
+ end
119
+
120
+ if attributes.has_key?(:'error')
121
+ self.error = attributes[:'error']
122
+ end
123
+
124
+ if attributes.has_key?(:'reason')
125
+ self.reason = attributes[:'reason']
126
+ end
127
+
128
+ if attributes.has_key?(:'created_at')
129
+ self.created_at = attributes[:'created_at']
130
+ end
131
+
132
+ if attributes.has_key?(:'started_at')
133
+ self.started_at = attributes[:'started_at']
134
+ end
135
+
136
+ if attributes.has_key?(:'completed_at')
137
+ self.completed_at = attributes[:'completed_at']
138
+ end
139
+
140
+ if attributes.has_key?(:'retry_of')
141
+ self.retry_of = attributes[:'retry_of']
142
+ end
143
+
144
+ if attributes.has_key?(:'retry_at')
145
+ self.retry_at = attributes[:'retry_at']
146
+ end
147
+
148
+ if attributes.has_key?(:'env_vars')
149
+ if (value = attributes[:'env_vars']).is_a?(Array)
150
+ self.env_vars = value
151
+ end
152
+ end
153
+
154
+ end
155
+
156
+ # Show invalid properties with the reasons. Usually used together with valid?
157
+ # @return Array for valid properies with the reasons
158
+ def list_invalid_properties
159
+ invalid_properties = Array.new
160
+ return invalid_properties
161
+ end
162
+
163
+ # Check to see if the all the properties in the model are valid
164
+ # @return true if the model is valid
165
+ def valid?
166
+ reason_validator = EnumAttributeValidator.new('String', ["timeout", "killed", "bad_exit", "client_request"])
167
+ return false unless reason_validator.valid?(@reason)
168
+ return true
169
+ end
170
+
171
+ # Custom attribute writer method checking allowed values (enum).
172
+ # @param [Object] reason Object to be assigned
173
+ def reason=(reason)
174
+ validator = EnumAttributeValidator.new('String', ["timeout", "killed", "bad_exit", "client_request"])
175
+ unless validator.valid?(reason)
176
+ fail ArgumentError, "invalid value for 'reason', must be one of #{validator.allowable_values}."
177
+ end
178
+ @reason = reason
179
+ end
180
+
181
+ # Checks equality by comparing each attribute.
182
+ # @param [Object] Object to be compared
183
+ def ==(o)
184
+ return true if self.equal?(o)
185
+ self.class == o.class &&
186
+ group_name == o.group_name &&
187
+ error == o.error &&
188
+ reason == o.reason &&
189
+ created_at == o.created_at &&
190
+ started_at == o.started_at &&
191
+ completed_at == o.completed_at &&
192
+ retry_of == o.retry_of &&
193
+ retry_at == o.retry_at &&
194
+ env_vars == o.env_vars
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Fixnum] Hash code
205
+ def hash
206
+ [group_name, error, reason, created_at, started_at, completed_at, retry_of, retry_at, env_vars].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def build_from_hash(attributes)
213
+ return nil unless attributes.is_a?(Hash)
214
+ self.class.swagger_types.each_pair do |key, type|
215
+ if type =~ /^Array<(.*)>/i
216
+ # check to ensure the input is an array given that the the attribute
217
+ # is documented as an array but the input is not
218
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
219
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
220
+ end
221
+ elsif !attributes[self.class.attribute_map[key]].nil?
222
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
223
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
224
+ end
225
+
226
+ self
227
+ end
228
+
229
+ # Deserializes the data based on type
230
+ # @param string type Data type
231
+ # @param string value Value to be deserialized
232
+ # @return [Object] Deserialized data
233
+ def _deserialize(type, value)
234
+ case type.to_sym
235
+ when :DateTime
236
+ DateTime.parse(value)
237
+ when :Date
238
+ Date.parse(value)
239
+ when :String
240
+ value.to_s
241
+ when :Integer
242
+ value.to_i
243
+ when :Float
244
+ value.to_f
245
+ when :BOOLEAN
246
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
247
+ true
248
+ else
249
+ false
250
+ end
251
+ when :Object
252
+ # generic object (usually a Hash), return directly
253
+ value
254
+ when /\AArray<(?<inner_type>.+)>\z/
255
+ inner_type = Regexp.last_match[:inner_type]
256
+ value.map { |v| _deserialize(inner_type, v) }
257
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
258
+ k_type = Regexp.last_match[:k_type]
259
+ v_type = Regexp.last_match[:v_type]
260
+ {}.tap do |hash|
261
+ value.each do |k, v|
262
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
263
+ end
264
+ end
265
+ else # model
266
+ temp_model = IronFunctions.const_get(type).new
267
+ temp_model.build_from_hash(value)
268
+ end
269
+ end
270
+
271
+ # Returns the string representation of the object
272
+ # @return [String] String presentation of the object
273
+ def to_s
274
+ to_hash.to_s
275
+ end
276
+
277
+ # to_body is an alias to to_hash (backward compatibility)
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_body
280
+ to_hash
281
+ end
282
+
283
+ # Returns the object in the form of hash
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_hash
286
+ hash = {}
287
+ self.class.attribute_map.each_pair do |attr, param|
288
+ value = self.send(attr)
289
+ next if value.nil?
290
+ hash[param] = _to_hash(value)
291
+ end
292
+ hash
293
+ end
294
+
295
+ # Outputs non-array value in the form of hash
296
+ # For object, use to_hash. Otherwise, just return the value
297
+ # @param [Object] value Any valid value
298
+ # @return [Hash] Returns the value in the form of hash
299
+ def _to_hash(value)
300
+ if value.is_a?(Array)
301
+ value.compact.map{ |v| _to_hash(v) }
302
+ elsif value.is_a?(Hash)
303
+ {}.tap do |hash|
304
+ value.each { |k, v| hash[k] = _to_hash(v) }
305
+ end
306
+ elsif value.respond_to? :to_hash
307
+ value.to_hash
308
+ else
309
+ value
310
+ end
311
+ end
312
+
313
+ end
314
+
315
+ end
@@ -0,0 +1,200 @@
1
+ =begin
2
+ #IronFunctions
3
+
4
+ #null
5
+
6
+ OpenAPI spec version: 0.0.5
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module IronFunctions
27
+
28
+ class TaskWrapper
29
+ attr_accessor :task
30
+
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'task' => :'task'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'task' => :'Task'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ return unless attributes.is_a?(Hash)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
+
54
+ if attributes.has_key?(:'task')
55
+ self.task = attributes[:'task']
56
+ end
57
+
58
+ end
59
+
60
+ # Show invalid properties with the reasons. Usually used together with valid?
61
+ # @return Array for valid properies with the reasons
62
+ def list_invalid_properties
63
+ invalid_properties = Array.new
64
+ return invalid_properties
65
+ end
66
+
67
+ # Check to see if the all the properties in the model are valid
68
+ # @return true if the model is valid
69
+ def valid?
70
+ return false if @task.nil?
71
+ return true
72
+ end
73
+
74
+ # Checks equality by comparing each attribute.
75
+ # @param [Object] Object to be compared
76
+ def ==(o)
77
+ return true if self.equal?(o)
78
+ self.class == o.class &&
79
+ task == o.task
80
+ end
81
+
82
+ # @see the `==` method
83
+ # @param [Object] Object to be compared
84
+ def eql?(o)
85
+ self == o
86
+ end
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Fixnum] Hash code
90
+ def hash
91
+ [task].hash
92
+ end
93
+
94
+ # Builds the object from hash
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ # @return [Object] Returns the model itself
97
+ def build_from_hash(attributes)
98
+ return nil unless attributes.is_a?(Hash)
99
+ self.class.swagger_types.each_pair do |key, type|
100
+ if type =~ /^Array<(.*)>/i
101
+ # check to ensure the input is an array given that the the attribute
102
+ # is documented as an array but the input is not
103
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
104
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
105
+ end
106
+ elsif !attributes[self.class.attribute_map[key]].nil?
107
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
108
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
109
+ end
110
+
111
+ self
112
+ end
113
+
114
+ # Deserializes the data based on type
115
+ # @param string type Data type
116
+ # @param string value Value to be deserialized
117
+ # @return [Object] Deserialized data
118
+ def _deserialize(type, value)
119
+ case type.to_sym
120
+ when :DateTime
121
+ DateTime.parse(value)
122
+ when :Date
123
+ Date.parse(value)
124
+ when :String
125
+ value.to_s
126
+ when :Integer
127
+ value.to_i
128
+ when :Float
129
+ value.to_f
130
+ when :BOOLEAN
131
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
132
+ true
133
+ else
134
+ false
135
+ end
136
+ when :Object
137
+ # generic object (usually a Hash), return directly
138
+ value
139
+ when /\AArray<(?<inner_type>.+)>\z/
140
+ inner_type = Regexp.last_match[:inner_type]
141
+ value.map { |v| _deserialize(inner_type, v) }
142
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
143
+ k_type = Regexp.last_match[:k_type]
144
+ v_type = Regexp.last_match[:v_type]
145
+ {}.tap do |hash|
146
+ value.each do |k, v|
147
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
148
+ end
149
+ end
150
+ else # model
151
+ temp_model = IronFunctions.const_get(type).new
152
+ temp_model.build_from_hash(value)
153
+ end
154
+ end
155
+
156
+ # Returns the string representation of the object
157
+ # @return [String] String presentation of the object
158
+ def to_s
159
+ to_hash.to_s
160
+ end
161
+
162
+ # to_body is an alias to to_hash (backward compatibility)
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_body
165
+ to_hash
166
+ end
167
+
168
+ # Returns the object in the form of hash
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_hash
171
+ hash = {}
172
+ self.class.attribute_map.each_pair do |attr, param|
173
+ value = self.send(attr)
174
+ next if value.nil?
175
+ hash[param] = _to_hash(value)
176
+ end
177
+ hash
178
+ end
179
+
180
+ # Outputs non-array value in the form of hash
181
+ # For object, use to_hash. Otherwise, just return the value
182
+ # @param [Object] value Any valid value
183
+ # @return [Hash] Returns the value in the form of hash
184
+ def _to_hash(value)
185
+ if value.is_a?(Array)
186
+ value.compact.map{ |v| _to_hash(v) }
187
+ elsif value.is_a?(Hash)
188
+ {}.tap do |hash|
189
+ value.each { |k, v| hash[k] = _to_hash(v) }
190
+ end
191
+ elsif value.respond_to? :to_hash
192
+ value.to_hash
193
+ else
194
+ value
195
+ end
196
+ end
197
+
198
+ end
199
+
200
+ end