lib/twilio-ruby/rest/preview/understand/assistant.rb in twilio-ruby-5.14.1 vs lib/twilio-ruby/rest/preview/understand/assistant.rb in twilio-ruby-5.15.0

- old
+ new

@@ -116,26 +116,30 @@ # logged for 30 days further training. If false, no queries will be stored, if # true, queries will be stored for 30 days and deleted thereafter. Defaults to # true if no value is provided. # @param [String] unique_name A user-provided string that uniquely identifies this # resource as an alternative to the sid. Unique up to 64 characters long. - # @param [String] callback_url The callback_url - # @param [String] callback_events The callback_events + # @param [String] callback_url A user-provided URL to send event callbacks to. + # @param [String] callback_events Space-separated list of callback events that + # will trigger callbacks. # @param [Hash] fallback_actions The JSON actions to be executed when the user's - # input is not recognized as matching any Intent. + # input is not recognized as matching any Task. # @param [Hash] initiation_actions The JSON actions to be executed on inbound # phone calls when the Assistant has to say something first. + # @param [Hash] style_sheet The JSON object that holds the style sheet for the + # assistant # @return [AssistantInstance] Newly created AssistantInstance - def create(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset) + def create(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset, style_sheet: :unset) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'LogQueries' => log_queries, 'UniqueName' => unique_name, 'CallbackUrl' => callback_url, 'CallbackEvents' => callback_events, 'FallbackActions' => Twilio.serialize_object(fallback_actions), 'InitiationActions' => Twilio.serialize_object(initiation_actions), + 'StyleSheet' => Twilio.serialize_object(style_sheet), }) payload = @version.create( 'POST', @uri, @@ -187,27 +191,29 @@ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com. class AssistantContext < InstanceContext ## # Initialize the AssistantContext # @param [Version] version Version that contains the resource - # @param [String] sid The sid + # @param [String] sid A 34 character string that uniquely identifies this + # resource. # @return [AssistantContext] AssistantContext def initialize(version, sid) super(version) # Path Solution @solution = {sid: sid, } @uri = "/Assistants/#{@solution[:sid]}" # Dependents @field_types = nil - @intents = nil + @tasks = nil @model_builds = nil @queries = nil @assistant_fallback_actions = nil @assistant_initiation_actions = nil @dialogues = nil + @style_sheet = nil end ## # Fetch a AssistantInstance # @return [AssistantInstance] Fetched AssistantInstance @@ -231,26 +237,30 @@ # logged for 30 days further training. If false, no queries will be stored, if # true, queries will be stored for 30 days and deleted thereafter. Defaults to # true if no value is provided. # @param [String] unique_name A user-provided string that uniquely identifies this # resource as an alternative to the sid. Unique up to 64 characters long. - # @param [String] callback_url The callback_url - # @param [String] callback_events The callback_events + # @param [String] callback_url A user-provided URL to send event callbacks to. + # @param [String] callback_events Space-separated list of callback events that + # will trigger callbacks. # @param [Hash] fallback_actions The JSON actions to be executed when the user's - # input is not recognized as matching any Intent. + # input is not recognized as matching any Task. # @param [Hash] initiation_actions The JSON actions to be executed on inbound # phone calls when the Assistant has to say something first. + # @param [Hash] style_sheet The JSON object that holds the style sheet for the + # assistant # @return [AssistantInstance] Updated AssistantInstance - def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset) + def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset, style_sheet: :unset) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'LogQueries' => log_queries, 'UniqueName' => unique_name, 'CallbackUrl' => callback_url, 'CallbackEvents' => callback_events, 'FallbackActions' => Twilio.serialize_object(fallback_actions), 'InitiationActions' => Twilio.serialize_object(initiation_actions), + 'StyleSheet' => Twilio.serialize_object(style_sheet), }) payload = @version.update( 'POST', @uri, @@ -284,25 +294,25 @@ @field_types end ## - # Access the intents - # @return [IntentList] - # @return [IntentContext] if sid was passed. - def intents(sid=:unset) + # Access the tasks + # @return [TaskList] + # @return [TaskContext] if sid was passed. + def tasks(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return IntentContext.new(@version, @solution[:sid], sid, ) + return TaskContext.new(@version, @solution[:sid], sid, ) end - unless @intents - @intents = IntentList.new(@version, assistant_sid: @solution[:sid], ) + unless @tasks + @tasks = TaskList.new(@version, assistant_sid: @solution[:sid], ) end - @intents + @tasks end ## # Access the model_builds # @return [ModelBuildList] @@ -372,10 +382,18 @@ @dialogues end ## + # Access the style_sheet + # @return [StyleSheetList] + # @return [StyleSheetContext] + def style_sheet + StyleSheetContext.new(@version, @solution[:sid], ) + end + + ## # Provide a user friendly representation def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Understand.AssistantContext #{context}>" end @@ -386,11 +404,12 @@ class AssistantInstance < InstanceResource ## # Initialize the AssistantInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio - # @param [String] sid The sid + # @param [String] sid A 34 character string that uniquely identifies this + # resource. # @return [AssistantInstance] AssistantInstance def initialize(version, payload, sid: nil) super(version) # Marshaled Properties @@ -484,17 +503,17 @@ def url @properties['url'] end ## - # @return [String] The callback_url + # @return [String] A user-provided URL to send event callbacks to. def callback_url @properties['callback_url'] end ## - # @return [String] The callback_events + # @return [String] Space-separated list of callback events that will trigger callbacks. def callback_events @properties['callback_events'] end ## @@ -512,26 +531,30 @@ # logged for 30 days further training. If false, no queries will be stored, if # true, queries will be stored for 30 days and deleted thereafter. Defaults to # true if no value is provided. # @param [String] unique_name A user-provided string that uniquely identifies this # resource as an alternative to the sid. Unique up to 64 characters long. - # @param [String] callback_url The callback_url - # @param [String] callback_events The callback_events + # @param [String] callback_url A user-provided URL to send event callbacks to. + # @param [String] callback_events Space-separated list of callback events that + # will trigger callbacks. # @param [Hash] fallback_actions The JSON actions to be executed when the user's - # input is not recognized as matching any Intent. + # input is not recognized as matching any Task. # @param [Hash] initiation_actions The JSON actions to be executed on inbound # phone calls when the Assistant has to say something first. + # @param [Hash] style_sheet The JSON object that holds the style sheet for the + # assistant # @return [AssistantInstance] Updated AssistantInstance - def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset) + def update(friendly_name: :unset, log_queries: :unset, unique_name: :unset, callback_url: :unset, callback_events: :unset, fallback_actions: :unset, initiation_actions: :unset, style_sheet: :unset) context.update( friendly_name: friendly_name, log_queries: log_queries, unique_name: unique_name, callback_url: callback_url, callback_events: callback_events, fallback_actions: fallback_actions, initiation_actions: initiation_actions, + style_sheet: style_sheet, ) end ## # Deletes the AssistantInstance @@ -546,14 +569,14 @@ def field_types context.field_types end ## - # Access the intents - # @return [intents] intents - def intents - context.intents + # Access the tasks + # @return [tasks] tasks + def tasks + context.tasks end ## # Access the model_builds # @return [model_builds] model_builds @@ -585,9 +608,16 @@ ## # Access the dialogues # @return [dialogues] dialogues def dialogues context.dialogues + end + + ## + # Access the style_sheet + # @return [style_sheet] style_sheet + def style_sheet + context.style_sheet end ## # Provide a user friendly representation def to_s \ No newline at end of file