daytona_api_client 0.202.0 → 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.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/Gemfile.lock +101 -0
- data/daytona_api_client.gemspec +4 -4
- data/lib/daytona_api_client/api/api_keys_api.rb +2 -2
- data/lib/daytona_api_client/api/audit_api.rb +140 -40
- data/lib/daytona_api_client/api/config_api.rb +1 -1
- data/lib/daytona_api_client/api/docker_registry_api.rb +67 -6
- data/lib/daytona_api_client/api/health_api.rb +3 -54
- data/lib/daytona_api_client/api/object_storage_api.rb +1 -1
- data/lib/daytona_api_client/api/organizations_api.rb +265 -1316
- data/lib/daytona_api_client/api/preview_api.rb +8 -202
- data/lib/daytona_api_client/api/runners_api.rb +22 -412
- data/lib/daytona_api_client/api/sandbox_api.rb +434 -2352
- data/lib/daytona_api_client/api/snapshots_api.rb +113 -39
- data/lib/daytona_api_client/api/toolbox_api.rb +5108 -0
- data/lib/daytona_api_client/api/users_api.rb +239 -2
- data/lib/daytona_api_client/api/volumes_api.rb +2 -2
- data/lib/daytona_api_client/api/webhooks_api.rb +164 -27
- data/lib/daytona_api_client/api/workspace_api.rb +955 -0
- data/lib/daytona_api_client/api_client.rb +4 -8
- data/lib/daytona_api_client/api_error.rb +1 -1
- data/lib/daytona_api_client/configuration.rb +2 -5
- data/lib/daytona_api_client/models/account_provider.rb +74 -3
- data/lib/daytona_api_client/models/announcement.rb +74 -3
- data/lib/daytona_api_client/models/api_key_list.rb +74 -3
- data/lib/daytona_api_client/models/api_key_response.rb +74 -3
- data/lib/daytona_api_client/models/audit_log.rb +75 -22
- data/lib/daytona_api_client/models/build_info.rb +78 -34
- data/lib/daytona_api_client/models/{create_runner_response.rb → command.rb} +104 -23
- data/lib/daytona_api_client/models/completion_context.rb +244 -0
- data/lib/daytona_api_client/models/completion_item.rb +289 -0
- data/lib/daytona_api_client/models/{paginated_traces.rb → completion_list.rb} +106 -91
- data/lib/daytona_api_client/models/compressed_screenshot_response.rb +256 -0
- data/lib/daytona_api_client/models/computer_use_start_response.rb +263 -0
- data/lib/daytona_api_client/models/{available_sandbox_class.rb → computer_use_status_response.rb} +97 -86
- data/lib/daytona_api_client/models/computer_use_stop_response.rb +263 -0
- data/lib/daytona_api_client/models/create_api_key.rb +75 -4
- data/lib/daytona_api_client/models/create_audit_log.rb +350 -0
- data/lib/daytona_api_client/models/create_build_info.rb +74 -3
- data/lib/daytona_api_client/models/create_docker_registry.rb +139 -7
- data/lib/daytona_api_client/models/create_linked_account.rb +74 -3
- data/lib/daytona_api_client/models/create_organization.rb +78 -34
- data/lib/daytona_api_client/models/create_organization_invitation.rb +76 -5
- data/lib/daytona_api_client/models/create_organization_quota.rb +78 -26
- data/lib/daytona_api_client/models/create_organization_role.rb +74 -3
- data/lib/daytona_api_client/models/create_runner.rb +386 -43
- data/lib/daytona_api_client/models/create_sandbox.rb +117 -76
- data/lib/daytona_api_client/models/{signed_port_preview_url.rb → create_session_request.rb} +93 -103
- data/lib/daytona_api_client/models/create_snapshot.rb +88 -61
- data/lib/daytona_api_client/models/create_user.rb +77 -15
- data/lib/daytona_api_client/models/create_volume.rb +74 -3
- data/lib/daytona_api_client/models/create_workspace.rb +411 -0
- data/lib/daytona_api_client/models/daytona_configuration.rb +78 -64
- data/lib/daytona_api_client/models/display_info_response.rb +238 -0
- data/lib/daytona_api_client/models/docker_registry.rb +76 -5
- data/lib/daytona_api_client/models/{paginated_jobs.rb → download_files.rb} +94 -100
- data/lib/daytona_api_client/models/{create_warm_pool.rb → execute_request.rb} +106 -62
- data/lib/daytona_api_client/models/execute_response.rb +263 -0
- data/lib/daytona_api_client/models/file_info.rb +417 -0
- data/lib/daytona_api_client/models/{secret.rb → file_status.rb} +122 -121
- data/lib/daytona_api_client/models/git_add_request.rb +264 -0
- data/lib/daytona_api_client/models/{admin_create_organization.rb → git_branch_request.rb} +95 -53
- data/lib/daytona_api_client/models/git_checkout_request.rb +261 -0
- data/lib/daytona_api_client/models/{toolbox_proxy_url.rb → git_clone_request.rb} +142 -10
- data/lib/daytona_api_client/models/{trace_span.rb → git_commit_info.rb} +148 -141
- data/lib/daytona_api_client/models/git_commit_request.rb +325 -0
- data/lib/daytona_api_client/models/{runner_healthcheck.rb → git_commit_response.rb} +92 -74
- data/lib/daytona_api_client/models/{create_secret.rb → git_delete_branch_request.rb} +106 -59
- data/lib/daytona_api_client/models/{snapshot_manager_credentials.rb → git_repo_request.rb} +96 -35
- data/lib/daytona_api_client/models/git_status.rb +290 -0
- data/lib/daytona_api_client/models/health_controller_check200_response.rb +74 -3
- data/lib/daytona_api_client/models/health_controller_check200_response_info_value.rb +74 -3
- data/lib/daytona_api_client/models/health_controller_check503_response.rb +74 -3
- data/lib/daytona_api_client/models/{create_sandbox_snapshot.rb → keyboard_hotkey_request.rb} +93 -34
- data/lib/daytona_api_client/models/{create_region_response.rb → keyboard_press_request.rb} +102 -63
- data/lib/daytona_api_client/models/keyboard_type_request.rb +246 -0
- data/lib/daytona_api_client/models/list_branch_response.rb +237 -0
- data/lib/daytona_api_client/models/lsp_completion_params.rb +325 -0
- data/lib/daytona_api_client/models/lsp_document_request.rb +290 -0
- data/lib/daytona_api_client/models/lsp_location.rb +261 -0
- data/lib/daytona_api_client/models/lsp_server_request.rb +263 -0
- data/lib/daytona_api_client/models/lsp_symbol.rb +287 -0
- data/lib/daytona_api_client/models/match.rb +287 -0
- data/lib/daytona_api_client/models/mouse_click_request.rb +283 -0
- data/lib/daytona_api_client/models/mouse_click_response.rb +263 -0
- data/lib/daytona_api_client/models/mouse_drag_request.rb +327 -0
- data/lib/daytona_api_client/models/mouse_drag_response.rb +263 -0
- data/lib/daytona_api_client/models/mouse_move_request.rb +263 -0
- data/lib/daytona_api_client/models/mouse_move_response.rb +263 -0
- data/lib/daytona_api_client/models/mouse_position.rb +263 -0
- data/lib/daytona_api_client/models/mouse_scroll_request.rb +300 -0
- data/lib/daytona_api_client/models/mouse_scroll_response.rb +236 -0
- data/lib/daytona_api_client/models/oidc_config.rb +74 -3
- data/lib/daytona_api_client/models/organization.rb +159 -243
- data/lib/daytona_api_client/models/organization_invitation.rb +78 -7
- data/lib/daytona_api_client/models/organization_role.rb +74 -3
- data/lib/daytona_api_client/models/organization_sandbox_default_limited_network_egress.rb +74 -3
- data/lib/daytona_api_client/models/organization_suspension.rb +79 -10
- data/lib/daytona_api_client/models/organization_usage_overview.rb +220 -21
- data/lib/daytona_api_client/models/organization_user.rb +76 -5
- data/lib/daytona_api_client/models/paginated_audit_logs.rb +78 -17
- data/lib/daytona_api_client/models/{paginated_sandboxes_deprecated.rb → paginated_sandboxes.rb} +76 -5
- data/lib/daytona_api_client/models/paginated_snapshots.rb +74 -3
- data/lib/daytona_api_client/models/{paginated_logs.rb → paginated_snapshots_dto.rb} +77 -10
- data/lib/daytona_api_client/models/port_preview_url.rb +88 -34
- data/lib/daytona_api_client/models/position.rb +261 -0
- data/lib/daytona_api_client/models/posthog_config.rb +74 -3
- data/lib/daytona_api_client/models/process_errors_response.rb +263 -0
- data/lib/daytona_api_client/models/process_logs_response.rb +263 -0
- data/lib/daytona_api_client/models/process_restart_response.rb +263 -0
- data/lib/daytona_api_client/models/process_status_response.rb +263 -0
- data/lib/daytona_api_client/models/{update_last_activity.rb → project_dir_response.rb} +83 -13
- data/lib/daytona_api_client/models/pty_create_request.rb +288 -0
- data/lib/daytona_api_client/models/pty_create_response.rb +236 -0
- data/lib/daytona_api_client/models/{metric_data_point.rb → pty_list_response.rb} +95 -49
- data/lib/daytona_api_client/models/pty_resize_request.rb +263 -0
- data/lib/daytona_api_client/models/pty_session_info.rb +425 -0
- data/lib/daytona_api_client/models/range.rb +261 -0
- data/lib/daytona_api_client/models/region.rb +78 -181
- data/lib/daytona_api_client/models/{regenerate_api_key_response.rb → region_screenshot_response.rb} +113 -22
- data/lib/daytona_api_client/models/registry_push_access_dto.rb +74 -3
- data/lib/daytona_api_client/models/replace_request.rb +289 -0
- data/lib/daytona_api_client/models/{resize_sandbox.rb → replace_result.rb} +95 -84
- data/lib/daytona_api_client/models/runner.rb +215 -155
- data/lib/daytona_api_client/models/runner_snapshot_dto.rb +91 -3
- data/lib/daytona_api_client/models/runner_state.rb +3 -4
- data/lib/daytona_api_client/models/sandbox.rb +101 -164
- data/lib/daytona_api_client/models/sandbox_class.rb +6 -8
- data/lib/daytona_api_client/models/sandbox_desired_state.rb +3 -5
- data/lib/daytona_api_client/models/{create_region.rb → sandbox_info.rb} +113 -38
- data/lib/daytona_api_client/models/sandbox_labels.rb +74 -3
- data/lib/daytona_api_client/models/sandbox_state.rb +3 -10
- data/lib/daytona_api_client/models/sandbox_volume.rb +79 -18
- data/lib/daytona_api_client/models/screenshot_response.rb +256 -0
- data/lib/daytona_api_client/models/{runner_service_health.rb → search_files_response.rb} +94 -59
- data/lib/daytona_api_client/models/send_webhook_dto.rb +75 -26
- data/lib/daytona_api_client/models/session.rb +251 -0
- data/lib/daytona_api_client/models/{list_sandboxes_response.rb → session_execute_request.rb} +110 -34
- data/lib/daytona_api_client/models/session_execute_response.rb +239 -0
- data/lib/daytona_api_client/models/set_snapshot_general_status_dto.rb +74 -3
- data/lib/daytona_api_client/models/snapshot_dto.rb +78 -71
- data/lib/daytona_api_client/models/snapshot_state.rb +6 -5
- data/lib/daytona_api_client/models/ssh_access_dto.rb +78 -34
- data/lib/daytona_api_client/models/ssh_access_validation_dto.rb +98 -7
- data/lib/daytona_api_client/models/storage_access_dto.rb +78 -34
- data/lib/daytona_api_client/models/update_docker_registry.rb +74 -3
- data/lib/daytona_api_client/models/update_organization_invitation.rb +76 -5
- data/lib/daytona_api_client/models/update_organization_member_access.rb +76 -5
- data/lib/daytona_api_client/models/update_organization_quota.rb +115 -131
- data/lib/daytona_api_client/models/update_organization_role.rb +74 -3
- data/lib/daytona_api_client/models/update_sandbox_state_dto.rb +80 -29
- data/lib/daytona_api_client/models/user.rb +74 -3
- data/lib/daytona_api_client/models/{list_secrets_response.rb → user_home_dir_response.rb} +83 -72
- data/lib/daytona_api_client/models/user_public_key.rb +74 -3
- data/lib/daytona_api_client/models/volume_dto.rb +74 -3
- data/lib/daytona_api_client/models/volume_state.rb +3 -4
- data/lib/daytona_api_client/models/webhook_app_portal_access.rb +75 -31
- data/lib/daytona_api_client/models/{preview_warning.rb → webhook_controller_get_status200_response.rb} +76 -23
- data/lib/daytona_api_client/models/webhook_initialization_status.rb +74 -3
- data/lib/daytona_api_client/models/windows_response.rb +265 -0
- data/lib/daytona_api_client/models/{update_job_status.rb → work_dir_response.rb} +83 -72
- data/lib/daytona_api_client/models/{sandbox_list_item.rb → workspace.rb} +339 -193
- data/lib/daytona_api_client/version.rb +2 -2
- data/lib/daytona_api_client.rb +76 -74
- data/project.json +13 -38
- metadata +81 -83
- data/.gitignore +0 -39
- data/.openapi-generator/FILES +0 -163
- data/.openapi-generator/VERSION +0 -1
- data/.openapi-generator-ignore +0 -31
- data/.rspec +0 -2
- data/.rubocop.yml +0 -148
- data/fix-gemspec.sh +0 -11
- data/lib/daytona_api_client/api/admin_api.rb +0 -1615
- data/lib/daytona_api_client/api/jobs_api.rb +0 -299
- data/lib/daytona_api_client/api/regions_api.rb +0 -77
- data/lib/daytona_api_client/api/secret_api.rb +0 -441
- data/lib/daytona_api_client/api/warm_pools_api.rb +0 -286
- data/lib/daytona_api_client/api_model_base.rb +0 -88
- data/lib/daytona_api_client/models/admin_create_runner.rb +0 -326
- data/lib/daytona_api_client/models/admin_get_webhook_status200_response.rb +0 -147
- data/lib/daytona_api_client/models/create_organization_region_quota.rb +0 -375
- data/lib/daytona_api_client/models/date_filter.rb +0 -178
- data/lib/daytona_api_client/models/fork_sandbox.rb +0 -148
- data/lib/daytona_api_client/models/gpu_type.rb +0 -44
- data/lib/daytona_api_client/models/int_filter.rb +0 -222
- data/lib/daytona_api_client/models/job.rb +0 -366
- data/lib/daytona_api_client/models/job_status.rb +0 -43
- data/lib/daytona_api_client/models/job_type.rb +0 -55
- data/lib/daytona_api_client/models/log_entry.rb +0 -334
- data/lib/daytona_api_client/models/metric_series.rb +0 -194
- data/lib/daytona_api_client/models/metrics_response.rb +0 -167
- data/lib/daytona_api_client/models/organization_preview_warning.rb +0 -165
- data/lib/daytona_api_client/models/otel_config.rb +0 -188
- data/lib/daytona_api_client/models/poll_jobs_response.rb +0 -167
- data/lib/daytona_api_client/models/rate_limit_config.rb +0 -188
- data/lib/daytona_api_client/models/rate_limit_entry.rb +0 -158
- data/lib/daytona_api_client/models/region_quota.rb +0 -440
- data/lib/daytona_api_client/models/region_type.rb +0 -42
- data/lib/daytona_api_client/models/region_usage_overview.rb +0 -518
- data/lib/daytona_api_client/models/resolve_sandbox_secrets200_response_inner.rb +0 -176
- data/lib/daytona_api_client/models/runner_class.rb +0 -40
- data/lib/daytona_api_client/models/runner_full.rb +0 -757
- data/lib/daytona_api_client/models/runner_health_metrics.rb +0 -482
- data/lib/daytona_api_client/models/sandbox_list_sort_direction.rb +0 -41
- data/lib/daytona_api_client/models/sandbox_list_sort_field.rb +0 -45
- data/lib/daytona_api_client/models/string_filter.rb +0 -182
- data/lib/daytona_api_client/models/trace_summary.rb +0 -310
- data/lib/daytona_api_client/models/update_organization_default_region.rb +0 -165
- data/lib/daytona_api_client/models/update_organization_region_quota.rb +0 -302
- data/lib/daytona_api_client/models/update_region.rb +0 -171
- data/lib/daytona_api_client/models/update_sandbox_network_settings.rb +0 -168
- data/lib/daytona_api_client/models/update_sandbox_secrets.rb +0 -167
- data/lib/daytona_api_client/models/update_secret.rb +0 -170
- data/lib/daytona_api_client/models/update_warm_pool.rb +0 -174
- data/lib/daytona_api_client/models/url.rb +0 -165
- data/lib/daytona_api_client/models/warm_pool.rb +0 -490
- data/lib/daytona_api_client/models/webhook_event.rb +0 -46
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
|
7
7
|
Contact: support@daytona.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.12.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module DaytonaApiClient
|
|
17
|
-
class BuildInfo
|
|
17
|
+
class BuildInfo
|
|
18
18
|
# The Dockerfile content used for the build
|
|
19
19
|
attr_accessor :dockerfile_content
|
|
20
20
|
|
|
@@ -27,17 +27,13 @@ module DaytonaApiClient
|
|
|
27
27
|
# The last update timestamp
|
|
28
28
|
attr_accessor :updated_at
|
|
29
29
|
|
|
30
|
-
# The snapshot reference
|
|
31
|
-
attr_accessor :snapshot_ref
|
|
32
|
-
|
|
33
30
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
31
|
def self.attribute_map
|
|
35
32
|
{
|
|
36
33
|
:'dockerfile_content' => :'dockerfileContent',
|
|
37
34
|
:'context_hashes' => :'contextHashes',
|
|
38
35
|
:'created_at' => :'createdAt',
|
|
39
|
-
:'updated_at' => :'updatedAt'
|
|
40
|
-
:'snapshot_ref' => :'snapshotRef'
|
|
36
|
+
:'updated_at' => :'updatedAt'
|
|
41
37
|
}
|
|
42
38
|
end
|
|
43
39
|
|
|
@@ -57,8 +53,7 @@ module DaytonaApiClient
|
|
|
57
53
|
:'dockerfile_content' => :'String',
|
|
58
54
|
:'context_hashes' => :'Array<String>',
|
|
59
55
|
:'created_at' => :'Time',
|
|
60
|
-
:'updated_at' => :'Time'
|
|
61
|
-
:'snapshot_ref' => :'String'
|
|
56
|
+
:'updated_at' => :'Time'
|
|
62
57
|
}
|
|
63
58
|
end
|
|
64
59
|
|
|
@@ -105,12 +100,6 @@ module DaytonaApiClient
|
|
|
105
100
|
else
|
|
106
101
|
self.updated_at = nil
|
|
107
102
|
end
|
|
108
|
-
|
|
109
|
-
if attributes.key?(:'snapshot_ref')
|
|
110
|
-
self.snapshot_ref = attributes[:'snapshot_ref']
|
|
111
|
-
else
|
|
112
|
-
self.snapshot_ref = nil
|
|
113
|
-
end
|
|
114
103
|
end
|
|
115
104
|
|
|
116
105
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -126,10 +115,6 @@ module DaytonaApiClient
|
|
|
126
115
|
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
|
127
116
|
end
|
|
128
117
|
|
|
129
|
-
if @snapshot_ref.nil?
|
|
130
|
-
invalid_properties.push('invalid value for "snapshot_ref", snapshot_ref cannot be nil.')
|
|
131
|
-
end
|
|
132
|
-
|
|
133
118
|
invalid_properties
|
|
134
119
|
end
|
|
135
120
|
|
|
@@ -139,7 +124,6 @@ module DaytonaApiClient
|
|
|
139
124
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
140
125
|
return false if @created_at.nil?
|
|
141
126
|
return false if @updated_at.nil?
|
|
142
|
-
return false if @snapshot_ref.nil?
|
|
143
127
|
true
|
|
144
128
|
end
|
|
145
129
|
|
|
@@ -163,16 +147,6 @@ module DaytonaApiClient
|
|
|
163
147
|
@updated_at = updated_at
|
|
164
148
|
end
|
|
165
149
|
|
|
166
|
-
# Custom attribute writer method with validation
|
|
167
|
-
# @param [Object] snapshot_ref Value to be assigned
|
|
168
|
-
def snapshot_ref=(snapshot_ref)
|
|
169
|
-
if snapshot_ref.nil?
|
|
170
|
-
fail ArgumentError, 'snapshot_ref cannot be nil'
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
@snapshot_ref = snapshot_ref
|
|
174
|
-
end
|
|
175
|
-
|
|
176
150
|
# Checks equality by comparing each attribute.
|
|
177
151
|
# @param [Object] Object to be compared
|
|
178
152
|
def ==(o)
|
|
@@ -181,8 +155,7 @@ module DaytonaApiClient
|
|
|
181
155
|
dockerfile_content == o.dockerfile_content &&
|
|
182
156
|
context_hashes == o.context_hashes &&
|
|
183
157
|
created_at == o.created_at &&
|
|
184
|
-
updated_at == o.updated_at
|
|
185
|
-
snapshot_ref == o.snapshot_ref
|
|
158
|
+
updated_at == o.updated_at
|
|
186
159
|
end
|
|
187
160
|
|
|
188
161
|
# @see the `==` method
|
|
@@ -194,7 +167,7 @@ module DaytonaApiClient
|
|
|
194
167
|
# Calculates hash code according to all attributes.
|
|
195
168
|
# @return [Integer] Hash code
|
|
196
169
|
def hash
|
|
197
|
-
[dockerfile_content, context_hashes, created_at, updated_at
|
|
170
|
+
[dockerfile_content, context_hashes, created_at, updated_at].hash
|
|
198
171
|
end
|
|
199
172
|
|
|
200
173
|
# Builds the object from hash
|
|
@@ -220,6 +193,61 @@ module DaytonaApiClient
|
|
|
220
193
|
new(transformed_hash)
|
|
221
194
|
end
|
|
222
195
|
|
|
196
|
+
# Deserializes the data based on type
|
|
197
|
+
# @param string type Data type
|
|
198
|
+
# @param string value Value to be deserialized
|
|
199
|
+
# @return [Object] Deserialized data
|
|
200
|
+
def self._deserialize(type, value)
|
|
201
|
+
case type.to_sym
|
|
202
|
+
when :Time
|
|
203
|
+
Time.parse(value)
|
|
204
|
+
when :Date
|
|
205
|
+
Date.parse(value)
|
|
206
|
+
when :String
|
|
207
|
+
value.to_s
|
|
208
|
+
when :Integer
|
|
209
|
+
value.to_i
|
|
210
|
+
when :Float
|
|
211
|
+
value.to_f
|
|
212
|
+
when :Boolean
|
|
213
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
214
|
+
true
|
|
215
|
+
else
|
|
216
|
+
false
|
|
217
|
+
end
|
|
218
|
+
when :Object
|
|
219
|
+
# generic object (usually a Hash), return directly
|
|
220
|
+
value
|
|
221
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
222
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
223
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
224
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
225
|
+
k_type = Regexp.last_match[:k_type]
|
|
226
|
+
v_type = Regexp.last_match[:v_type]
|
|
227
|
+
{}.tap do |hash|
|
|
228
|
+
value.each do |k, v|
|
|
229
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
else # model
|
|
233
|
+
# models (e.g. Pet) or oneOf
|
|
234
|
+
klass = DaytonaApiClient.const_get(type)
|
|
235
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Returns the string representation of the object
|
|
240
|
+
# @return [String] String presentation of the object
|
|
241
|
+
def to_s
|
|
242
|
+
to_hash.to_s
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
246
|
+
# @return [Hash] Returns the object in the form of hash
|
|
247
|
+
def to_body
|
|
248
|
+
to_hash
|
|
249
|
+
end
|
|
250
|
+
|
|
223
251
|
# Returns the object in the form of hash
|
|
224
252
|
# @return [Hash] Returns the object in the form of hash
|
|
225
253
|
def to_hash
|
|
@@ -236,6 +264,22 @@ module DaytonaApiClient
|
|
|
236
264
|
hash
|
|
237
265
|
end
|
|
238
266
|
|
|
267
|
+
# Outputs non-array value in the form of hash
|
|
268
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
269
|
+
# @param [Object] value Any valid value
|
|
270
|
+
# @return [Hash] Returns the value in the form of hash
|
|
271
|
+
def _to_hash(value)
|
|
272
|
+
if value.is_a?(Array)
|
|
273
|
+
value.compact.map { |v| _to_hash(v) }
|
|
274
|
+
elsif value.is_a?(Hash)
|
|
275
|
+
{}.tap do |hash|
|
|
276
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
277
|
+
end
|
|
278
|
+
elsif value.respond_to? :to_hash
|
|
279
|
+
value.to_hash
|
|
280
|
+
else
|
|
281
|
+
value
|
|
282
|
+
end
|
|
283
|
+
end
|
|
239
284
|
end
|
|
240
|
-
|
|
241
285
|
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
|
7
7
|
Contact: support@daytona.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.
|
|
9
|
+
Generator version: 7.12.0
|
|
10
10
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
@@ -14,18 +14,22 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module DaytonaApiClient
|
|
17
|
-
class
|
|
18
|
-
# The ID of the
|
|
17
|
+
class Command
|
|
18
|
+
# The ID of the command
|
|
19
19
|
attr_accessor :id
|
|
20
20
|
|
|
21
|
-
# The
|
|
22
|
-
attr_accessor :
|
|
21
|
+
# The command that was executed
|
|
22
|
+
attr_accessor :command
|
|
23
|
+
|
|
24
|
+
# The exit code of the command
|
|
25
|
+
attr_accessor :exit_code
|
|
23
26
|
|
|
24
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
28
|
def self.attribute_map
|
|
26
29
|
{
|
|
27
30
|
:'id' => :'id',
|
|
28
|
-
:'
|
|
31
|
+
:'command' => :'command',
|
|
32
|
+
:'exit_code' => :'exitCode'
|
|
29
33
|
}
|
|
30
34
|
end
|
|
31
35
|
|
|
@@ -43,7 +47,8 @@ module DaytonaApiClient
|
|
|
43
47
|
def self.openapi_types
|
|
44
48
|
{
|
|
45
49
|
:'id' => :'String',
|
|
46
|
-
:'
|
|
50
|
+
:'command' => :'String',
|
|
51
|
+
:'exit_code' => :'Float'
|
|
47
52
|
}
|
|
48
53
|
end
|
|
49
54
|
|
|
@@ -57,14 +62,14 @@ module DaytonaApiClient
|
|
|
57
62
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
58
63
|
def initialize(attributes = {})
|
|
59
64
|
if (!attributes.is_a?(Hash))
|
|
60
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::
|
|
65
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::Command` initialize method"
|
|
61
66
|
end
|
|
62
67
|
|
|
63
68
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
64
69
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
65
70
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
66
71
|
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
67
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::
|
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::Command`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
68
73
|
end
|
|
69
74
|
h[k.to_sym] = v
|
|
70
75
|
}
|
|
@@ -75,10 +80,14 @@ module DaytonaApiClient
|
|
|
75
80
|
self.id = nil
|
|
76
81
|
end
|
|
77
82
|
|
|
78
|
-
if attributes.key?(:'
|
|
79
|
-
self.
|
|
83
|
+
if attributes.key?(:'command')
|
|
84
|
+
self.command = attributes[:'command']
|
|
80
85
|
else
|
|
81
|
-
self.
|
|
86
|
+
self.command = nil
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'exit_code')
|
|
90
|
+
self.exit_code = attributes[:'exit_code']
|
|
82
91
|
end
|
|
83
92
|
end
|
|
84
93
|
|
|
@@ -91,8 +100,8 @@ module DaytonaApiClient
|
|
|
91
100
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
92
101
|
end
|
|
93
102
|
|
|
94
|
-
if @
|
|
95
|
-
invalid_properties.push('invalid value for "
|
|
103
|
+
if @command.nil?
|
|
104
|
+
invalid_properties.push('invalid value for "command", command cannot be nil.')
|
|
96
105
|
end
|
|
97
106
|
|
|
98
107
|
invalid_properties
|
|
@@ -103,7 +112,7 @@ module DaytonaApiClient
|
|
|
103
112
|
def valid?
|
|
104
113
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
105
114
|
return false if @id.nil?
|
|
106
|
-
return false if @
|
|
115
|
+
return false if @command.nil?
|
|
107
116
|
true
|
|
108
117
|
end
|
|
109
118
|
|
|
@@ -118,13 +127,13 @@ module DaytonaApiClient
|
|
|
118
127
|
end
|
|
119
128
|
|
|
120
129
|
# Custom attribute writer method with validation
|
|
121
|
-
# @param [Object]
|
|
122
|
-
def
|
|
123
|
-
if
|
|
124
|
-
fail ArgumentError, '
|
|
130
|
+
# @param [Object] command Value to be assigned
|
|
131
|
+
def command=(command)
|
|
132
|
+
if command.nil?
|
|
133
|
+
fail ArgumentError, 'command cannot be nil'
|
|
125
134
|
end
|
|
126
135
|
|
|
127
|
-
@
|
|
136
|
+
@command = command
|
|
128
137
|
end
|
|
129
138
|
|
|
130
139
|
# Checks equality by comparing each attribute.
|
|
@@ -133,7 +142,8 @@ module DaytonaApiClient
|
|
|
133
142
|
return true if self.equal?(o)
|
|
134
143
|
self.class == o.class &&
|
|
135
144
|
id == o.id &&
|
|
136
|
-
|
|
145
|
+
command == o.command &&
|
|
146
|
+
exit_code == o.exit_code
|
|
137
147
|
end
|
|
138
148
|
|
|
139
149
|
# @see the `==` method
|
|
@@ -145,7 +155,7 @@ module DaytonaApiClient
|
|
|
145
155
|
# Calculates hash code according to all attributes.
|
|
146
156
|
# @return [Integer] Hash code
|
|
147
157
|
def hash
|
|
148
|
-
[id,
|
|
158
|
+
[id, command, exit_code].hash
|
|
149
159
|
end
|
|
150
160
|
|
|
151
161
|
# Builds the object from hash
|
|
@@ -171,6 +181,61 @@ module DaytonaApiClient
|
|
|
171
181
|
new(transformed_hash)
|
|
172
182
|
end
|
|
173
183
|
|
|
184
|
+
# Deserializes the data based on type
|
|
185
|
+
# @param string type Data type
|
|
186
|
+
# @param string value Value to be deserialized
|
|
187
|
+
# @return [Object] Deserialized data
|
|
188
|
+
def self._deserialize(type, value)
|
|
189
|
+
case type.to_sym
|
|
190
|
+
when :Time
|
|
191
|
+
Time.parse(value)
|
|
192
|
+
when :Date
|
|
193
|
+
Date.parse(value)
|
|
194
|
+
when :String
|
|
195
|
+
value.to_s
|
|
196
|
+
when :Integer
|
|
197
|
+
value.to_i
|
|
198
|
+
when :Float
|
|
199
|
+
value.to_f
|
|
200
|
+
when :Boolean
|
|
201
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
202
|
+
true
|
|
203
|
+
else
|
|
204
|
+
false
|
|
205
|
+
end
|
|
206
|
+
when :Object
|
|
207
|
+
# generic object (usually a Hash), return directly
|
|
208
|
+
value
|
|
209
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
210
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
211
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
212
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
213
|
+
k_type = Regexp.last_match[:k_type]
|
|
214
|
+
v_type = Regexp.last_match[:v_type]
|
|
215
|
+
{}.tap do |hash|
|
|
216
|
+
value.each do |k, v|
|
|
217
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
else # model
|
|
221
|
+
# models (e.g. Pet) or oneOf
|
|
222
|
+
klass = DaytonaApiClient.const_get(type)
|
|
223
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Returns the string representation of the object
|
|
228
|
+
# @return [String] String presentation of the object
|
|
229
|
+
def to_s
|
|
230
|
+
to_hash.to_s
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
234
|
+
# @return [Hash] Returns the object in the form of hash
|
|
235
|
+
def to_body
|
|
236
|
+
to_hash
|
|
237
|
+
end
|
|
238
|
+
|
|
174
239
|
# Returns the object in the form of hash
|
|
175
240
|
# @return [Hash] Returns the object in the form of hash
|
|
176
241
|
def to_hash
|
|
@@ -187,6 +252,22 @@ module DaytonaApiClient
|
|
|
187
252
|
hash
|
|
188
253
|
end
|
|
189
254
|
|
|
255
|
+
# Outputs non-array value in the form of hash
|
|
256
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
257
|
+
# @param [Object] value Any valid value
|
|
258
|
+
# @return [Hash] Returns the value in the form of hash
|
|
259
|
+
def _to_hash(value)
|
|
260
|
+
if value.is_a?(Array)
|
|
261
|
+
value.compact.map { |v| _to_hash(v) }
|
|
262
|
+
elsif value.is_a?(Hash)
|
|
263
|
+
{}.tap do |hash|
|
|
264
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
265
|
+
end
|
|
266
|
+
elsif value.respond_to? :to_hash
|
|
267
|
+
value.to_hash
|
|
268
|
+
else
|
|
269
|
+
value
|
|
270
|
+
end
|
|
271
|
+
end
|
|
190
272
|
end
|
|
191
|
-
|
|
192
273
|
end
|
|
@@ -0,0 +1,244 @@
|
|
|
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 CompletionContext
|
|
18
|
+
attr_accessor :trigger_kind
|
|
19
|
+
|
|
20
|
+
attr_accessor :trigger_character
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'trigger_kind' => :'triggerKind',
|
|
26
|
+
:'trigger_character' => :'triggerCharacter'
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns attribute mapping this model knows about
|
|
31
|
+
def self.acceptable_attribute_map
|
|
32
|
+
attribute_map
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Returns all the JSON keys this model knows about
|
|
36
|
+
def self.acceptable_attributes
|
|
37
|
+
acceptable_attribute_map.values
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Attribute type mapping.
|
|
41
|
+
def self.openapi_types
|
|
42
|
+
{
|
|
43
|
+
:'trigger_kind' => :'Float',
|
|
44
|
+
:'trigger_character' => :'String'
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# List of attributes with nullable: true
|
|
49
|
+
def self.openapi_nullable
|
|
50
|
+
Set.new([
|
|
51
|
+
])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Initializes the object
|
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
56
|
+
def initialize(attributes = {})
|
|
57
|
+
if (!attributes.is_a?(Hash))
|
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DaytonaApiClient::CompletionContext` initialize method"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
62
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
63
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
64
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
65
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DaytonaApiClient::CompletionContext`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
66
|
+
end
|
|
67
|
+
h[k.to_sym] = v
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if attributes.key?(:'trigger_kind')
|
|
71
|
+
self.trigger_kind = attributes[:'trigger_kind']
|
|
72
|
+
else
|
|
73
|
+
self.trigger_kind = nil
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if attributes.key?(:'trigger_character')
|
|
77
|
+
self.trigger_character = attributes[:'trigger_character']
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
82
|
+
# @return Array for valid properties with the reasons
|
|
83
|
+
def list_invalid_properties
|
|
84
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
85
|
+
invalid_properties = Array.new
|
|
86
|
+
if @trigger_kind.nil?
|
|
87
|
+
invalid_properties.push('invalid value for "trigger_kind", trigger_kind cannot be nil.')
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
invalid_properties
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Check to see if the all the properties in the model are valid
|
|
94
|
+
# @return true if the model is valid
|
|
95
|
+
def valid?
|
|
96
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
97
|
+
return false if @trigger_kind.nil?
|
|
98
|
+
true
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Custom attribute writer method with validation
|
|
102
|
+
# @param [Object] trigger_kind Value to be assigned
|
|
103
|
+
def trigger_kind=(trigger_kind)
|
|
104
|
+
if trigger_kind.nil?
|
|
105
|
+
fail ArgumentError, 'trigger_kind cannot be nil'
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
@trigger_kind = trigger_kind
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Checks equality by comparing each attribute.
|
|
112
|
+
# @param [Object] Object to be compared
|
|
113
|
+
def ==(o)
|
|
114
|
+
return true if self.equal?(o)
|
|
115
|
+
self.class == o.class &&
|
|
116
|
+
trigger_kind == o.trigger_kind &&
|
|
117
|
+
trigger_character == o.trigger_character
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# @see the `==` method
|
|
121
|
+
# @param [Object] Object to be compared
|
|
122
|
+
def eql?(o)
|
|
123
|
+
self == o
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Calculates hash code according to all attributes.
|
|
127
|
+
# @return [Integer] Hash code
|
|
128
|
+
def hash
|
|
129
|
+
[trigger_kind, trigger_character].hash
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Builds the object from hash
|
|
133
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
134
|
+
# @return [Object] Returns the model itself
|
|
135
|
+
def self.build_from_hash(attributes)
|
|
136
|
+
return nil unless attributes.is_a?(Hash)
|
|
137
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
138
|
+
transformed_hash = {}
|
|
139
|
+
openapi_types.each_pair do |key, type|
|
|
140
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
141
|
+
transformed_hash["#{key}"] = nil
|
|
142
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
143
|
+
# check to ensure the input is an array given that the attribute
|
|
144
|
+
# is documented as an array but the input is not
|
|
145
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
146
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
147
|
+
end
|
|
148
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
149
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
new(transformed_hash)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Deserializes the data based on type
|
|
156
|
+
# @param string type Data type
|
|
157
|
+
# @param string value Value to be deserialized
|
|
158
|
+
# @return [Object] Deserialized data
|
|
159
|
+
def self._deserialize(type, value)
|
|
160
|
+
case type.to_sym
|
|
161
|
+
when :Time
|
|
162
|
+
Time.parse(value)
|
|
163
|
+
when :Date
|
|
164
|
+
Date.parse(value)
|
|
165
|
+
when :String
|
|
166
|
+
value.to_s
|
|
167
|
+
when :Integer
|
|
168
|
+
value.to_i
|
|
169
|
+
when :Float
|
|
170
|
+
value.to_f
|
|
171
|
+
when :Boolean
|
|
172
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
173
|
+
true
|
|
174
|
+
else
|
|
175
|
+
false
|
|
176
|
+
end
|
|
177
|
+
when :Object
|
|
178
|
+
# generic object (usually a Hash), return directly
|
|
179
|
+
value
|
|
180
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
181
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
182
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
183
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
184
|
+
k_type = Regexp.last_match[:k_type]
|
|
185
|
+
v_type = Regexp.last_match[:v_type]
|
|
186
|
+
{}.tap do |hash|
|
|
187
|
+
value.each do |k, v|
|
|
188
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
else # model
|
|
192
|
+
# models (e.g. Pet) or oneOf
|
|
193
|
+
klass = DaytonaApiClient.const_get(type)
|
|
194
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Returns the string representation of the object
|
|
199
|
+
# @return [String] String presentation of the object
|
|
200
|
+
def to_s
|
|
201
|
+
to_hash.to_s
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
205
|
+
# @return [Hash] Returns the object in the form of hash
|
|
206
|
+
def to_body
|
|
207
|
+
to_hash
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Returns the object in the form of hash
|
|
211
|
+
# @return [Hash] Returns the object in the form of hash
|
|
212
|
+
def to_hash
|
|
213
|
+
hash = {}
|
|
214
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
215
|
+
value = self.send(attr)
|
|
216
|
+
if value.nil?
|
|
217
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
218
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
hash[param] = _to_hash(value)
|
|
222
|
+
end
|
|
223
|
+
hash
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Outputs non-array value in the form of hash
|
|
227
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
228
|
+
# @param [Object] value Any valid value
|
|
229
|
+
# @return [Hash] Returns the value in the form of hash
|
|
230
|
+
def _to_hash(value)
|
|
231
|
+
if value.is_a?(Array)
|
|
232
|
+
value.compact.map { |v| _to_hash(v) }
|
|
233
|
+
elsif value.is_a?(Hash)
|
|
234
|
+
{}.tap do |hash|
|
|
235
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
236
|
+
end
|
|
237
|
+
elsif value.respond_to? :to_hash
|
|
238
|
+
value.to_hash
|
|
239
|
+
else
|
|
240
|
+
value
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
end
|