-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add travel_pay/v0/claims route (same as travel_pay/claims) (#18319)
- Loading branch information
1 parent
4d2ca74
commit 996918a
Showing
4 changed files
with
74 additions
and
42 deletions.
There are no files selected for viewing
30 changes: 0 additions & 30 deletions
30
modules/travel_pay/app/controllers/travel_pay/claims_controller.rb
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
modules/travel_pay/app/controllers/travel_pay/v0/claims_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module TravelPay | ||
module V0 | ||
class ClaimsController < ApplicationController | ||
def index | ||
begin | ||
claims = service.get_claims(@current_user) | ||
rescue Faraday::Error => e | ||
TravelPay::ServiceError.raise_mapped_error(e) | ||
end | ||
|
||
render json: claims, status: :ok | ||
end | ||
|
||
private | ||
|
||
def service | ||
@service ||= TravelPay::Service.new | ||
end | ||
|
||
def common_exception(e) | ||
case e | ||
when Faraday::ResourceNotFound | ||
Common::Exceptions::ResourceNotFound.new | ||
else | ||
Common::Exceptions::InternalServerError.new | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
TravelPay::Engine.routes.draw do | ||
resources :claims | ||
# TODO: remove this mapping once vets-website | ||
# is pointing to the /v0/claims routes | ||
resources :claims, controller: '/travel_pay/v0/claims' | ||
|
||
namespace :v0 do | ||
resources :claims | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters