Skip to content

Commit

Permalink
create HLR through lighthouse (#3793)
Browse files Browse the repository at this point in the history
* get contestable issues through lighthouse

* push failing test example

* tweak test and routes

* remove lighthouse api key from headers supplied as argument to

* remove with_okta... from test

* wip

* create cassette

* make a constant for v2 path

* add service method get_higher_level_review. add HLR controller. add tests. add routes. copy cassette.

* add service method create_higher_level_review. add create method to HLR controller. write test. copy cassette

* rubo

* update cassette

* rubocop routes

* update cassette

* fix comment
  • Loading branch information
edmangimelli authored Jan 21, 2020
1 parent f8f5445 commit 5d65ff8
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/appeals/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ def get_intake_status(id)
end
end

##
# Create a HLR.
#
# @param body [Hash] The HLR's attributes. See modules/appeals_api/app/swagger/v1/decision_reviews.yaml
# @return [Hash] Response object.
#
def create_higher_level_review(body)
with_monitoring do
perform(:post, "#{CASEFLOW_V3_API_PATH}higher_level_reviews", body, request_headers)
end
end

##
# Pings the Appeals Status health check endpoint.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,17 @@ class AppealsApi::V1::DecisionReview::HigherLevelReviewsController < AppealsApi:
def show
render_response(Appeals::Service.new.get_higher_level_review(params[:id]))
end

def create
render_response(Appeals::Service.new.create_higher_level_review(create_params))
end

private

def create_params
{
'data' => params[:data].as_json,
'included' => params[:included].as_json
}
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'rails_helper'

describe AppealsApi::V1::DecisionReview::HigherLevelReviewsController, type: :request do
describe '#index' do
describe '#show' do
it 'show a HLR from Caseflow successfully' do
VCR.use_cassette('appeals/higher_level_reviews_show') do
get('/services/appeals/v1/decision_review/higher_level_reviews/97bca3d5-3524-4e5d-81ea-92753892a59c')
Expand All @@ -13,4 +13,36 @@
end
end
end

describe '#create' do
it 'create an HLR through Caseflow successfully' do
VCR.use_cassette('appeals/higher_level_reviews_create') do
post(
'/services/appeals/v1/decision_review/higher_level_reviews',
as: :json,
params: {
'data' => {
'type' => 'HigherLevelReview',
'attributes' => {
'receiptDate' => '2019-07-10',
'informalConference' => true,
'sameOffice' => false,
'legacyOptInApproved' => true,
'benefitType' => 'compensation',
'veteran' => {
'fileNumberOrSsn' => '872958715'
}
}
},
'included' => [
{ 'type' => 'ContestableIssue', 'attributes' => { 'ratingIssueId' => '826209597423' } }
]
}
)
expect(response).to have_http_status(:accepted)
json = JSON.parse(response.body)
expect(json['data']).not_to be nil
end
end
end
end
50 changes: 50 additions & 0 deletions spec/support/vcr_cassettes/appeals/higher_level_reviews_create.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5d65ff8

Please sign in to comment.