Class: Sendly::SuggestRepliesResponse
- Inherits:
-
Object
- Object
- Sendly::SuggestRepliesResponse
- Includes:
- Enumerable
- Defined in:
- lib/sendly/types.rb
Instance Attribute Summary collapse
-
#based_on_message_id ⇒ String?
readonly
ID of the inbound message the suggestions are based on.
-
#model ⇒ String?
readonly
Model that generated the suggestions.
-
#suggestions ⇒ Array<SuggestedReply>
readonly
AI-generated reply suggestions.
Instance Method Summary collapse
- #count ⇒ Object (also: #size, #length)
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
- #first ⇒ Object
-
#initialize(data) ⇒ SuggestRepliesResponse
constructor
A new instance of SuggestRepliesResponse.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ SuggestRepliesResponse
Returns a new instance of SuggestRepliesResponse.
713 714 715 716 717 |
# File 'lib/sendly/types.rb', line 713 def initialize(data) @suggestions = (data["suggestions"] || []).map { |s| SuggestedReply.new(s) } @based_on_message_id = data["basedOnMessageId"] || data["based_on_message_id"] @model = data["model"] end |
Instance Attribute Details
#based_on_message_id ⇒ String? (readonly)
Returns ID of the inbound message the suggestions are based on.
708 709 710 |
# File 'lib/sendly/types.rb', line 708 def @based_on_message_id end |
#model ⇒ String? (readonly)
Returns Model that generated the suggestions.
711 712 713 |
# File 'lib/sendly/types.rb', line 711 def model @model end |
#suggestions ⇒ Array<SuggestedReply> (readonly)
Returns AI-generated reply suggestions.
705 706 707 |
# File 'lib/sendly/types.rb', line 705 def suggestions @suggestions end |
Instance Method Details
#count ⇒ Object Also known as: size, length
723 724 725 |
# File 'lib/sendly/types.rb', line 723 def count suggestions.length end |
#each(&block) ⇒ Object
719 720 721 |
# File 'lib/sendly/types.rb', line 719 def each(&block) suggestions.each(&block) end |
#empty? ⇒ Boolean
730 731 732 |
# File 'lib/sendly/types.rb', line 730 def empty? suggestions.empty? end |
#first ⇒ Object
734 735 736 |
# File 'lib/sendly/types.rb', line 734 def first suggestions.first end |
#to_h ⇒ Object
738 739 740 741 742 743 744 |
# File 'lib/sendly/types.rb', line 738 def to_h { suggestions: suggestions.map(&:to_h), based_on_message_id: , model: model }.compact end |