Class: BotFramework::BotState
- Defined in:
- lib/bot_framework/bot_state.rb
Instance Attribute Summary
Attributes inherited from ApiBase
Instance Method Summary collapse
-
#delete_state_for_user(opts = {}) ⇒ Array<String>
DeleteStateForUser Delete all data for a user in a channel (UserData and PrivateConversationData).
-
#get_conversation_data(opts = {}) ⇒ BotData
GetConversationData get the bots data for all users in a conversation.
-
#get_private_conversation_data(opts = {}) ⇒ Object
GetPrivateConversationData get bot’s data for a single user in a conversation.
-
#get_user_data(opts = {}) ⇒ BotData
GetUserData Get a bots data for the user across all conversations.
-
#initialize(_service_url) ⇒ BotState
constructor
A new instance of BotState.
-
#set_conversation_data(opts = {}) ⇒ BotData
SetConversationData Update the bot’s data for all users in a conversation.
-
#set_private_conversation_data(opts = {}) ⇒ BotData
SetPrivateConversationData Update the bot’s data for a single user in a conversation.
-
#set_user_data(opts = {}) ⇒ BotData
SetUserData Update the bot’s data for a user.
Methods inherited from ApiBase
#api_delete, #api_get, #api_post, #api_request
Constructor Details
#initialize(_service_url) ⇒ BotState
Returns a new instance of BotState.
3 4 5 |
# File 'lib/bot_framework/bot_state.rb', line 3 def initialize(_service_url) @service_url = 'https://state.botframework.com' end |
Instance Method Details
#delete_state_for_user(opts = {}) ⇒ Array<String>
DeleteStateForUser Delete all data for a user in a channel (UserData and PrivateConversationData)
13 14 15 16 |
# File 'lib/bot_framework/bot_state.rb', line 13 def delete_state_for_user(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/users/#{opts['user_id']}" api_delete(uri) end |
#get_conversation_data(opts = {}) ⇒ BotData
GetConversationData get the bots data for all users in a conversation
25 26 27 28 29 |
# File 'lib/bot_framework/bot_state.rb', line 25 def get_conversation_data(opts = {}) # opts['channel_id'] & opts['conversation_id'] uri = "/v3/botstate/#{opts['channel_id']}/conversations/#{opts['conversation_id']}" BotFramework::BotData.new api_get(uri) end |
#get_private_conversation_data(opts = {}) ⇒ Object
GetPrivateConversationData get bot’s data for a single user in a conversation
36 37 38 39 |
# File 'lib/bot_framework/bot_state.rb', line 36 def get_private_conversation_data(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/conversations/#{opts['conversation_id']}/users/#{opts['user_id']}" BotFramework::BotData.new api_get(uri) end |
#get_user_data(opts = {}) ⇒ BotData
GetUserData Get a bots data for the user across all conversations
47 48 49 50 |
# File 'lib/bot_framework/bot_state.rb', line 47 def get_user_data(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/users/#{opts['user_id']}" BotFramework::BotData.new api_get(uri) end |
#set_conversation_data(opts = {}) ⇒ BotData
SetConversationData Update the bot’s data for all users in a conversation
58 59 60 61 |
# File 'lib/bot_framework/bot_state.rb', line 58 def set_conversation_data(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/conversations/#{opts['conversation_id']}" api_post(uri, opts['bot_data']) end |
#set_private_conversation_data(opts = {}) ⇒ BotData
SetPrivateConversationData Update the bot’s data for a single user in a conversation
72 73 74 75 |
# File 'lib/bot_framework/bot_state.rb', line 72 def set_private_conversation_data(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/conversations/#{opts['conversation_id']}/users/#{opts['user_id']}" api_post(uri, opts['bot_data']) end |
#set_user_data(opts = {}) ⇒ BotData
SetUserData Update the bot’s data for a user
84 85 86 87 |
# File 'lib/bot_framework/bot_state.rb', line 84 def set_user_data(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/users/#{opts['user_id']}" api_post(uri, opts['bot_data']) end |