fn_ruby 0.1.29

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