From 74d525be591300734dc7b3c4a7ccfabb0d0eefb7 Mon Sep 17 00:00:00 2001 From: Scott James Date: Fri, 28 Apr 2023 11:03:40 -0400 Subject: [PATCH] Rename MCP notifications endpoint (#12453) * Drop new from mcp notifications endpoint * Update before controller hooks * Update swagger spec --- app/controllers/v0/medical_copays_controller.rb | 14 +++++++------- app/services/medical_copays/vbs/service.rb | 2 +- app/swagger/swagger/requests/medical_copays.rb | 2 +- config/routes.rb | 2 +- .../v0/medical_copays_controller_spec.rb | 4 ++-- spec/requests/swagger_spec.rb | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/controllers/v0/medical_copays_controller.rb b/app/controllers/v0/medical_copays_controller.rb index 4668d56393e..a573ec86fc1 100644 --- a/app/controllers/v0/medical_copays_controller.rb +++ b/app/controllers/v0/medical_copays_controller.rb @@ -2,12 +2,12 @@ module V0 class MedicalCopaysController < ApplicationController - before_action(except: :send_new_statements_notifications) { authorize :medical_copays, :access? } - before_action(only: :send_new_statements_notifications) { authorize :medical_copays, :access_notifications? } + before_action(except: :send_statement_notifications) { authorize :medical_copays, :access? } + before_action(only: :send_statement_notifications) { authorize :medical_copays, :access_notifications? } - skip_before_action :verify_authenticity_token, only: [:send_new_statements_notifications] - skip_before_action :authenticate, only: [:send_new_statements_notifications] - skip_after_action :set_csrf_header, only: [:send_new_statements_notifications] + skip_before_action :verify_authenticity_token, only: [:send_statement_notifications] + skip_before_action :authenticate, only: [:send_statement_notifications] + skip_after_action :set_csrf_header, only: [:send_statement_notifications] rescue_from ::MedicalCopays::VBS::Service::StatementNotFound, with: :render_not_found @@ -28,8 +28,8 @@ def get_pdf_statement_by_id ) end - def send_new_statements_notifications - render json: vbs_service.send_new_statements_notifications(params[:statements]) + def send_statement_notifications + render json: vbs_service.send_statement_notifications(params[:statements]) end private diff --git a/app/services/medical_copays/vbs/service.rb b/app/services/medical_copays/vbs/service.rb index 07c83593c17..981f6e762f9 100644 --- a/app/services/medical_copays/vbs/service.rb +++ b/app/services/medical_copays/vbs/service.rb @@ -85,7 +85,7 @@ def get_pdf_statement_by_id(statement_id) Base64.decode64(response.body['statement']) end - def send_new_statements_notifications(_statements_json) + def send_statement_notifications(_statements_json) # Placeholder until we know JSON structure { status: 200, message: 'New Statement Notifications Coming Soon' } diff --git a/app/swagger/swagger/requests/medical_copays.rb b/app/swagger/swagger/requests/medical_copays.rb index dbbc4024b06..1bd057bd0e8 100644 --- a/app/swagger/swagger/requests/medical_copays.rb +++ b/app/swagger/swagger/requests/medical_copays.rb @@ -243,7 +243,7 @@ class MedicalCopays end end - swagger_path '/v0/medical_copays/send_new_statements_notifications' do + swagger_path '/v0/medical_copays/send_statement_notifications' do operation :post do key :description, 'Endpoint to trigger notifications from new statements' key :operationId, 'sendNewStatementsNotifications' diff --git a/config/routes.rb b/config/routes.rb index 22cf87e3c2d..711fbd493e6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -49,7 +49,7 @@ resources :medical_copays, only: %i[index show] get 'medical_copays/get_pdf_statement_by_id/:statement_id', to: 'medical_copays#get_pdf_statement_by_id' - post 'medical_copays/send_new_statements_notifications', to: 'medical_copays#send_new_statements_notifications' + post 'medical_copays/send_statement_notifications', to: 'medical_copays#send_statement_notifications' resources :apps, only: %i[index show] scope_default = { category: 'unknown_category' } diff --git a/spec/controllers/v0/medical_copays_controller_spec.rb b/spec/controllers/v0/medical_copays_controller_spec.rb index 7e1622a0057..18dc258754e 100644 --- a/spec/controllers/v0/medical_copays_controller_spec.rb +++ b/spec/controllers/v0/medical_copays_controller_spec.rb @@ -76,9 +76,9 @@ end end - describe '#send_new_statements_notifications' do + describe '#send_statement_notifications' do it 'returns a success message when notifications are sent' do - post(:send_new_statements_notifications, params: { statements: [] }) + post(:send_statement_notifications, params: { statements: [] }) expect(response).to have_http_status(:ok) end end diff --git a/spec/requests/swagger_spec.rb b/spec/requests/swagger_spec.rb index 46498e0bc4a..7ba739e6d25 100644 --- a/spec/requests/swagger_spec.rb +++ b/spec/requests/swagger_spec.rb @@ -669,11 +669,11 @@ end end - context 'medical copays send_new_statements_notifications' do + context 'medical copays send_statement_notifications' do it 'validates the route' do expect(subject).to validate( :post, - '/v0/medical_copays/send_new_statements_notifications', + '/v0/medical_copays/send_statement_notifications', 200, headers )