daytona 0.202.0 → 0.203.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d211705ef263fa492b31a4e32ffc3a1d6ff3dbd2429baa2fc03dcc60012672b
4
- data.tar.gz: 803fc638b4d11ac3c2435621f565967888ac68e1278081f382ad9977ec26aa94
3
+ metadata.gz: 57b147a70b0002de1953dcb42e98e4b5a1d6b6901637c5bc744905ae38e9e1f6
4
+ data.tar.gz: 1e08d695cb382017caf131b30f7679ed3701c6c14c6578cc00e53088a3e5d6d8
5
5
  SHA512:
6
- metadata.gz: a73eb35713a3d7bc507b9f5ef8290a2230c9accc2efd17dc2c6d6a9dc452ce1ac12d1453caba8c61e175743b488e22ad4876be8093a6208465c5071b33844b5e
7
- data.tar.gz: dbf474763c6e4254eba6bd65d7892a756879fd22f10401eb3576fc1ccb4b89c4fe4beeaa45bb6e611de1346a5507134e6c11a8f028991159f6f6cd60b4592231
6
+ metadata.gz: a6d5d0106b273bc5d0c457171624849b198a664d5ccd39924f79501d0cec11151fb2772f070f3a3a4064d89e6fc9966803fcab0409a5ea25cbbd816e85f12b77
7
+ data.tar.gz: 39d104c6d0d132034bd8453546e75b3675a801f9162051591ac74b94c4045ad268b4917a514ed5d831cd47bc670804eef0b054ceda75f159646976c8ca92fac4
data/README.md CHANGED
@@ -6,12 +6,20 @@ The SDK provides an interface for sandbox management, file system operations, Gi
6
6
 
7
7
  ## Installation
8
8
 
9
+ Requires **Ruby >= 3.2**. Check your version with `ruby -v` before installing — on older versions the install fails with a Bundler/RubyGems resolver error rather than a clear message.
10
+
9
11
  Install the package using **gem**:
10
12
 
11
13
  ```bash
12
14
  gem install daytona
13
15
  ```
14
16
 
17
+ or add it to your **Gemfile**:
18
+
19
+ ```ruby
20
+ gem 'daytona'
21
+ ```
22
+
15
23
  ## Get API key
16
24
 
17
25
  Generate an API key from the [Daytona Dashboard ↗](https://app.daytona.io/dashboard/keys) to authenticate SDK requests and access Daytona services. For more information, see the [API keys](https://www.daytona.io/docs/en/api-keys/) documentation.
@@ -182,3 +190,45 @@ completions = lsp_server.completions(
182
190
  position: Daytona::LspServer::Position.new(line: 10, character: 15)
183
191
  )
184
192
  ```
193
+
194
+ ## List method return shapes
195
+
196
+ Each `list` method returns a different shape depending on the resource. The table below shows the exact return type and how to access the elements.
197
+
198
+ | Method | Return type | Shape | Access elements |
199
+ | --- | --- | --- | --- |
200
+ | `daytona.snapshot.list(page:, limit:)` | `Daytona::PaginatedResource` | Paginated wrapper | `result.items.each` |
201
+ | `daytona.secret.list(cursor:, limit:, ...)` | `Daytona::ListSecretsResponse` | Cursor-paginated wrapper | `page.items.each` |
202
+ | `daytona.volume.list` | `Array<Daytona::Volume>` | Bare array | iterate directly |
203
+ | `daytona.list(query)` | `Enumerator<Daytona::Sandbox>` | Lazy enumerator | `.each { \|s\| ... }` |
204
+
205
+ `PaginatedResource` and `ListSecretsResponse` are **wrapper objects**, not arrays. Calling `.each` or `.map` directly on them raises `NoMethodError`. Always go through `.items`:
206
+
207
+ ```ruby
208
+ # snapshots — page-number pagination
209
+ result = daytona.snapshot.list(page: 1, limit: 20)
210
+ # result.items => Array<Daytona::Snapshot>
211
+ # result.total => Float (total across all pages)
212
+ # result.page => Float (current page, 1-indexed)
213
+ # result.total_pages => Float
214
+ result.items.each { |snapshot| puts "#{snapshot.name} (#{snapshot.image_name})" }
215
+
216
+ # secrets — cursor pagination
217
+ cursor = nil
218
+ loop do
219
+ page = daytona.secret.list(cursor: cursor, limit: 100)
220
+ # page.items => Array<Daytona::Secret>
221
+ # page.total => Float
222
+ # page.next_cursor => String | nil (nil = no more pages)
223
+ page.items.each { |secret| puts secret.name }
224
+ cursor = page.next_cursor
225
+ break if cursor.nil?
226
+ end
227
+
228
+ # volumes — bare array, iterate directly
229
+ daytona.volume.list.each { |vol| puts vol.name }
230
+
231
+ # sandboxes — lazy enumerator, fetches pages on demand
232
+ query = Daytona::ListSandboxesQuery.new(labels: { 'env' => 'dev' })
233
+ daytona.list(query).each { |sandbox| puts sandbox.id }
234
+ ```
@@ -125,6 +125,12 @@ module Daytona
125
125
  class FileNotFoundError < NotFoundError; end
126
126
  class FileAccessDeniedError < ForbiddenError; end
127
127
 
128
+ # The supplied file path was rejected by the daemon (code `INVALID_FILE_PATH`).
129
+ class InvalidFilePathError < BadRequestError; end
130
+
131
+ # The daemon could not read the sandbox file (code `FILE_READ_FAILED`).
132
+ class FileReadFailedError < InternalServerError; end
133
+
128
134
  # Daemon: LSP
129
135
  class LspServerNotInitializedError < BadRequestError; end
130
136
 
@@ -175,6 +181,8 @@ module Daytona
175
181
  # Daemon: filesystem
176
182
  [SOURCE_DAEMON, 'FILE_NOT_FOUND'] => FileNotFoundError,
177
183
  [SOURCE_DAEMON, 'FILE_ACCESS_DENIED'] => FileAccessDeniedError,
184
+ [SOURCE_DAEMON, 'INVALID_FILE_PATH'] => InvalidFilePathError,
185
+ [SOURCE_DAEMON, 'FILE_READ_FAILED'] => FileReadFailedError,
178
186
 
179
187
  # Daemon: LSP
180
188
  [SOURCE_DAEMON, 'LSP_SERVER_NOT_INITIALIZED'] => LspServerNotInitializedError,
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Daytona
7
7
  module Sdk
8
- VERSION = '0.202.0'
8
+ VERSION = '0.203.0'
9
9
  end
10
10
  end
@@ -66,7 +66,8 @@ module Daytona
66
66
  # cursor = nil
67
67
  # loop do
68
68
  # page = daytona.secret.list(cursor:, limit: 100)
69
- # page.items.each { |secret| puts secret.name }
69
+ # puts "Fetched #{page.items.length} of #{page.total} secrets"
70
+ # page.items.each { |secret| puts "#{secret.name} (#{secret.id})" }
70
71
  # cursor = page.next_cursor
71
72
  # break if cursor.nil?
72
73
  # end
@@ -31,8 +31,9 @@ module Daytona
31
31
  #
32
32
  # @example
33
33
  # daytona = Daytona::Daytona.new
34
- # response = daytona.snapshot.list(page: 1, limit: 10)
35
- # snapshots.items.each { |snapshot| puts "#{snapshot.name} (#{snapshot.image_name})" }
34
+ # page = daytona.snapshot.list(page: 2, limit: 10)
35
+ # puts "Page #{page.page} of #{page.total_pages} (#{page.total} snapshots total)"
36
+ # page.items.each { |snapshot| puts "#{snapshot.name} (#{snapshot.image_name})" }
36
37
  def list(page: nil, limit: nil)
37
38
  raise Sdk::Error, 'page must be positive integer' if page && page < 1
38
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daytona
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.202.0
4
+ version: 0.203.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daytona Platforms Inc.
@@ -85,42 +85,42 @@ dependencies:
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 0.202.0
88
+ version: 0.203.0
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 0.202.0
95
+ version: 0.203.0
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: daytona_api_client
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 0.202.0
102
+ version: 0.203.0
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 0.202.0
109
+ version: 0.203.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: daytona_toolbox_api_client
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 0.202.0
116
+ version: 0.203.0
117
117
  type: :runtime
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 0.202.0
123
+ version: 0.203.0
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: dotenv
126
126
  requirement: !ruby/object:Gem::Requirement
@@ -184,7 +184,7 @@ dependencies:
184
184
  - !ruby/object:Gem::Version
185
185
  version: '0.6'
186
186
  description: 'High-level Ruby SDK for Daytona: sandboxes, git, filesystem, LSP, process,
187
- and object storage.'
187
+ and object storage. Requires Ruby >= 3.2.'
188
188
  email:
189
189
  - support@daytona.io
190
190
  executables: []