daytona_toolbox_api_client 0.126.0.alpha.1

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 (100) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +39 -0
  3. data/.openapi-generator/FILES +92 -0
  4. data/.openapi-generator/VERSION +1 -0
  5. data/.openapi-generator-ignore +12 -0
  6. data/.rspec +2 -0
  7. data/.rubocop.yml +148 -0
  8. data/Gemfile +9 -0
  9. data/Gemfile.lock +101 -0
  10. data/Rakefile +10 -0
  11. data/daytona_toolbox_api_client.gemspec +39 -0
  12. data/fix-gemspec.sh +13 -0
  13. data/lib/daytona_toolbox_api_client/api/computer_use_api.rb +1463 -0
  14. data/lib/daytona_toolbox_api_client/api/file_system_api.rb +893 -0
  15. data/lib/daytona_toolbox_api_client/api/git_api.rb +744 -0
  16. data/lib/daytona_toolbox_api_client/api/info_api.rb +193 -0
  17. data/lib/daytona_toolbox_api_client/api/interpreter_api.rb +267 -0
  18. data/lib/daytona_toolbox_api_client/api/lsp_api.rb +510 -0
  19. data/lib/daytona_toolbox_api_client/api/port_api.rb +142 -0
  20. data/lib/daytona_toolbox_api_client/api/process_api.rb +938 -0
  21. data/lib/daytona_toolbox_api_client/api_client.rb +392 -0
  22. data/lib/daytona_toolbox_api_client/api_error.rb +58 -0
  23. data/lib/daytona_toolbox_api_client/configuration.rb +297 -0
  24. data/lib/daytona_toolbox_api_client/models/command.rb +270 -0
  25. data/lib/daytona_toolbox_api_client/models/completion_context.rb +244 -0
  26. data/lib/daytona_toolbox_api_client/models/completion_item.rb +289 -0
  27. data/lib/daytona_toolbox_api_client/models/completion_list.rb +263 -0
  28. data/lib/daytona_toolbox_api_client/models/computer_use_start_response.rb +229 -0
  29. data/lib/daytona_toolbox_api_client/models/computer_use_status_response.rb +218 -0
  30. data/lib/daytona_toolbox_api_client/models/computer_use_stop_response.rb +229 -0
  31. data/lib/daytona_toolbox_api_client/models/create_context_request.rb +227 -0
  32. data/lib/daytona_toolbox_api_client/models/create_session_request.rb +235 -0
  33. data/lib/daytona_toolbox_api_client/models/display_info.rb +263 -0
  34. data/lib/daytona_toolbox_api_client/models/display_info_response.rb +220 -0
  35. data/lib/daytona_toolbox_api_client/models/execute_request.rb +255 -0
  36. data/lib/daytona_toolbox_api_client/models/execute_response.rb +244 -0
  37. data/lib/daytona_toolbox_api_client/models/file_info.rb +417 -0
  38. data/lib/daytona_toolbox_api_client/models/file_status.rb +335 -0
  39. data/lib/daytona_toolbox_api_client/models/files_download_request.rb +237 -0
  40. data/lib/daytona_toolbox_api_client/models/git_add_request.rb +264 -0
  41. data/lib/daytona_toolbox_api_client/models/git_branch_request.rb +261 -0
  42. data/lib/daytona_toolbox_api_client/models/git_checkout_request.rb +261 -0
  43. data/lib/daytona_toolbox_api_client/models/git_clone_request.rb +297 -0
  44. data/lib/daytona_toolbox_api_client/models/git_commit_info.rb +339 -0
  45. data/lib/daytona_toolbox_api_client/models/git_commit_request.rb +322 -0
  46. data/lib/daytona_toolbox_api_client/models/git_commit_response.rb +235 -0
  47. data/lib/daytona_toolbox_api_client/models/git_git_delete_branch_request.rb +261 -0
  48. data/lib/daytona_toolbox_api_client/models/git_repo_request.rb +253 -0
  49. data/lib/daytona_toolbox_api_client/models/git_status.rb +290 -0
  50. data/lib/daytona_toolbox_api_client/models/interpreter_context.rb +339 -0
  51. data/lib/daytona_toolbox_api_client/models/is_port_in_use_response.rb +218 -0
  52. data/lib/daytona_toolbox_api_client/models/keyboard_hotkey_request.rb +219 -0
  53. data/lib/daytona_toolbox_api_client/models/keyboard_press_request.rb +230 -0
  54. data/lib/daytona_toolbox_api_client/models/keyboard_type_request.rb +228 -0
  55. data/lib/daytona_toolbox_api_client/models/list_branch_response.rb +237 -0
  56. data/lib/daytona_toolbox_api_client/models/list_contexts_response.rb +237 -0
  57. data/lib/daytona_toolbox_api_client/models/lsp_completion_params.rb +322 -0
  58. data/lib/daytona_toolbox_api_client/models/lsp_document_request.rb +287 -0
  59. data/lib/daytona_toolbox_api_client/models/lsp_location.rb +261 -0
  60. data/lib/daytona_toolbox_api_client/models/lsp_position.rb +261 -0
  61. data/lib/daytona_toolbox_api_client/models/lsp_range.rb +261 -0
  62. data/lib/daytona_toolbox_api_client/models/lsp_server_request.rb +261 -0
  63. data/lib/daytona_toolbox_api_client/models/lsp_symbol.rb +287 -0
  64. data/lib/daytona_toolbox_api_client/models/match.rb +287 -0
  65. data/lib/daytona_toolbox_api_client/models/mouse_click_request.rb +246 -0
  66. data/lib/daytona_toolbox_api_client/models/mouse_click_response.rb +227 -0
  67. data/lib/daytona_toolbox_api_client/models/mouse_drag_request.rb +254 -0
  68. data/lib/daytona_toolbox_api_client/models/mouse_drag_response.rb +227 -0
  69. data/lib/daytona_toolbox_api_client/models/mouse_move_request.rb +227 -0
  70. data/lib/daytona_toolbox_api_client/models/mouse_position_response.rb +227 -0
  71. data/lib/daytona_toolbox_api_client/models/mouse_scroll_request.rb +246 -0
  72. data/lib/daytona_toolbox_api_client/models/port_list.rb +220 -0
  73. data/lib/daytona_toolbox_api_client/models/position.rb +227 -0
  74. data/lib/daytona_toolbox_api_client/models/process_errors_response.rb +227 -0
  75. data/lib/daytona_toolbox_api_client/models/process_logs_response.rb +227 -0
  76. data/lib/daytona_toolbox_api_client/models/process_restart_response.rb +227 -0
  77. data/lib/daytona_toolbox_api_client/models/process_status.rb +245 -0
  78. data/lib/daytona_toolbox_api_client/models/process_status_response.rb +227 -0
  79. data/lib/daytona_toolbox_api_client/models/pty_create_request.rb +266 -0
  80. data/lib/daytona_toolbox_api_client/models/pty_create_response.rb +218 -0
  81. data/lib/daytona_toolbox_api_client/models/pty_list_response.rb +220 -0
  82. data/lib/daytona_toolbox_api_client/models/pty_resize_request.rb +297 -0
  83. data/lib/daytona_toolbox_api_client/models/pty_session_info.rb +284 -0
  84. data/lib/daytona_toolbox_api_client/models/replace_request.rb +289 -0
  85. data/lib/daytona_toolbox_api_client/models/replace_result.rb +236 -0
  86. data/lib/daytona_toolbox_api_client/models/screenshot_response.rb +236 -0
  87. data/lib/daytona_toolbox_api_client/models/scroll_response.rb +218 -0
  88. data/lib/daytona_toolbox_api_client/models/search_files_response.rb +237 -0
  89. data/lib/daytona_toolbox_api_client/models/session.rb +263 -0
  90. data/lib/daytona_toolbox_api_client/models/session_execute_request.rb +253 -0
  91. data/lib/daytona_toolbox_api_client/models/session_execute_response.rb +254 -0
  92. data/lib/daytona_toolbox_api_client/models/status.rb +46 -0
  93. data/lib/daytona_toolbox_api_client/models/user_home_dir_response.rb +218 -0
  94. data/lib/daytona_toolbox_api_client/models/window_info.rb +272 -0
  95. data/lib/daytona_toolbox_api_client/models/windows_response.rb +220 -0
  96. data/lib/daytona_toolbox_api_client/models/work_dir_response.rb +218 -0
  97. data/lib/daytona_toolbox_api_client/version.rb +15 -0
  98. data/lib/daytona_toolbox_api_client.rb +120 -0
  99. data/project.json +65 -0
  100. metadata +178 -0
@@ -0,0 +1,339 @@
1
+ =begin
2
+ #Daytona Daemon API
3
+
4
+ #Daytona Daemon API
5
+
6
+ The version of the OpenAPI document: v0.0.0-dev
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DaytonaToolboxApiClient
17
+ class InterpreterContext
18
+ attr_accessor :active
19
+
20
+ attr_accessor :created_at
21
+
22
+ attr_accessor :cwd
23
+
24
+ attr_accessor :id
25
+
26
+ attr_accessor :language
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'active' => :'active',
32
+ :'created_at' => :'createdAt',
33
+ :'cwd' => :'cwd',
34
+ :'id' => :'id',
35
+ :'language' => :'language'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'active' => :'Boolean',
53
+ :'created_at' => :'String',
54
+ :'cwd' => :'String',
55
+ :'id' => :'String',
56
+ :'language' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaToolboxApiClient::InterpreterContext` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaToolboxApiClient::InterpreterContext`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'active')
83
+ self.active = attributes[:'active']
84
+ else
85
+ self.active = nil
86
+ end
87
+
88
+ if attributes.key?(:'created_at')
89
+ self.created_at = attributes[:'created_at']
90
+ else
91
+ self.created_at = nil
92
+ end
93
+
94
+ if attributes.key?(:'cwd')
95
+ self.cwd = attributes[:'cwd']
96
+ else
97
+ self.cwd = nil
98
+ end
99
+
100
+ if attributes.key?(:'id')
101
+ self.id = attributes[:'id']
102
+ else
103
+ self.id = nil
104
+ end
105
+
106
+ if attributes.key?(:'language')
107
+ self.language = attributes[:'language']
108
+ else
109
+ self.language = nil
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
117
+ invalid_properties = Array.new
118
+ if @active.nil?
119
+ invalid_properties.push('invalid value for "active", active cannot be nil.')
120
+ end
121
+
122
+ if @created_at.nil?
123
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
124
+ end
125
+
126
+ if @cwd.nil?
127
+ invalid_properties.push('invalid value for "cwd", cwd cannot be nil.')
128
+ end
129
+
130
+ if @id.nil?
131
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
132
+ end
133
+
134
+ if @language.nil?
135
+ invalid_properties.push('invalid value for "language", language cannot be nil.')
136
+ end
137
+
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ warn '[DEPRECATED] the `valid?` method is obsolete'
145
+ return false if @active.nil?
146
+ return false if @created_at.nil?
147
+ return false if @cwd.nil?
148
+ return false if @id.nil?
149
+ return false if @language.nil?
150
+ true
151
+ end
152
+
153
+ # Custom attribute writer method with validation
154
+ # @param [Object] active Value to be assigned
155
+ def active=(active)
156
+ if active.nil?
157
+ fail ArgumentError, 'active cannot be nil'
158
+ end
159
+
160
+ @active = active
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] created_at Value to be assigned
165
+ def created_at=(created_at)
166
+ if created_at.nil?
167
+ fail ArgumentError, 'created_at cannot be nil'
168
+ end
169
+
170
+ @created_at = created_at
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] cwd Value to be assigned
175
+ def cwd=(cwd)
176
+ if cwd.nil?
177
+ fail ArgumentError, 'cwd cannot be nil'
178
+ end
179
+
180
+ @cwd = cwd
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] id Value to be assigned
185
+ def id=(id)
186
+ if id.nil?
187
+ fail ArgumentError, 'id cannot be nil'
188
+ end
189
+
190
+ @id = id
191
+ end
192
+
193
+ # Custom attribute writer method with validation
194
+ # @param [Object] language Value to be assigned
195
+ def language=(language)
196
+ if language.nil?
197
+ fail ArgumentError, 'language cannot be nil'
198
+ end
199
+
200
+ @language = language
201
+ end
202
+
203
+ # Checks equality by comparing each attribute.
204
+ # @param [Object] Object to be compared
205
+ def ==(o)
206
+ return true if self.equal?(o)
207
+ self.class == o.class &&
208
+ active == o.active &&
209
+ created_at == o.created_at &&
210
+ cwd == o.cwd &&
211
+ id == o.id &&
212
+ language == o.language
213
+ end
214
+
215
+ # @see the `==` method
216
+ # @param [Object] Object to be compared
217
+ def eql?(o)
218
+ self == o
219
+ end
220
+
221
+ # Calculates hash code according to all attributes.
222
+ # @return [Integer] Hash code
223
+ def hash
224
+ [active, created_at, cwd, id, language].hash
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def self.build_from_hash(attributes)
231
+ return nil unless attributes.is_a?(Hash)
232
+ attributes = attributes.transform_keys(&:to_sym)
233
+ transformed_hash = {}
234
+ openapi_types.each_pair do |key, type|
235
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
236
+ transformed_hash["#{key}"] = nil
237
+ elsif type =~ /\AArray<(.*)>/i
238
+ # check to ensure the input is an array given that the attribute
239
+ # is documented as an array but the input is not
240
+ if attributes[attribute_map[key]].is_a?(Array)
241
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
242
+ end
243
+ elsif !attributes[attribute_map[key]].nil?
244
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
245
+ end
246
+ end
247
+ new(transformed_hash)
248
+ end
249
+
250
+ # Deserializes the data based on type
251
+ # @param string type Data type
252
+ # @param string value Value to be deserialized
253
+ # @return [Object] Deserialized data
254
+ def self._deserialize(type, value)
255
+ case type.to_sym
256
+ when :Time
257
+ Time.parse(value)
258
+ when :Date
259
+ Date.parse(value)
260
+ when :String
261
+ value.to_s
262
+ when :Integer
263
+ value.to_i
264
+ when :Float
265
+ value.to_f
266
+ when :Boolean
267
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
268
+ true
269
+ else
270
+ false
271
+ end
272
+ when :Object
273
+ # generic object (usually a Hash), return directly
274
+ value
275
+ when /\AArray<(?<inner_type>.+)>\z/
276
+ inner_type = Regexp.last_match[:inner_type]
277
+ value.map { |v| _deserialize(inner_type, v) }
278
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
279
+ k_type = Regexp.last_match[:k_type]
280
+ v_type = Regexp.last_match[:v_type]
281
+ {}.tap do |hash|
282
+ value.each do |k, v|
283
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
284
+ end
285
+ end
286
+ else # model
287
+ # models (e.g. Pet) or oneOf
288
+ klass = DaytonaToolboxApiClient.const_get(type)
289
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
290
+ end
291
+ end
292
+
293
+ # Returns the string representation of the object
294
+ # @return [String] String presentation of the object
295
+ def to_s
296
+ to_hash.to_s
297
+ end
298
+
299
+ # to_body is an alias to to_hash (backward compatibility)
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_body
302
+ to_hash
303
+ end
304
+
305
+ # Returns the object in the form of hash
306
+ # @return [Hash] Returns the object in the form of hash
307
+ def to_hash
308
+ hash = {}
309
+ self.class.attribute_map.each_pair do |attr, param|
310
+ value = self.send(attr)
311
+ if value.nil?
312
+ is_nullable = self.class.openapi_nullable.include?(attr)
313
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
314
+ end
315
+
316
+ hash[param] = _to_hash(value)
317
+ end
318
+ hash
319
+ end
320
+
321
+ # Outputs non-array value in the form of hash
322
+ # For object, use to_hash. Otherwise, just return the value
323
+ # @param [Object] value Any valid value
324
+ # @return [Hash] Returns the value in the form of hash
325
+ def _to_hash(value)
326
+ if value.is_a?(Array)
327
+ value.compact.map { |v| _to_hash(v) }
328
+ elsif value.is_a?(Hash)
329
+ {}.tap do |hash|
330
+ value.each { |k, v| hash[k] = _to_hash(v) }
331
+ end
332
+ elsif value.respond_to? :to_hash
333
+ value.to_hash
334
+ else
335
+ value
336
+ end
337
+ end
338
+ end
339
+ end
@@ -0,0 +1,218 @@
1
+ =begin
2
+ #Daytona Daemon API
3
+
4
+ #Daytona Daemon API
5
+
6
+ The version of the OpenAPI document: v0.0.0-dev
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DaytonaToolboxApiClient
17
+ class IsPortInUseResponse
18
+ attr_accessor :is_in_use
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'is_in_use' => :'isInUse'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'is_in_use' => :'Boolean'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaToolboxApiClient::IsPortInUseResponse` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaToolboxApiClient::IsPortInUseResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'is_in_use')
67
+ self.is_in_use = attributes[:'is_in_use']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ warn '[DEPRECATED] the `valid?` method is obsolete'
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ is_in_use == o.is_in_use
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [is_in_use].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ transformed_hash = {}
113
+ openapi_types.each_pair do |key, type|
114
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
115
+ transformed_hash["#{key}"] = nil
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[attribute_map[key]].is_a?(Array)
120
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
121
+ end
122
+ elsif !attributes[attribute_map[key]].nil?
123
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
124
+ end
125
+ end
126
+ new(transformed_hash)
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def self._deserialize(type, value)
134
+ case type.to_sym
135
+ when :Time
136
+ Time.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ # models (e.g. Pet) or oneOf
167
+ klass = DaytonaToolboxApiClient.const_get(type)
168
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ # Outputs non-array value in the form of hash
201
+ # For object, use to_hash. Otherwise, just return the value
202
+ # @param [Object] value Any valid value
203
+ # @return [Hash] Returns the value in the form of hash
204
+ def _to_hash(value)
205
+ if value.is_a?(Array)
206
+ value.compact.map { |v| _to_hash(v) }
207
+ elsif value.is_a?(Hash)
208
+ {}.tap do |hash|
209
+ value.each { |k, v| hash[k] = _to_hash(v) }
210
+ end
211
+ elsif value.respond_to? :to_hash
212
+ value.to_hash
213
+ else
214
+ value
215
+ end
216
+ end
217
+ end
218
+ end