lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb in twilio-ruby-5.20.0 vs lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb in twilio-ruby-5.20.1
- old
+ new
@@ -13,11 +13,11 @@
class WorkspaceContext < InstanceContext
class EventList < ListResource
##
# Initialize the EventList
# @param [Version] version Version that contains the resource
- # @param [String] workspace_sid The unique ID of the Workspace
+ # @param [String] workspace_sid The workspace_sid
# @return [EventList] EventList
def initialize(version, workspace_sid: nil)
super(version)
# Path Solution
@@ -42,29 +42,35 @@
# @param [String] task_queue_sid Filter events by those pertaining to a particular
# queue
# @param [String] task_sid Filter events by those pertaining to a particular task
# @param [String] worker_sid Filter events by those pertaining to a particular
# worker
- # @param [String] workflow_sid The workflow_sid
+ # @param [String] workflow_sid Filter events by those pertaining to a particular
+ # workflow
+ # @param [String] task_channel Filter events by those pertaining to a particular
+ # task channel
+ # @param [String] sid Filter events by those pertaining to a particular event
# @param [Integer] limit Upper limit for the number of records to return. stream()
# guarantees to never return more than limit. Default is no limit
# @param [Integer] page_size Number of records to fetch per request, when
# not set will use 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)
# @return [Array] Array of up to limit results
- def list(end_date: :unset, event_type: :unset, minutes: :unset, reservation_sid: :unset, start_date: :unset, task_queue_sid: :unset, task_sid: :unset, worker_sid: :unset, workflow_sid: :unset, limit: nil, page_size: nil)
+ def list(end_date: :unset, event_type: :unset, minutes: :unset, reservation_sid: :unset, start_date: :unset, task_queue_sid: :unset, task_sid: :unset, worker_sid: :unset, workflow_sid: :unset, task_channel: :unset, sid: :unset, limit: nil, page_size: nil)
self.stream(
end_date: end_date,
event_type: event_type,
minutes: minutes,
reservation_sid: reservation_sid,
start_date: start_date,
task_queue_sid: task_queue_sid,
task_sid: task_sid,
worker_sid: worker_sid,
workflow_sid: workflow_sid,
+ task_channel: task_channel,
+ sid: sid,
limit: limit,
page_size: page_size
).entries
end
@@ -85,19 +91,23 @@
# @param [String] task_queue_sid Filter events by those pertaining to a particular
# queue
# @param [String] task_sid Filter events by those pertaining to a particular task
# @param [String] worker_sid Filter events by those pertaining to a particular
# worker
- # @param [String] workflow_sid The workflow_sid
+ # @param [String] workflow_sid Filter events by those pertaining to a particular
+ # workflow
+ # @param [String] task_channel Filter events by those pertaining to a particular
+ # task channel
+ # @param [String] sid Filter events by those pertaining to a particular event
# @param [Integer] limit Upper limit for the number of records to return. stream()
# guarantees to never return more than limit. Default is no limit.
# @param [Integer] page_size Number of records to fetch per request, when
# not set will use 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)
# @return [Enumerable] Enumerable that will yield up to limit results
- def stream(end_date: :unset, event_type: :unset, minutes: :unset, reservation_sid: :unset, start_date: :unset, task_queue_sid: :unset, task_sid: :unset, worker_sid: :unset, workflow_sid: :unset, limit: nil, page_size: nil)
+ def stream(end_date: :unset, event_type: :unset, minutes: :unset, reservation_sid: :unset, start_date: :unset, task_queue_sid: :unset, task_sid: :unset, worker_sid: :unset, workflow_sid: :unset, task_channel: :unset, sid: :unset, limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
page = self.page(
end_date: end_date,
event_type: event_type,
@@ -106,10 +116,12 @@
start_date: start_date,
task_queue_sid: task_queue_sid,
task_sid: task_sid,
worker_sid: worker_sid,
workflow_sid: workflow_sid,
+ task_channel: task_channel,
+ sid: sid,
page_size: limits[:page_size],
)
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
end
@@ -144,26 +156,32 @@
# @param [String] task_queue_sid Filter events by those pertaining to a particular
# queue
# @param [String] task_sid Filter events by those pertaining to a particular task
# @param [String] worker_sid Filter events by those pertaining to a particular
# worker
- # @param [String] workflow_sid The workflow_sid
+ # @param [String] workflow_sid Filter events by those pertaining to a particular
+ # workflow
+ # @param [String] task_channel Filter events by those pertaining to a particular
+ # task channel
+ # @param [String] sid Filter events by those pertaining to a particular event
# @param [String] page_token PageToken provided by the API
# @param [Integer] page_number Page Number, this value is simply for client state
# @param [Integer] page_size Number of records to return, defaults to 50
# @return [Page] Page of EventInstance
- def page(end_date: :unset, event_type: :unset, minutes: :unset, reservation_sid: :unset, start_date: :unset, task_queue_sid: :unset, task_sid: :unset, worker_sid: :unset, workflow_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
+ def page(end_date: :unset, event_type: :unset, minutes: :unset, reservation_sid: :unset, start_date: :unset, task_queue_sid: :unset, task_sid: :unset, worker_sid: :unset, workflow_sid: :unset, task_channel: :unset, sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
params = Twilio::Values.of({
'EndDate' => Twilio.serialize_iso8601_datetime(end_date),
'EventType' => event_type,
'Minutes' => minutes,
'ReservationSid' => reservation_sid,
'StartDate' => Twilio.serialize_iso8601_datetime(start_date),
'TaskQueueSid' => task_queue_sid,
'TaskSid' => task_sid,
'WorkerSid' => worker_sid,
'WorkflowSid' => workflow_sid,
+ 'TaskChannel' => task_channel,
+ 'Sid' => sid,
'PageToken' => page_token,
'Page' => page_number,
'PageSize' => page_size,
})
response = @version.page(
@@ -257,18 +275,25 @@
# Provide a user friendly representation
def to_s
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
"#<Twilio.Taskrouter.V1.EventContext #{context}>"
end
+
+ ##
+ # Provide a detailed, user friendly representation
+ def inspect
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
+ "#<Twilio.Taskrouter.V1.EventContext #{context}>"
+ end
end
class EventInstance < InstanceResource
##
# Initialize the EventInstance
# @param [Version] version Version that contains the resource
# @param [Hash] payload payload that contains response from Twilio
- # @param [String] workspace_sid The unique ID of the Workspace
+ # @param [String] workspace_sid The workspace_sid
# @param [String] sid The sid
# @return [EventInstance] EventInstance
def initialize(version, payload, workspace_sid: nil, sid: nil)
super(version)
@@ -279,18 +304,20 @@
'actor_type' => payload['actor_type'],
'actor_url' => payload['actor_url'],
'description' => payload['description'],
'event_data' => payload['event_data'],
'event_date' => Twilio.deserialize_iso8601_datetime(payload['event_date']),
+ 'event_date_ms' => payload['event_date_ms'].to_i,
'event_type' => payload['event_type'],
'resource_sid' => payload['resource_sid'],
'resource_type' => payload['resource_type'],
'resource_url' => payload['resource_url'],
'sid' => payload['sid'],
'source' => payload['source'],
'source_ip_address' => payload['source_ip_address'],
'url' => payload['url'],
+ 'workspace_sid' => payload['workspace_sid'],
}
# Context
@instance_context = nil
@params = {'workspace_sid' => workspace_sid, 'sid' => sid || @properties['sid'], }
@@ -336,11 +363,11 @@
def description
@properties['description']
end
##
- # @return [String] Data about this specific event.
+ # @return [Hash] Data about this specific event.
def event_data
@properties['event_data']
end
##
@@ -348,10 +375,16 @@
def event_date
@properties['event_date']
end
##
+ # @return [String] The time this event was sent in ms
+ def event_date_ms
+ @properties['event_date_ms']
+ end
+
+ ##
# @return [String] An identifier for this event
def event_type
@properties['event_type']
end
@@ -393,9 +426,15 @@
##
# @return [String] The url
def url
@properties['url']
+ end
+
+ ##
+ # @return [String] The workspace_sid
+ def workspace_sid
+ @properties['workspace_sid']
end
##
# Fetch a EventInstance
# @return [EventInstance] Fetched EventInstance
\ No newline at end of file