Class: BotPlatform::State::BotState

Inherits:
Object
  • Object
show all
Includes:
Asserts
Defined in:
lib/bot_platform/state/bot_state.rb

Direct Known Subclasses

ConversationState, UserState

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(storage, service_key) ⇒ BotState

Returns a new instance of BotState.



9
10
11
12
# File 'lib/bot_platform/state/bot_state.rb', line 9

def initialize(storage, service_key)
  @storage = storage
  @service_key = service_key
end

Instance Attribute Details

#service_keyObject

Returns the value of attribute service_key.



8
9
10
# File 'lib/bot_platform/state/bot_state.rb', line 8

def service_key
  @service_key
end

#storageObject

Returns the value of attribute storage.



8
9
10
# File 'lib/bot_platform/state/bot_state.rb', line 8

def storage
  @storage
end

Instance Method Details

#create_property(key) ⇒ Object



14
15
16
17
# File 'lib/bot_platform/state/bot_state.rb', line 14

def create_property(key)
  @storage.data[key.to_sym] = {}
  return @storage.data[key.to_sym]
end

#get_property(key) ⇒ Object



19
20
21
# File 'lib/bot_platform/state/bot_state.rb', line 19

def get_property(key)
  return @storage.data[key.to_sym]
end

#save_changes(turn_context, force = false) ⇒ Object



23
24
25
26
27
# File 'lib/bot_platform/state/bot_state.rb', line 23

def save_changes(turn_context, force=false)
  assert_turn_context_is_valid turn_context

  #TODO:
end