Class: Sendly::EnhancedMessage
- Inherits:
-
Object
- Object
- Sendly::EnhancedMessage
- Defined in:
- lib/sendly/types.rb
Overview
Represents the result of an AI message enhancement.
Instance Attribute Summary collapse
-
#enhanced ⇒ String
readonly
The rewritten message, capped at 160 characters (one SMS segment).
-
#explanation ⇒ String
readonly
Short explanation of what changed (empty on the fallback path).
-
#model ⇒ String?
readonly
The model that produced the enhancement, when available.
-
#raw ⇒ Hash
readonly
The raw parsed response.
Instance Method Summary collapse
-
#initialize(data) ⇒ EnhancedMessage
constructor
A new instance of EnhancedMessage.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ EnhancedMessage
Returns a new instance of EnhancedMessage.
278 279 280 281 282 283 |
# File 'lib/sendly/types.rb', line 278 def initialize(data) @raw = data @enhanced = data["enhanced"] @explanation = data["explanation"] || "" @model = data["model"] end |
Instance Attribute Details
#enhanced ⇒ String (readonly)
Returns The rewritten message, capped at 160 characters (one SMS segment). Falls back to the original text when AI is unavailable.
267 268 269 |
# File 'lib/sendly/types.rb', line 267 def enhanced @enhanced end |
#explanation ⇒ String (readonly)
Returns Short explanation of what changed (empty on the fallback path).
270 271 272 |
# File 'lib/sendly/types.rb', line 270 def explanation @explanation end |
#model ⇒ String? (readonly)
Returns The model that produced the enhancement, when available.
273 274 275 |
# File 'lib/sendly/types.rb', line 273 def model @model end |
#raw ⇒ Hash (readonly)
Returns The raw parsed response.
276 277 278 |
# File 'lib/sendly/types.rb', line 276 def raw @raw end |
Instance Method Details
#to_h ⇒ Object
285 286 287 |
# File 'lib/sendly/types.rb', line 285 def to_h { enhanced: enhanced, explanation: explanation, model: model }.compact end |