Class: Legion::Gaia::OutputFrame

Inherits:
Data
  • Object
show all
Defined in:
lib/legion/gaia/output_frame.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, channel_id:, id: SecureRandom.uuid, in_reply_to: nil, content_type: :text, session_continuity_id: nil, channel_hints: {}, metadata: {}, created_at: Time.now.utc) ⇒ OutputFrame

Returns a new instance of OutputFrame.



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/legion/gaia/output_frame.rb', line 18

def initialize(
  content:,
  channel_id:,
  id: SecureRandom.uuid,
  in_reply_to: nil,
  content_type: :text,
  session_continuity_id: nil,
  channel_hints: {},
  metadata: {},
  created_at: Time.now.utc
)
  super
end

Instance Attribute Details

#channel_hintsObject (readonly)

Returns the value of attribute channel_hints

Returns:

  • (Object)

    the current value of channel_hints



7
8
9
# File 'lib/legion/gaia/output_frame.rb', line 7

def channel_hints
  @channel_hints
end

#channel_idObject (readonly)

Returns the value of attribute channel_id

Returns:

  • (Object)

    the current value of channel_id



7
8
9
# File 'lib/legion/gaia/output_frame.rb', line 7

def channel_id
  @channel_id
end

#contentObject (readonly)

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



7
8
9
# File 'lib/legion/gaia/output_frame.rb', line 7

def content
  @content
end

#content_typeObject (readonly)

Returns the value of attribute content_type

Returns:

  • (Object)

    the current value of content_type



7
8
9
# File 'lib/legion/gaia/output_frame.rb', line 7

def content_type
  @content_type
end

#created_atObject (readonly)

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



7
8
9
# File 'lib/legion/gaia/output_frame.rb', line 7

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



7
8
9
# File 'lib/legion/gaia/output_frame.rb', line 7

def id
  @id
end

#in_reply_toObject (readonly)

Returns the value of attribute in_reply_to

Returns:

  • (Object)

    the current value of in_reply_to



7
8
9
# File 'lib/legion/gaia/output_frame.rb', line 7

def in_reply_to
  @in_reply_to
end

#metadataObject (readonly)

Returns the value of attribute metadata

Returns:

  • (Object)

    the current value of metadata



7
8
9
# File 'lib/legion/gaia/output_frame.rb', line 7

def 
  @metadata
end

#session_continuity_idObject (readonly)

Returns the value of attribute session_continuity_id

Returns:

  • (Object)

    the current value of session_continuity_id



7
8
9
# File 'lib/legion/gaia/output_frame.rb', line 7

def session_continuity_id
  @session_continuity_id
end

Instance Method Details

#suggest_richer_channel?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/legion/gaia/output_frame.rb', line 36

def suggest_richer_channel?
  channel_hints[:suggest_channel_switch] == true
end

#text?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/legion/gaia/output_frame.rb', line 32

def text?
  content_type == :text
end

#truncated?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/legion/gaia/output_frame.rb', line 40

def truncated?
  channel_hints[:truncated] == true
end