lib/twilio-ruby/rest/taskrouter/v1/workspace.rb in twilio-ruby-5.0.0.rc18 vs lib/twilio-ruby/rest/taskrouter/v1/workspace.rb in twilio-ruby-5.0.0.rc19
- old
+ new
@@ -1,10 +1,10 @@
##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
-# / /
+# / /
module Twilio
module REST
class Taskrouter < Domain
class V1 < Version
@@ -13,16 +13,16 @@
# Initialize the WorkspaceList
# @param [Version] version Version that contains the resource
# @return [WorkspaceList] WorkspaceList
def initialize(version)
super(version)
-
+
# Path Solution
@solution = {}
@uri = "/Workspaces"
end
-
+
##
# Lists WorkspaceInstance records from the API as a list.
# Unlike stream(), this operation is eager and will load `limit` records into
# memory before returning.
# @param [String] friendly_name The friendly_name
@@ -38,11 +38,11 @@
friendly_name: friendly_name,
limit: limit,
page_size: page_size
).entries
end
-
+
##
# Streams WorkspaceInstance records from the API as an Enumerable.
# This operation lazily loads records as efficiently as possible until the limit
# is reached.
# @param [String] friendly_name The friendly_name
@@ -53,19 +53,19 @@
# but a limit is defined, stream() will attempt to read the
# limit with the most efficient page size, i.e. min(limit, 1000)
# @return [Enumerable] Enumerable that will yield up to limit results
def stream(friendly_name: nil, limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
-
+
page = self.page(
friendly_name: friendly_name,
page_size: limits[:page_size],
)
-
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
end
-
+
##
# When passed a block, yields WorkspaceInstance records from the API.
# This operation lazily loads records as efficiently as possible until the limit
# is reached.
# @param [String] friendly_name The friendly_name
@@ -75,20 +75,20 @@
# the default value of 50 records. If no page_size is defined
# but a limit is defined, stream() will attempt to read the
# limit with the most efficient page size, i.e. min(limit, 1000)
def each
limits = @version.read_limits
-
+
page = self.page(
page_size: limits[:page_size],
)
-
+
@version.stream(page,
limit: limits[:limit],
page_limit: limits[:page_limit]).each {|x| yield x}
end
-
+
##
# Retrieve a single page of WorkspaceInstance records from the API.
# Request is executed immediately.
# @param [String] friendly_name The friendly_name
# @param [String] page_token PageToken provided by the API
@@ -107,164 +107,168 @@
@uri,
params
)
return WorkspacePage.new(@version, response, @solution)
end
-
+
##
# Retrieve a single page of WorkspaceInstance records from the API.
# Request is executed immediately.
# @param [String] friendly_name The friendly_name
# @param [String] event_callback_url The event_callback_url
# @param [String] events_filter The events_filter
# @param [Boolean] multi_task_enabled The multi_task_enabled
# @param [String] template The template
+ # @param [workspace.QueueOrder] prioritize_queue_order The prioritize_queue_order
# @return [WorkspaceInstance] Newly created WorkspaceInstance
- def create(friendly_name: nil, event_callback_url: nil, events_filter: nil, multi_task_enabled: nil, template: nil)
+ def create(friendly_name: nil, event_callback_url: nil, events_filter: nil, multi_task_enabled: nil, template: nil, prioritize_queue_order: nil)
data = {
'FriendlyName' => friendly_name,
'EventCallbackUrl' => event_callback_url,
'EventsFilter' => events_filter,
'MultiTaskEnabled' => multi_task_enabled,
'Template' => template,
+ 'PrioritizeQueueOrder' => prioritize_queue_order,
}
-
+
payload = @version.create(
'POST',
@uri,
data: data
)
-
+
return WorkspaceInstance.new(
@version,
payload,
)
end
-
+
##
# Provide a user friendly representation
def to_s
'#<Twilio.Taskrouter.V1.WorkspaceList>'
end
end
-
+
class WorkspacePage < Page
##
# Initialize the WorkspacePage
# @param [Version] version Version that contains the resource
# @param [Response] response Response from the API
# @param [Hash] solution Path solution for the resource
# @return [WorkspacePage] WorkspacePage
def initialize(version, response, solution)
super(version, response)
-
+
# Path Solution
@solution = solution
end
-
+
##
# Build an instance of WorkspaceInstance
# @param [Hash] payload Payload response from the API
# @return [WorkspaceInstance] WorkspaceInstance
def get_instance(payload)
return WorkspaceInstance.new(
@version,
payload,
)
end
-
+
##
# Provide a user friendly representation
def to_s
'<Twilio.Taskrouter.V1.WorkspacePage>'
end
end
-
+
class WorkspaceContext < InstanceContext
##
# Initialize the WorkspaceContext
# @param [Version] version Version that contains the resource
# @param [String] sid The sid
# @return [WorkspaceContext] WorkspaceContext
def initialize(version, sid)
super(version)
-
+
# Path Solution
@solution = {
sid: sid,
}
@uri = "/Workspaces/#{@solution[:sid]}"
-
+
# Dependents
@activities = nil
@events = nil
@tasks = nil
@task_queues = nil
@workers = nil
@workflows = nil
@statistics = nil
@task_channels = nil
end
-
+
##
# Fetch a WorkspaceInstance
# @return [WorkspaceInstance] Fetched WorkspaceInstance
def fetch
params = {}
-
+
payload = @version.fetch(
'GET',
@uri,
params,
)
-
+
return WorkspaceInstance.new(
@version,
payload,
sid: @solution[:sid],
)
end
-
+
##
# Update the WorkspaceInstance
# @param [String] default_activity_sid The default_activity_sid
# @param [String] event_callback_url The event_callback_url
# @param [String] events_filter The events_filter
# @param [String] friendly_name The friendly_name
# @param [Boolean] multi_task_enabled The multi_task_enabled
# @param [String] timeout_activity_sid The timeout_activity_sid
+ # @param [workspace.QueueOrder] prioritize_queue_order The prioritize_queue_order
# @return [WorkspaceInstance] Updated WorkspaceInstance
- def update(default_activity_sid: nil, event_callback_url: nil, events_filter: nil, friendly_name: nil, multi_task_enabled: nil, timeout_activity_sid: nil)
+ def update(default_activity_sid: nil, event_callback_url: nil, events_filter: nil, friendly_name: nil, multi_task_enabled: nil, timeout_activity_sid: nil, prioritize_queue_order: nil)
data = {
'DefaultActivitySid' => default_activity_sid,
'EventCallbackUrl' => event_callback_url,
'EventsFilter' => events_filter,
'FriendlyName' => friendly_name,
'MultiTaskEnabled' => multi_task_enabled,
'TimeoutActivitySid' => timeout_activity_sid,
+ 'PrioritizeQueueOrder' => prioritize_queue_order,
}
-
+
payload = @version.update(
'POST',
@uri,
data: data,
)
-
+
return WorkspaceInstance.new(
@version,
payload,
sid: @solution[:sid],
)
end
-
+
##
# Deletes the WorkspaceInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
return @version.delete('delete', @uri)
end
-
+
##
# Access the activities
# @return [ActivityList] ActivityList
def activities(sid=:unset)
if sid != :unset
@@ -272,21 +276,21 @@
@version,
@solution[:sid],
sid,
)
end
-
+
unless @activities
@activities = ActivityList.new(
@version,
workspace_sid: @solution[:sid],
)
end
-
+
@activities
end
-
+
##
# Access the events
# @return [EventList] EventList
def events(sid=:unset)
if sid != :unset
@@ -294,21 +298,21 @@
@version,
@solution[:sid],
sid,
)
end
-
+
unless @events
@events = EventList.new(
@version,
workspace_sid: @solution[:sid],
)
end
-
+
@events
end
-
+
##
# Access the tasks
# @return [TaskList] TaskList
def tasks(sid=:unset)
if sid != :unset
@@ -316,21 +320,21 @@
@version,
@solution[:sid],
sid,
)
end
-
+
unless @tasks
@tasks = TaskList.new(
@version,
workspace_sid: @solution[:sid],
)
end
-
+
@tasks
end
-
+
##
# Access the task_queues
# @return [TaskQueueList] TaskQueueList
def task_queues(sid=:unset)
if sid != :unset
@@ -338,21 +342,21 @@
@version,
@solution[:sid],
sid,
)
end
-
+
unless @task_queues
@task_queues = TaskQueueList.new(
@version,
workspace_sid: @solution[:sid],
)
end
-
+
@task_queues
end
-
+
##
# Access the workers
# @return [WorkerList] WorkerList
def workers(sid=:unset)
if sid != :unset
@@ -360,21 +364,21 @@
@version,
@solution[:sid],
sid,
)
end
-
+
unless @workers
@workers = WorkerList.new(
@version,
workspace_sid: @solution[:sid],
)
end
-
+
@workers
end
-
+
##
# Access the workflows
# @return [WorkflowList] WorkflowList
def workflows(sid=:unset)
if sid != :unset
@@ -382,31 +386,31 @@
@version,
@solution[:sid],
sid,
)
end
-
+
unless @workflows
@workflows = WorkflowList.new(
@version,
workspace_sid: @solution[:sid],
)
end
-
+
@workflows
end
-
+
##
# Access the statistics
# @return [WorkspaceStatisticsList] WorkspaceStatisticsList
def statistics
return WorkspaceStatisticsContext.new(
@version,
@solution[:sid],
)
end
-
+
##
# Access the task_channels
# @return [TaskChannelList] TaskChannelList
def task_channels(sid=:unset)
if sid != :unset
@@ -414,39 +418,39 @@
@version,
@solution[:sid],
sid,
)
end
-
+
unless @task_channels
@task_channels = TaskChannelList.new(
@version,
workspace_sid: @solution[:sid],
)
end
-
+
@task_channels
end
-
+
##
# Provide a user friendly representation
def to_s
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
"#<Twilio.Taskrouter.V1.WorkspaceContext #{context}>"
end
end
-
+
class WorkspaceInstance < InstanceResource
##
# Initialize the WorkspaceInstance
# @param [Version] version Version that contains the resource
# @param [Hash] payload payload that contains response from Twilio
# @param [String] sid The sid
# @return [WorkspaceInstance] WorkspaceInstance
def initialize(version, payload, sid: nil)
super(version)
-
+
# Marshaled Properties
@properties = {
'account_sid' => payload['account_sid'],
'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
@@ -457,19 +461,22 @@
'friendly_name' => payload['friendly_name'],
'multi_task_enabled' => payload['multi_task_enabled'],
'sid' => payload['sid'],
'timeout_activity_name' => payload['timeout_activity_name'],
'timeout_activity_sid' => payload['timeout_activity_sid'],
+ 'prioritize_queue_order' => payload['prioritize_queue_order'],
+ 'url' => payload['url'],
+ 'links' => payload['links'],
}
-
+
# Context
@instance_context = nil
@params = {
'sid' => sid || @properties['sid'],
}
end
-
+
##
# Generate an instance context for the instance, the context is capable of
# performing various actions. All instance actions are proxied to the context
# @param [Version] version Version that contains the resource
# @return [WorkspaceContext] WorkspaceContext for this WorkspaceInstance
@@ -480,148 +487,162 @@
@params['sid'],
)
end
@instance_context
end
-
+
def account_sid
@properties['account_sid']
end
-
+
def date_created
@properties['date_created']
end
-
+
def date_updated
@properties['date_updated']
end
-
+
def default_activity_name
@properties['default_activity_name']
end
-
+
def default_activity_sid
@properties['default_activity_sid']
end
-
+
def event_callback_url
@properties['event_callback_url']
end
-
+
def events_filter
@properties['events_filter']
end
-
+
def friendly_name
@properties['friendly_name']
end
-
+
def multi_task_enabled
@properties['multi_task_enabled']
end
-
+
def sid
@properties['sid']
end
-
+
def timeout_activity_name
@properties['timeout_activity_name']
end
-
+
def timeout_activity_sid
@properties['timeout_activity_sid']
end
-
+
+ def prioritize_queue_order
+ @properties['prioritize_queue_order']
+ end
+
+ def url
+ @properties['url']
+ end
+
+ def links
+ @properties['links']
+ end
+
##
# Fetch a WorkspaceInstance
# @return [WorkspaceInstance] Fetched WorkspaceInstance
def fetch
context.fetch
end
-
+
##
# Update the WorkspaceInstance
# @param [String] default_activity_sid The default_activity_sid
# @param [String] event_callback_url The event_callback_url
# @param [String] events_filter The events_filter
# @param [String] friendly_name The friendly_name
# @param [Boolean] multi_task_enabled The multi_task_enabled
# @param [String] timeout_activity_sid The timeout_activity_sid
+ # @param [workspace.QueueOrder] prioritize_queue_order The prioritize_queue_order
# @return [WorkspaceInstance] Updated WorkspaceInstance
- def update(default_activity_sid: nil, event_callback_url: nil, events_filter: nil, friendly_name: nil, multi_task_enabled: nil, timeout_activity_sid: nil)
+ def update(default_activity_sid: nil, event_callback_url: nil, events_filter: nil, friendly_name: nil, multi_task_enabled: nil, timeout_activity_sid: nil, prioritize_queue_order: nil)
context.update(
default_activity_sid: default_activity_sid,
event_callback_url: event_callback_url,
events_filter: events_filter,
friendly_name: friendly_name,
multi_task_enabled: multi_task_enabled,
timeout_activity_sid: timeout_activity_sid,
+ prioritize_queue_order: prioritize_queue_order,
)
end
-
+
##
# Deletes the WorkspaceInstance
# @return [Boolean] true if delete succeeds, true otherwise
def delete
context.delete
end
-
+
##
# Access the activities
# @return [activities] activities
def activities
context.activities
end
-
+
##
# Access the events
# @return [events] events
def events
context.events
end
-
+
##
# Access the tasks
# @return [tasks] tasks
def tasks
context.tasks
end
-
+
##
# Access the task_queues
# @return [task_queues] task_queues
def task_queues
context.task_queues
end
-
+
##
# Access the workers
# @return [workers] workers
def workers
context.workers
end
-
+
##
# Access the workflows
# @return [workflows] workflows
def workflows
context.workflows
end
-
+
##
# Access the statistics
# @return [statistics] statistics
def statistics
context.statistics
end
-
+
##
# Access the task_channels
# @return [task_channels] task_channels
def task_channels
context.task_channels
end
-
+
##
# Provide a user friendly representation
def to_s
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
"<Twilio.Taskrouter.V1.WorkspaceInstance #{values}>"
\ No newline at end of file