daytona_api_client 1.0.0

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 (168) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +101 -0
  4. data/Rakefile +10 -0
  5. data/daytona_api_client.gemspec +39 -0
  6. data/lib/daytona_api_client/api/api_keys_api.rb +401 -0
  7. data/lib/daytona_api_client/api/audit_api.rb +240 -0
  8. data/lib/daytona_api_client/api/config_api.rb +77 -0
  9. data/lib/daytona_api_client/api/docker_registry_api.rb +472 -0
  10. data/lib/daytona_api_client/api/health_api.rb +75 -0
  11. data/lib/daytona_api_client/api/object_storage_api.rb +80 -0
  12. data/lib/daytona_api_client/api/organizations_api.rb +1695 -0
  13. data/lib/daytona_api_client/api/preview_api.rb +209 -0
  14. data/lib/daytona_api_client/api/runners_api.rb +321 -0
  15. data/lib/daytona_api_client/api/sandbox_api.rb +1573 -0
  16. data/lib/daytona_api_client/api/snapshots_api.rb +641 -0
  17. data/lib/daytona_api_client/api/toolbox_api.rb +5108 -0
  18. data/lib/daytona_api_client/api/users_api.rb +553 -0
  19. data/lib/daytona_api_client/api/volumes_api.rb +342 -0
  20. data/lib/daytona_api_client/api/webhooks_api.rb +413 -0
  21. data/lib/daytona_api_client/api/workspace_api.rb +955 -0
  22. data/lib/daytona_api_client/api_client.rb +393 -0
  23. data/lib/daytona_api_client/api_error.rb +58 -0
  24. data/lib/daytona_api_client/configuration.rb +306 -0
  25. data/lib/daytona_api_client/models/account_provider.rb +261 -0
  26. data/lib/daytona_api_client/models/announcement.rb +246 -0
  27. data/lib/daytona_api_client/models/api_key_list.rb +384 -0
  28. data/lib/daytona_api_client/models/api_key_response.rb +344 -0
  29. data/lib/daytona_api_client/models/audit_log.rb +422 -0
  30. data/lib/daytona_api_client/models/build_info.rb +285 -0
  31. data/lib/daytona_api_client/models/command.rb +273 -0
  32. data/lib/daytona_api_client/models/completion_context.rb +244 -0
  33. data/lib/daytona_api_client/models/completion_item.rb +289 -0
  34. data/lib/daytona_api_client/models/completion_list.rb +263 -0
  35. data/lib/daytona_api_client/models/compressed_screenshot_response.rb +256 -0
  36. data/lib/daytona_api_client/models/computer_use_start_response.rb +263 -0
  37. data/lib/daytona_api_client/models/computer_use_status_response.rb +260 -0
  38. data/lib/daytona_api_client/models/computer_use_stop_response.rb +263 -0
  39. data/lib/daytona_api_client/models/create_api_key.rb +288 -0
  40. data/lib/daytona_api_client/models/create_audit_log.rb +350 -0
  41. data/lib/daytona_api_client/models/create_build_info.rb +248 -0
  42. data/lib/daytona_api_client/models/create_docker_registry.rb +388 -0
  43. data/lib/daytona_api_client/models/create_linked_account.rb +263 -0
  44. data/lib/daytona_api_client/models/create_organization.rb +236 -0
  45. data/lib/daytona_api_client/models/create_organization_invitation.rb +326 -0
  46. data/lib/daytona_api_client/models/create_organization_quota.rb +290 -0
  47. data/lib/daytona_api_client/models/create_organization_role.rb +304 -0
  48. data/lib/daytona_api_client/models/create_runner.rb +545 -0
  49. data/lib/daytona_api_client/models/create_sandbox.rb +429 -0
  50. data/lib/daytona_api_client/models/create_session_request.rb +236 -0
  51. data/lib/daytona_api_client/models/create_snapshot.rb +318 -0
  52. data/lib/daytona_api_client/models/create_user.rb +331 -0
  53. data/lib/daytona_api_client/models/create_volume.rb +235 -0
  54. data/lib/daytona_api_client/models/create_workspace.rb +411 -0
  55. data/lib/daytona_api_client/models/daytona_configuration.rb +531 -0
  56. data/lib/daytona_api_client/models/display_info_response.rb +238 -0
  57. data/lib/daytona_api_client/models/docker_registry.rb +449 -0
  58. data/lib/daytona_api_client/models/download_files.rb +238 -0
  59. data/lib/daytona_api_client/models/execute_request.rb +255 -0
  60. data/lib/daytona_api_client/models/execute_response.rb +263 -0
  61. data/lib/daytona_api_client/models/file_info.rb +417 -0
  62. data/lib/daytona_api_client/models/file_status.rb +313 -0
  63. data/lib/daytona_api_client/models/git_add_request.rb +264 -0
  64. data/lib/daytona_api_client/models/git_branch_request.rb +261 -0
  65. data/lib/daytona_api_client/models/git_checkout_request.rb +261 -0
  66. data/lib/daytona_api_client/models/git_clone_request.rb +297 -0
  67. data/lib/daytona_api_client/models/git_commit_info.rb +339 -0
  68. data/lib/daytona_api_client/models/git_commit_request.rb +325 -0
  69. data/lib/daytona_api_client/models/git_commit_response.rb +235 -0
  70. data/lib/daytona_api_client/models/git_delete_branch_request.rb +261 -0
  71. data/lib/daytona_api_client/models/git_repo_request.rb +253 -0
  72. data/lib/daytona_api_client/models/git_status.rb +290 -0
  73. data/lib/daytona_api_client/models/health_controller_check200_response.rb +253 -0
  74. data/lib/daytona_api_client/models/health_controller_check200_response_info_value.rb +235 -0
  75. data/lib/daytona_api_client/models/health_controller_check503_response.rb +253 -0
  76. data/lib/daytona_api_client/models/keyboard_hotkey_request.rb +236 -0
  77. data/lib/daytona_api_client/models/keyboard_press_request.rb +248 -0
  78. data/lib/daytona_api_client/models/keyboard_type_request.rb +246 -0
  79. data/lib/daytona_api_client/models/list_branch_response.rb +237 -0
  80. data/lib/daytona_api_client/models/lsp_completion_params.rb +325 -0
  81. data/lib/daytona_api_client/models/lsp_document_request.rb +290 -0
  82. data/lib/daytona_api_client/models/lsp_location.rb +261 -0
  83. data/lib/daytona_api_client/models/lsp_server_request.rb +263 -0
  84. data/lib/daytona_api_client/models/lsp_symbol.rb +287 -0
  85. data/lib/daytona_api_client/models/match.rb +287 -0
  86. data/lib/daytona_api_client/models/mouse_click_request.rb +283 -0
  87. data/lib/daytona_api_client/models/mouse_click_response.rb +263 -0
  88. data/lib/daytona_api_client/models/mouse_drag_request.rb +327 -0
  89. data/lib/daytona_api_client/models/mouse_drag_response.rb +263 -0
  90. data/lib/daytona_api_client/models/mouse_move_request.rb +263 -0
  91. data/lib/daytona_api_client/models/mouse_move_response.rb +263 -0
  92. data/lib/daytona_api_client/models/mouse_position.rb +263 -0
  93. data/lib/daytona_api_client/models/mouse_scroll_request.rb +300 -0
  94. data/lib/daytona_api_client/models/mouse_scroll_response.rb +236 -0
  95. data/lib/daytona_api_client/models/oidc_config.rb +290 -0
  96. data/lib/daytona_api_client/models/organization.rb +695 -0
  97. data/lib/daytona_api_client/models/organization_invitation.rb +534 -0
  98. data/lib/daytona_api_client/models/organization_role.rb +412 -0
  99. data/lib/daytona_api_client/models/organization_sandbox_default_limited_network_egress.rb +236 -0
  100. data/lib/daytona_api_client/models/organization_suspension.rb +290 -0
  101. data/lib/daytona_api_client/models/organization_usage_overview.rb +469 -0
  102. data/lib/daytona_api_client/models/organization_user.rb +451 -0
  103. data/lib/daytona_api_client/models/paginated_audit_logs.rb +315 -0
  104. data/lib/daytona_api_client/models/paginated_sandboxes.rb +315 -0
  105. data/lib/daytona_api_client/models/paginated_snapshots.rb +315 -0
  106. data/lib/daytona_api_client/models/paginated_snapshots_dto.rb +315 -0
  107. data/lib/daytona_api_client/models/port_preview_url.rb +273 -0
  108. data/lib/daytona_api_client/models/position.rb +261 -0
  109. data/lib/daytona_api_client/models/posthog_config.rb +263 -0
  110. data/lib/daytona_api_client/models/process_errors_response.rb +263 -0
  111. data/lib/daytona_api_client/models/process_logs_response.rb +263 -0
  112. data/lib/daytona_api_client/models/process_restart_response.rb +263 -0
  113. data/lib/daytona_api_client/models/process_status_response.rb +263 -0
  114. data/lib/daytona_api_client/models/project_dir_response.rb +218 -0
  115. data/lib/daytona_api_client/models/pty_create_request.rb +288 -0
  116. data/lib/daytona_api_client/models/pty_create_response.rb +236 -0
  117. data/lib/daytona_api_client/models/pty_list_response.rb +238 -0
  118. data/lib/daytona_api_client/models/pty_resize_request.rb +263 -0
  119. data/lib/daytona_api_client/models/pty_session_info.rb +425 -0
  120. data/lib/daytona_api_client/models/range.rb +261 -0
  121. data/lib/daytona_api_client/models/region.rb +236 -0
  122. data/lib/daytona_api_client/models/region_screenshot_response.rb +256 -0
  123. data/lib/daytona_api_client/models/registry_push_access_dto.rb +371 -0
  124. data/lib/daytona_api_client/models/replace_request.rb +289 -0
  125. data/lib/daytona_api_client/models/replace_result.rb +236 -0
  126. data/lib/daytona_api_client/models/runner.rb +780 -0
  127. data/lib/daytona_api_client/models/runner_snapshot_dto.rb +290 -0
  128. data/lib/daytona_api_client/models/runner_state.rb +43 -0
  129. data/lib/daytona_api_client/models/sandbox.rb +755 -0
  130. data/lib/daytona_api_client/models/sandbox_class.rb +41 -0
  131. data/lib/daytona_api_client/models/sandbox_desired_state.rb +43 -0
  132. data/lib/daytona_api_client/models/sandbox_info.rb +273 -0
  133. data/lib/daytona_api_client/models/sandbox_labels.rb +238 -0
  134. data/lib/daytona_api_client/models/sandbox_state.rb +54 -0
  135. data/lib/daytona_api_client/models/sandbox_volume.rb +263 -0
  136. data/lib/daytona_api_client/models/screenshot_response.rb +256 -0
  137. data/lib/daytona_api_client/models/search_files_response.rb +237 -0
  138. data/lib/daytona_api_client/models/send_webhook_dto.rb +273 -0
  139. data/lib/daytona_api_client/models/session.rb +251 -0
  140. data/lib/daytona_api_client/models/session_execute_request.rb +256 -0
  141. data/lib/daytona_api_client/models/session_execute_response.rb +239 -0
  142. data/lib/daytona_api_client/models/set_snapshot_general_status_dto.rb +236 -0
  143. data/lib/daytona_api_client/models/snapshot_dto.rb +569 -0
  144. data/lib/daytona_api_client/models/snapshot_state.rb +49 -0
  145. data/lib/daytona_api_client/models/ssh_access_dto.rb +371 -0
  146. data/lib/daytona_api_client/models/ssh_access_validation_dto.rb +283 -0
  147. data/lib/daytona_api_client/models/storage_access_dto.rb +371 -0
  148. data/lib/daytona_api_client/models/update_docker_registry.rb +310 -0
  149. data/lib/daytona_api_client/models/update_organization_invitation.rb +299 -0
  150. data/lib/daytona_api_client/models/update_organization_member_access.rb +289 -0
  151. data/lib/daytona_api_client/models/update_organization_quota.rb +317 -0
  152. data/lib/daytona_api_client/models/update_organization_role.rb +304 -0
  153. data/lib/daytona_api_client/models/update_sandbox_state_dto.rb +260 -0
  154. data/lib/daytona_api_client/models/user.rb +346 -0
  155. data/lib/daytona_api_client/models/user_home_dir_response.rb +218 -0
  156. data/lib/daytona_api_client/models/user_public_key.rb +263 -0
  157. data/lib/daytona_api_client/models/volume_dto.rb +417 -0
  158. data/lib/daytona_api_client/models/volume_state.rb +45 -0
  159. data/lib/daytona_api_client/models/webhook_app_portal_access.rb +236 -0
  160. data/lib/daytona_api_client/models/webhook_controller_get_status200_response.rb +218 -0
  161. data/lib/daytona_api_client/models/webhook_initialization_status.rb +343 -0
  162. data/lib/daytona_api_client/models/windows_response.rb +265 -0
  163. data/lib/daytona_api_client/models/work_dir_response.rb +218 -0
  164. data/lib/daytona_api_client/models/workspace.rb +834 -0
  165. data/lib/daytona_api_client/version.rb +15 -0
  166. data/lib/daytona_api_client.rb +194 -0
  167. data/project.json +37 -0
  168. metadata +246 -0
@@ -0,0 +1,260 @@
1
+ =begin
2
+ #Daytona
3
+
4
+ #Daytona AI platform API Docs
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@daytona.com
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 DaytonaApiClient
17
+ class UpdateSandboxStateDto
18
+ # The new state for the sandbox
19
+ attr_accessor :state
20
+
21
+ class EnumAttributeValidator
22
+ attr_reader :datatype
23
+ attr_reader :allowable_values
24
+
25
+ def initialize(datatype, allowable_values)
26
+ @allowable_values = allowable_values.map do |value|
27
+ case datatype.to_s
28
+ when /Integer/i
29
+ value.to_i
30
+ when /Float/i
31
+ value.to_f
32
+ else
33
+ value
34
+ end
35
+ end
36
+ end
37
+
38
+ def valid?(value)
39
+ !value || allowable_values.include?(value)
40
+ end
41
+ end
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'state' => :'state'
47
+ }
48
+ end
49
+
50
+ # Returns attribute mapping this model knows about
51
+ def self.acceptable_attribute_map
52
+ attribute_map
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ acceptable_attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'state' => :'String'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::UpdateSandboxStateDto` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ acceptable_attribute_map = self.class.acceptable_attribute_map
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!acceptable_attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::UpdateSandboxStateDto`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'state')
90
+ self.state = attributes[:'state']
91
+ else
92
+ self.state = nil
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
+ invalid_properties = Array.new
101
+ if @state.nil?
102
+ invalid_properties.push('invalid value for "state", state cannot be nil.')
103
+ end
104
+
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ warn '[DEPRECATED] the `valid?` method is obsolete'
112
+ return false if @state.nil?
113
+ state_validator = EnumAttributeValidator.new('String', ["creating", "restoring", "destroyed", "destroying", "started", "stopped", "starting", "stopping", "error", "build_failed", "pending_build", "building_snapshot", "unknown", "pulling_snapshot", "archived", "archiving"])
114
+ return false unless state_validator.valid?(@state)
115
+ true
116
+ end
117
+
118
+ # Custom attribute writer method checking allowed values (enum).
119
+ # @param [Object] state Object to be assigned
120
+ def state=(state)
121
+ validator = EnumAttributeValidator.new('String', ["creating", "restoring", "destroyed", "destroying", "started", "stopped", "starting", "stopping", "error", "build_failed", "pending_build", "building_snapshot", "unknown", "pulling_snapshot", "archived", "archiving"])
122
+ unless validator.valid?(state)
123
+ fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
124
+ end
125
+ @state = state
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ state == o.state
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(o)
139
+ self == o
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Integer] Hash code
144
+ def hash
145
+ [state].hash
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def self.build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ attributes = attributes.transform_keys(&:to_sym)
154
+ transformed_hash = {}
155
+ openapi_types.each_pair do |key, type|
156
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
157
+ transformed_hash["#{key}"] = nil
158
+ elsif type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[attribute_map[key]].is_a?(Array)
162
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
163
+ end
164
+ elsif !attributes[attribute_map[key]].nil?
165
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
166
+ end
167
+ end
168
+ new(transformed_hash)
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def self._deserialize(type, value)
176
+ case type.to_sym
177
+ when :Time
178
+ Time.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ # models (e.g. Pet) or oneOf
209
+ klass = DaytonaApiClient.const_get(type)
210
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ if value.nil?
233
+ is_nullable = self.class.openapi_nullable.include?(attr)
234
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
235
+ end
236
+
237
+ hash[param] = _to_hash(value)
238
+ end
239
+ hash
240
+ end
241
+
242
+ # Outputs non-array value in the form of hash
243
+ # For object, use to_hash. Otherwise, just return the value
244
+ # @param [Object] value Any valid value
245
+ # @return [Hash] Returns the value in the form of hash
246
+ def _to_hash(value)
247
+ if value.is_a?(Array)
248
+ value.compact.map { |v| _to_hash(v) }
249
+ elsif value.is_a?(Hash)
250
+ {}.tap do |hash|
251
+ value.each { |k, v| hash[k] = _to_hash(v) }
252
+ end
253
+ elsif value.respond_to? :to_hash
254
+ value.to_hash
255
+ else
256
+ value
257
+ end
258
+ end
259
+ end
260
+ end
@@ -0,0 +1,346 @@
1
+ =begin
2
+ #Daytona
3
+
4
+ #Daytona AI platform API Docs
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: support@daytona.com
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 DaytonaApiClient
17
+ class User
18
+ # User ID
19
+ attr_accessor :id
20
+
21
+ # User name
22
+ attr_accessor :name
23
+
24
+ # User email
25
+ attr_accessor :email
26
+
27
+ # User public keys
28
+ attr_accessor :public_keys
29
+
30
+ # Creation timestamp
31
+ attr_accessor :created_at
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'id' => :'id',
37
+ :'name' => :'name',
38
+ :'email' => :'email',
39
+ :'public_keys' => :'publicKeys',
40
+ :'created_at' => :'createdAt'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'id' => :'String',
58
+ :'name' => :'String',
59
+ :'email' => :'String',
60
+ :'public_keys' => :'Array<UserPublicKey>',
61
+ :'created_at' => :'Time'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::User` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::User`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'id')
88
+ self.id = attributes[:'id']
89
+ else
90
+ self.id = nil
91
+ end
92
+
93
+ if attributes.key?(:'name')
94
+ self.name = attributes[:'name']
95
+ else
96
+ self.name = nil
97
+ end
98
+
99
+ if attributes.key?(:'email')
100
+ self.email = attributes[:'email']
101
+ else
102
+ self.email = nil
103
+ end
104
+
105
+ if attributes.key?(:'public_keys')
106
+ if (value = attributes[:'public_keys']).is_a?(Array)
107
+ self.public_keys = value
108
+ end
109
+ else
110
+ self.public_keys = nil
111
+ end
112
+
113
+ if attributes.key?(:'created_at')
114
+ self.created_at = attributes[:'created_at']
115
+ else
116
+ self.created_at = nil
117
+ end
118
+ end
119
+
120
+ # Show invalid properties with the reasons. Usually used together with valid?
121
+ # @return Array for valid properties with the reasons
122
+ def list_invalid_properties
123
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
124
+ invalid_properties = Array.new
125
+ if @id.nil?
126
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
127
+ end
128
+
129
+ if @name.nil?
130
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
131
+ end
132
+
133
+ if @email.nil?
134
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
135
+ end
136
+
137
+ if @public_keys.nil?
138
+ invalid_properties.push('invalid value for "public_keys", public_keys cannot be nil.')
139
+ end
140
+
141
+ if @created_at.nil?
142
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
143
+ end
144
+
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ warn '[DEPRECATED] the `valid?` method is obsolete'
152
+ return false if @id.nil?
153
+ return false if @name.nil?
154
+ return false if @email.nil?
155
+ return false if @public_keys.nil?
156
+ return false if @created_at.nil?
157
+ true
158
+ end
159
+
160
+ # Custom attribute writer method with validation
161
+ # @param [Object] id Value to be assigned
162
+ def id=(id)
163
+ if id.nil?
164
+ fail ArgumentError, 'id cannot be nil'
165
+ end
166
+
167
+ @id = id
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] name Value to be assigned
172
+ def name=(name)
173
+ if name.nil?
174
+ fail ArgumentError, 'name cannot be nil'
175
+ end
176
+
177
+ @name = name
178
+ end
179
+
180
+ # Custom attribute writer method with validation
181
+ # @param [Object] email Value to be assigned
182
+ def email=(email)
183
+ if email.nil?
184
+ fail ArgumentError, 'email cannot be nil'
185
+ end
186
+
187
+ @email = email
188
+ end
189
+
190
+ # Custom attribute writer method with validation
191
+ # @param [Object] public_keys Value to be assigned
192
+ def public_keys=(public_keys)
193
+ if public_keys.nil?
194
+ fail ArgumentError, 'public_keys cannot be nil'
195
+ end
196
+
197
+ @public_keys = public_keys
198
+ end
199
+
200
+ # Custom attribute writer method with validation
201
+ # @param [Object] created_at Value to be assigned
202
+ def created_at=(created_at)
203
+ if created_at.nil?
204
+ fail ArgumentError, 'created_at cannot be nil'
205
+ end
206
+
207
+ @created_at = created_at
208
+ end
209
+
210
+ # Checks equality by comparing each attribute.
211
+ # @param [Object] Object to be compared
212
+ def ==(o)
213
+ return true if self.equal?(o)
214
+ self.class == o.class &&
215
+ id == o.id &&
216
+ name == o.name &&
217
+ email == o.email &&
218
+ public_keys == o.public_keys &&
219
+ created_at == o.created_at
220
+ end
221
+
222
+ # @see the `==` method
223
+ # @param [Object] Object to be compared
224
+ def eql?(o)
225
+ self == o
226
+ end
227
+
228
+ # Calculates hash code according to all attributes.
229
+ # @return [Integer] Hash code
230
+ def hash
231
+ [id, name, email, public_keys, created_at].hash
232
+ end
233
+
234
+ # Builds the object from hash
235
+ # @param [Hash] attributes Model attributes in the form of hash
236
+ # @return [Object] Returns the model itself
237
+ def self.build_from_hash(attributes)
238
+ return nil unless attributes.is_a?(Hash)
239
+ attributes = attributes.transform_keys(&:to_sym)
240
+ transformed_hash = {}
241
+ openapi_types.each_pair do |key, type|
242
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
243
+ transformed_hash["#{key}"] = nil
244
+ elsif type =~ /\AArray<(.*)>/i
245
+ # check to ensure the input is an array given that the attribute
246
+ # is documented as an array but the input is not
247
+ if attributes[attribute_map[key]].is_a?(Array)
248
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
249
+ end
250
+ elsif !attributes[attribute_map[key]].nil?
251
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
252
+ end
253
+ end
254
+ new(transformed_hash)
255
+ end
256
+
257
+ # Deserializes the data based on type
258
+ # @param string type Data type
259
+ # @param string value Value to be deserialized
260
+ # @return [Object] Deserialized data
261
+ def self._deserialize(type, value)
262
+ case type.to_sym
263
+ when :Time
264
+ Time.parse(value)
265
+ when :Date
266
+ Date.parse(value)
267
+ when :String
268
+ value.to_s
269
+ when :Integer
270
+ value.to_i
271
+ when :Float
272
+ value.to_f
273
+ when :Boolean
274
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
275
+ true
276
+ else
277
+ false
278
+ end
279
+ when :Object
280
+ # generic object (usually a Hash), return directly
281
+ value
282
+ when /\AArray<(?<inner_type>.+)>\z/
283
+ inner_type = Regexp.last_match[:inner_type]
284
+ value.map { |v| _deserialize(inner_type, v) }
285
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
286
+ k_type = Regexp.last_match[:k_type]
287
+ v_type = Regexp.last_match[:v_type]
288
+ {}.tap do |hash|
289
+ value.each do |k, v|
290
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
291
+ end
292
+ end
293
+ else # model
294
+ # models (e.g. Pet) or oneOf
295
+ klass = DaytonaApiClient.const_get(type)
296
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
297
+ end
298
+ end
299
+
300
+ # Returns the string representation of the object
301
+ # @return [String] String presentation of the object
302
+ def to_s
303
+ to_hash.to_s
304
+ end
305
+
306
+ # to_body is an alias to to_hash (backward compatibility)
307
+ # @return [Hash] Returns the object in the form of hash
308
+ def to_body
309
+ to_hash
310
+ end
311
+
312
+ # Returns the object in the form of hash
313
+ # @return [Hash] Returns the object in the form of hash
314
+ def to_hash
315
+ hash = {}
316
+ self.class.attribute_map.each_pair do |attr, param|
317
+ value = self.send(attr)
318
+ if value.nil?
319
+ is_nullable = self.class.openapi_nullable.include?(attr)
320
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
321
+ end
322
+
323
+ hash[param] = _to_hash(value)
324
+ end
325
+ hash
326
+ end
327
+
328
+ # Outputs non-array value in the form of hash
329
+ # For object, use to_hash. Otherwise, just return the value
330
+ # @param [Object] value Any valid value
331
+ # @return [Hash] Returns the value in the form of hash
332
+ def _to_hash(value)
333
+ if value.is_a?(Array)
334
+ value.compact.map { |v| _to_hash(v) }
335
+ elsif value.is_a?(Hash)
336
+ {}.tap do |hash|
337
+ value.each { |k, v| hash[k] = _to_hash(v) }
338
+ end
339
+ elsif value.respond_to? :to_hash
340
+ value.to_hash
341
+ else
342
+ value
343
+ end
344
+ end
345
+ end
346
+ end