only validate subscription context on update if present
refs PLAT-4821 * update will not contain the whole subscription test plan: * with the live events LTI tool installed and running (see the docs), update a subscription (eg, mark it deleted) * this endpoint should succeed even though `ContextType` isn't present in the request Change-Id: I0773f18d5a2793c1248b4c761dc5bd79c03537a0 Reviewed-on: https://gerrit.instructure.com/208721 Tested-by: Jenkins Reviewed-by: Marc Phillips <mphillips@instructure.com> QA-Review: Marc Phillips <mphillips@instructure.com> Product-Review: Xander Moffatt <xmoffatt@instructure.com>
This commit is contained in:
parent
7eecad579c
commit
edf0c532bd
|
@ -133,30 +133,33 @@ module Lti
|
|||
# Updates a Data Service Event subscription for the specified event type and
|
||||
# context.
|
||||
#
|
||||
# @argument subscription[ContextId] [Required, String]
|
||||
# @argument subscription[ContextId] [Optional, String]
|
||||
# The id of the context for the subscription.
|
||||
#
|
||||
# @argument subscription[ContextType] [Required, String]
|
||||
# @argument subscription[ContextType] [Optional, String]
|
||||
# The type of context for the subscription. Must be 'assignment',
|
||||
# 'account', or 'course'.
|
||||
#
|
||||
# @argument subscription[EventTypes] [Required, Array]
|
||||
# @argument subscription[EventTypes] [Optional, Array]
|
||||
# Array of strings representing the event types for
|
||||
# the subscription.
|
||||
#
|
||||
# @argument subscription[Format] [Required, String]
|
||||
# @argument subscription[Format] [Optional, String]
|
||||
# Format to deliver the live events. Must be 'live-event' or 'caliper'.
|
||||
#
|
||||
# @argument subscription[TransportMetadata] [Required, Object]
|
||||
# @argument subscription[TransportMetadata] [Optional, Object]
|
||||
# An object with a single key: 'Url'. Example: { "Url": "sqs.example" }
|
||||
#
|
||||
# @argument subscription[TransportType] [Required, String]
|
||||
# @argument subscription[TransportType] [Optional, String]
|
||||
# Must be either 'sqs' or 'https'.
|
||||
#
|
||||
# @argument subscription[State] [Optional, String]
|
||||
# Must be either 'Active' or 'Deleted"
|
||||
#
|
||||
# @returns DataServiceSubscription
|
||||
def update
|
||||
sub = params.require(:subscription)
|
||||
SubscriptionsValidator.validate_subscription_context!(sub)
|
||||
SubscriptionsValidator.validate_subscription_context!(sub) if sub[:ContextType]
|
||||
updates = { 'Id': params[:id] }.merge(sub.to_unsafe_h)
|
||||
response = Services::LiveEventsSubscriptionService.update(jwt_body, updates)
|
||||
forward_service_response(response)
|
||||
|
|
Loading…
Reference in New Issue