Class: ActionAgent::RecordingAction
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ActionAgent::RecordingAction
- Defined in:
- app/models/action_agent/recording_action.rb
Constant Summary collapse
- ACTION_TYPES =
%w[ navigate click type scroll snapshot select hover drag file_upload dialog evaluate wait form_fill key_press focus submit handoff user_action completion ].freeze
Instance Method Summary collapse
-
#as_json_for_api ⇒ Object
Format for API response.
-
#browser_state ⇒ Object
Get browser state at this action (for handoff).
-
#dom_snapshot_content ⇒ Object
Get the DOM snapshot content.
-
#screenshot_url(expires_in: 15.minutes) ⇒ Object
Get the screenshot URL (signed URL from storage).
Methods inherited from ApplicationRecord
Instance Method Details
#as_json_for_api ⇒ Object
Format for API response
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/models/action_agent/recording_action.rb', line 52 def as_json_for_api { id: id, action_type: action_type, sequence: sequence, timestamp_ms: , selector: selector, value: redacted_value, screenshot_url: screenshot_url, has_dom_snapshot: dom_snapshot_key.present?, metadata: , created_at: created_at.iso8601 } end |
#browser_state ⇒ Object
Get browser state at this action (for handoff)
68 69 70 71 72 73 74 75 76 |
# File 'app/models/action_agent/recording_action.rb', line 68 def browser_state { url: extract_url, form_values: ["form_values"], scroll_position: ["scroll_position"], active_element: selector, action_type: action_type } end |
#dom_snapshot_content ⇒ Object
Get the DOM snapshot content
45 46 47 48 49 |
# File 'app/models/action_agent/recording_action.rb', line 45 def dom_snapshot_content return nil unless dom_snapshot_key.present? SessionRecordingService.fetch_snapshot(dom_snapshot_key) end |
#screenshot_url(expires_in: 15.minutes) ⇒ Object
Get the screenshot URL (signed URL from storage)
38 39 40 41 42 |
# File 'app/models/action_agent/recording_action.rb', line 38 def screenshot_url(expires_in: 15.minutes) return nil unless screenshot_key.present? SessionRecordingService.signed_url_for(screenshot_key, expires_in: expires_in) end |