Class: BotPlatform::State::UserState

Inherits:
BotState
  • Object
show all
Defined in:
lib/bot_platform/state/user_state.rb

Instance Attribute Summary

Attributes inherited from BotState

#service_key, #storage

Instance Method Summary collapse

Methods inherited from BotState

#create_property, #get_property, #save_changes

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) ⇒ UserState

Returns a new instance of UserState.



6
7
8
# File 'lib/bot_platform/state/user_state.rb', line 6

def initialize(storage)
  super(storage, "user_state")
end

Instance Method Details

#get_storage_key(turn_context) ⇒ Object



10
11
12
13
14
# File 'lib/bot_platform/state/user_state.rb', line 10

def get_storage_key(turn_context)
  channel_id = turn_context.activity.channel_id
  user_id = turn_context.from.user_id
  "#{channel_id}/users/#{user_id}"
end