Module: CodexSDK::Items
- Defined in:
- lib/codex_sdk/items.rb
Defined Under Namespace
Classes: AgentMessage, CommandExecution, Error, FileChange, McpToolCall, Reasoning, TodoList, Unknown, WebSearch
Class Method Summary collapse
-
.parse(data) ⇒ Object
Parse a JSON hash into a typed item.
Class Method Details
.parse(data) ⇒ Object
Parse a JSON hash into a typed item.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/codex_sdk/items.rb', line 6 def self.parse(data) case data["type"] when "agent_message" then AgentMessage.from_json(data) when "reasoning" then Reasoning.from_json(data) when "command_execution" then CommandExecution.from_json(data) when "file_change" then FileChange.from_json(data) when "mcp_tool_call" then McpToolCall.from_json(data) when "web_search" then WebSearch.from_json(data) when "todo_list" then TodoList.from_json(data) when "error" then Error.from_json(data) else Unknown.new(id: data["id"], type: data["type"], data: data) end end |