Class: Daytona::ComputerUse::Keyboard
- Inherits:
-
Object
- Object
- Daytona::ComputerUse::Keyboard
- Defined in:
- lib/daytona/computer_use.rb
Overview
Keyboard operations for computer use functionality.
Instance Attribute Summary collapse
-
#sandbox_id ⇒ String
readonly
The ID of the sandbox.
-
#toolbox_api ⇒ DaytonaToolboxApiClient::ComputerUseApi
readonly
API client for sandbox operations.
Instance Method Summary collapse
-
#hotkey(keys:) ⇒ void
Presses a hotkey combination.
-
#initialize(sandbox_id:, toolbox_api:) ⇒ Keyboard
constructor
A new instance of Keyboard.
-
#press(key:, modifiers: nil) ⇒ void
Presses a key with optional modifiers.
-
#type(text:, delay: nil) ⇒ void
Types the specified text.
Constructor Details
#initialize(sandbox_id:, toolbox_api:) ⇒ Keyboard
Returns a new instance of Keyboard.
129 130 131 132 |
# File 'lib/daytona/computer_use.rb', line 129 def initialize(sandbox_id:, toolbox_api:) @sandbox_id = sandbox_id @toolbox_api = toolbox_api end |
Instance Attribute Details
#sandbox_id ⇒ String (readonly)
Returns The ID of the sandbox.
122 123 124 |
# File 'lib/daytona/computer_use.rb', line 122 def sandbox_id @sandbox_id end |
#toolbox_api ⇒ DaytonaToolboxApiClient::ComputerUseApi (readonly)
Returns API client for sandbox operations.
125 126 127 |
# File 'lib/daytona/computer_use.rb', line 125 def toolbox_api @toolbox_api end |
Instance Method Details
#hotkey(keys:) ⇒ void
This method returns an undefined value.
Presses a hotkey combination.
191 192 193 194 195 196 |
# File 'lib/daytona/computer_use.rb', line 191 def hotkey(keys:) request = DaytonaToolboxApiClient::KeyboardHotkeyRequest.new(keys:) toolbox_api.press_hotkey(request) rescue StandardError => e raise Sdk::Error, "Failed to press hotkey: #{e.}" end |
#press(key:, modifiers: nil) ⇒ void
This method returns an undefined value.
Presses a key with optional modifiers.
169 170 171 172 173 174 |
# File 'lib/daytona/computer_use.rb', line 169 def press(key:, modifiers: nil) request = DaytonaToolboxApiClient::KeyboardPressRequest.new(key:, modifiers: modifiers || []) toolbox_api.press_key(request) rescue StandardError => e raise Sdk::Error, "Failed to press key: #{e.}" end |
#type(text:, delay: nil) ⇒ void
This method returns an undefined value.
Types the specified text.
146 147 148 149 150 151 |
# File 'lib/daytona/computer_use.rb', line 146 def type(text:, delay: nil) request = DaytonaToolboxApiClient::KeyboardTypeRequest.new(text:, delay:) toolbox_api.type_text(request) rescue StandardError => e raise Sdk::Error, "Failed to type text: #{e.}" end |