Class: Sendly::EnhancedMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/sendly/types.rb

Overview

Represents the result of an AI message enhancement.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#enhancedString (readonly)

Returns The rewritten message, capped at 160 characters (one SMS segment). Falls back to the original text when AI is unavailable.

Returns:

  • (String)

    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

#explanationString (readonly)

Returns Short explanation of what changed (empty on the fallback path).

Returns:

  • (String)

    Short explanation of what changed (empty on the fallback path)



270
271
272
# File 'lib/sendly/types.rb', line 270

def explanation
  @explanation
end

#modelString? (readonly)

Returns The model that produced the enhancement, when available.

Returns:

  • (String, nil)

    The model that produced the enhancement, when available



273
274
275
# File 'lib/sendly/types.rb', line 273

def model
  @model
end

#rawHash (readonly)

Returns The raw parsed response.

Returns:

  • (Hash)

    The raw parsed response



276
277
278
# File 'lib/sendly/types.rb', line 276

def raw
  @raw
end

Instance Method Details

#to_hObject



285
286
287
# File 'lib/sendly/types.rb', line 285

def to_h
  { enhanced: enhanced, explanation: explanation, model: model }.compact
end