Class: BotPlatform::Dialogs::Dialog

Inherits:
Object
  • Object
show all
Includes:
Asserts
Defined in:
lib/bot_platform/dialogs/dialog.rb

Direct Known Subclasses

Prompts::Prompt, WaterfallDialog

Constant Summary collapse

END_OF_TURN =
"end_of_turn".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Asserts

#assert_activity_is_not_null, #assert_activity_list_is_not_null, #assert_activity_type_is_not_null, #assert_context_is_not_null, #assert_conversation_reference_is_not_null, #assert_dialog_context_is_valid, #assert_dialog_id_is_valid, #assert_dialog_is_uniq, #assert_dialog_is_valid, #assert_dialog_set_is_valid, #assert_dialog_state_is_valid, #assert_is_not_empty, #assert_middleware_is_not_null, #assert_middleware_list_is_not_null, #assert_prompt_options_is_valid, #assert_turn_context_is_valid, #assert_waterfall_step_context_is_valid

Constructor Details

#initialize(dialog_id) ⇒ Dialog

Returns a new instance of Dialog.



11
12
13
14
15
# File 'lib/bot_platform/dialogs/dialog.rb', line 11

def initialize(dialog_id)
  assert_dialog_id_is_valid dialog_id

  @id = dialog_id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/bot_platform/dialogs/dialog.rb', line 9

def id
  @id
end

Instance Method Details

#continue(dc) ⇒ Object

called after user has new activity params:

dc: DialogContext


26
27
28
29
# File 'lib/bot_platform/dialogs/dialog.rb', line 26

def continue(dc)
  # by default just stop the dialog
  return dc.stop
end

#reprompt(turn_context, instance) ⇒ Object

not-implemented



40
41
# File 'lib/bot_platform/dialogs/dialog.rb', line 40

def reprompt(turn_context, instance)
end

#resume(dc, result) ⇒ Object

called after pre-dialog was poped params:

dc: DialogContext


34
35
36
37
# File 'lib/bot_platform/dialogs/dialog.rb', line 34

def resume(dc, result)
  # by default just stop the dialog
  stop result
end

#start(dc) ⇒ Object

abstract start the instance when ready



19
20
21
# File 'lib/bot_platform/dialogs/dialog.rb', line 19

def start(dc)
  raise "unimplemented"
end

#stop(result) ⇒ Object

called by #DialogContext#stop_active_dialog if need to stop dialog



44
45
# File 'lib/bot_platform/dialogs/dialog.rb', line 44

def stop(result)
end