Class: SubscriptionsTestKit::SubscriptionReadEndpoint
Constant Summary
SubscriptionsTestKit::SubscriptionsR5BackportR4Client::SubscriptionSimulationUtils::ALLOWED_MIME_TYPES, SubscriptionsTestKit::SubscriptionsR5BackportR4Client::SubscriptionSimulationUtils::DEFAULT_MIME_TYPE
Instance Method Summary
collapse
#actual_mime_type, #client_access_token_input, #derive_event_notification, #derive_handshake_notification, #derive_status_bundle, #determine_event_count, #determine_subscription_status_code, #find_subscription, #notification_bundle_input, #operation_outcome
Instance Method Details
#make_response ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/subscriptions_test_kit/endpoints/subscription_read_endpoint.rb', line 12
def make_response
response.format = :json
subscription_id = request.params[:id]
subscription = find_subscription(test_run.test_session_id)
if subscription.present? && subscription.id == subscription_id
status_code = determine_subscription_status_code(subscription_id)
response.body = subscription.source_hash.merge('status' => status_code).to_json
else
response.status = 404
response.body = operation_outcome('error', 'not-found',
"No subscription exists with ID #{subscription_id}").to_json
end
end
|
28
29
30
|
# File 'lib/subscriptions_test_kit/endpoints/subscription_read_endpoint.rb', line 28
def tags
[SUBSCRIPTION_READ_TAG]
end
|
#test_run_identifier ⇒ Object
8
9
10
|
# File 'lib/subscriptions_test_kit/endpoints/subscription_read_endpoint.rb', line 8
def test_run_identifier
request.['authorization']&.delete_prefix('Bearer ')
end
|