lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb in twilio-ruby-5.4.2 vs lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb in twilio-ruby-5.4.3
- old
+ new
@@ -17,13 +17,11 @@
# @return [ActivityList] ActivityList
def initialize(version, workspace_sid: nil)
super(version)
# Path Solution
- @solution = {
- workspace_sid: workspace_sid
- }
+ @solution = {workspace_sid: workspace_sid}
@uri = "/Workspaces/#{@solution[:workspace_sid]}/Activities"
end
##
# Lists ActivityInstance records from the API as a list.
@@ -61,15 +59,11 @@
# efficient page size, i.e. min(limit, 1000)
# @return [Enumerable] Enumerable that will yield up to limit results
def stream(friendly_name: :unset, available: :unset, limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
- page = self.page(
- friendly_name: friendly_name,
- available: available,
- page_size: limits[:page_size],
- )
+ page = self.page(friendly_name: friendly_name, available: available, page_size: limits[:page_size],)
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
end
##
@@ -77,13 +71,11 @@
# This operation lazily loads records as efficiently as possible until the limit
# is reached.
def each
limits = @version.read_limits
- page = self.page(
- page_size: limits[:page_size],
- )
+ page = self.page(page_size: limits[:page_size],)
@version.stream(page,
limit: limits[:limit],
page_limit: limits[:page_limit]).each {|x| yield x}
end
@@ -131,26 +123,19 @@
# Request is executed immediately.
# @param [String] friendly_name The friendly_name
# @param [Boolean] available The available
# @return [ActivityInstance] Newly created ActivityInstance
def create(friendly_name: nil, available: :unset)
- data = Twilio::Values.of({
- 'FriendlyName' => friendly_name,
- 'Available' => available,
- })
+ data = Twilio::Values.of({'FriendlyName' => friendly_name, 'Available' => available,})
payload = @version.create(
'POST',
@uri,
data: data
)
- ActivityInstance.new(
- @version,
- payload,
- workspace_sid: @solution[:workspace_sid],
- )
+ ActivityInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid],)
end
##
# Provide a user friendly representation
def to_s
@@ -175,15 +160,11 @@
##
# Build an instance of ActivityInstance
# @param [Hash] payload Payload response from the API
# @return [ActivityInstance] ActivityInstance
def get_instance(payload)
- ActivityInstance.new(
- @version,
- payload,
- workspace_sid: @solution[:workspace_sid],
- )
+ ActivityInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid],)
end
##
# Provide a user friendly representation
def to_s
@@ -200,14 +181,11 @@
# @return [ActivityContext] ActivityContext
def initialize(version, workspace_sid, sid)
super(version)
# Path Solution
- @solution = {
- workspace_sid: workspace_sid,
- sid: sid,
- }
+ @solution = {workspace_sid: workspace_sid, sid: sid,}
@uri = "/Workspaces/#{@solution[:workspace_sid]}/Activities/#{@solution[:sid]}"
end
##
# Fetch a ActivityInstance
@@ -219,39 +197,27 @@
'GET',
@uri,
params,
)
- ActivityInstance.new(
- @version,
- payload,
- workspace_sid: @solution[:workspace_sid],
- sid: @solution[:sid],
- )
+ ActivityInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid],)
end
##
# Update the ActivityInstance
# @param [String] friendly_name The friendly_name
# @return [ActivityInstance] Updated ActivityInstance
def update(friendly_name: :unset)
- data = Twilio::Values.of({
- 'FriendlyName' => friendly_name,
- })
+ data = Twilio::Values.of({'FriendlyName' => friendly_name,})
payload = @version.update(
'POST',
@uri,
data: data,
)
- ActivityInstance.new(
- @version,
- payload,
- workspace_sid: @solution[:workspace_sid],
- sid: @solution[:sid],
- )
+ ActivityInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid],)
end
##
# Deletes the ActivityInstance
# @return [Boolean] true if delete succeeds, true otherwise
@@ -290,27 +256,20 @@
'url' => payload['url'],
}
# Context
@instance_context = nil
- @params = {
- 'workspace_sid' => workspace_sid,
- 'sid' => sid || @properties['sid'],
- }
+ @params = {'workspace_sid' => workspace_sid, '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
# @return [ActivityContext] ActivityContext for this ActivityInstance
def context
unless @instance_context
- @instance_context = ActivityContext.new(
- @version,
- @params['workspace_sid'],
- @params['sid'],
- )
+ @instance_context = ActivityContext.new(@version, @params['workspace_sid'], @params['sid'],)
end
@instance_context
end
##
@@ -371,12 +330,10 @@
##
# Update the ActivityInstance
# @param [String] friendly_name The friendly_name
# @return [ActivityInstance] Updated ActivityInstance
def update(friendly_name: :unset)
- context.update(
- friendly_name: friendly_name,
- )
+ context.update(friendly_name: friendly_name,)
end
##
# Deletes the ActivityInstance
# @return [Boolean] true if delete succeeds, true otherwise
\ No newline at end of file