Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint for EVSS #4370

Merged
merged 11 commits into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ group :development do
gem 'benchmark-ips'
gem 'guard-rubocop'
gem 'seedbank'
gem 'socksify'
gem 'spring', platforms: :ruby # Spring speeds up development by keeping your application running in the background
gem 'spring-commands-rspec'

Expand Down
1 change: 0 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,6 @@ DEPENDENCIES
sidekiq-pro!
sidekiq-scheduler (~> 3.0)
simplecov (< 0.18)
socksify
spring
spring-commands-rspec
staccato
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v0/apidocs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ class ApidocsController < ApplicationController
Swagger::Schemas::ConnectedApplications,
Swagger::Schemas::Dependents,
Swagger::Schemas::DismissedStatus,
Swagger::Schemas::Form526::RatedDisabilities,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

Swagger::Schemas::Email,
Swagger::Schemas::Errors,
Swagger::Schemas::EVSSAuthError,
Expand All @@ -184,6 +183,7 @@ class ApidocsController < ApplicationController
Swagger::Schemas::Form526::Form4142,
Swagger::Schemas::Form526::Form526SubmitV2,
Swagger::Schemas::Form526::Form8940,
Swagger::Schemas::Form526::SeparationLocation,
Swagger::Schemas::Form526::JobStatus,
Swagger::Schemas::Form526::RatedDisabilities,
Swagger::Schemas::Form526::SubmitDisabilityForm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ def rated_disabilities
serializer: RatedDisabilitiesSerializer
end

def separation_locations
response = EVSS::ReferenceData::Service.new(@current_user).get_separation_locations
render json: response, each_serializer: EVSSSeparationLocationSerializer
end

def suggested_conditions
results = DisabilityContention.suggested(params[:name_part])
render json: results, each_serializer: DisabilityContentionSerializer
Expand Down
9 changes: 9 additions & 0 deletions app/serializers/evss_separation_location_serializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

class EVSSSeparationLocationSerializer < ActiveModel::Serializer
attribute :separation_locations

def id
nil
end
end
19 changes: 19 additions & 0 deletions app/swagger/requests/disability_compensation_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,25 @@ class DisabilityCompensationForm
end
end
end

swagger_path '/v0/disability_compensation_form/separation_locations' do
operation :get do
extend Swagger::Responses::AuthenticationError

key :description, 'Get the separation locations from EVSS'
key :operationId, 'getIntakeSites'
key :tags, %w[form_526]

parameter :authorization

response 200 do
key :description, 'Response is OK'
schema do
key :'$ref', :SeparationLocations
end
end
end
end
end
end
end
22 changes: 22 additions & 0 deletions app/swagger/schemas/form526/separation_locations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Swagger
module Schemas
module Form526
class SeparationLocations
include Swagger::Blocks
swagger_schema :SeparationLocation do
key :required, [:separation_locations]

property :separation_locations, type: :array do
items do
key :required, %i[code description]
property :code, type: :string, example: '98283'
property :description, type: :string, example: 'AF Academy'
end
end
end
end
end
end
end
10 changes: 10 additions & 0 deletions config/betamocks/services_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@
:cache_multiple_responses:
:uid_location: header
:uid_locator: 'va_eauth_pnid'
# EVSS Reference Data
- :method: :get
:path: "/wss-referencedata-services-web/rest/referencedata/v1/countries"
:file_path: "evss/reference_data/countries"
- :method: :get
:path: "/wss-referencedata-services-web/rest/referencedata/v1/states"
:file_path: "evss/reference_data/states"
- :method: :get
:path: "/wss-referencedata-services-web/rest/referencedata/v1/intakesites"
:file_path: "evss/reference_data/intakesites"

# PPIU payment information
- :method: :get
Expand Down
21 changes: 0 additions & 21 deletions config/initializers/faraday_socks.rb

This file was deleted.

1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
post 'submit_all_claim'
get 'suggested_conditions'
get 'user_submissions'
get 'separation_locations'
end

resource :upload_supporting_evidence, only: :create
Expand Down
8 changes: 1 addition & 7 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ evss:
mock_pciu: true
mock_pciu_address: false
mock_ppiu: true
mock_reference: false
mock_itf: true
mock_disabilities_form: true
mock_common_service: true
Expand All @@ -194,9 +195,6 @@ evss:
cert_path: ~
key_path: ~
root_ca: ~
jwt:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

issuer: fake_issuer
key: fake_key
reference_data_service:
enabled: false
international_postal_codes: 'config/evss/international_postal_codes.json'
Expand Down Expand Up @@ -444,10 +442,6 @@ betamocks:
cache_dir: /cache
services_config: config/betamocks/services_config.yml

faraday_socks_proxy:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused - TODO: check if I need to remove from devops repo.

enabled: false
uri: socks5://localhost:2002

google_analytics_tracking_id: ~

# Settings for search
Expand Down
45 changes: 0 additions & 45 deletions lib/evss/aws_configuration.rb

This file was deleted.

45 changes: 0 additions & 45 deletions lib/evss/jwt.rb

This file was deleted.

9 changes: 5 additions & 4 deletions lib/evss/reference_data/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,28 @@ module ReferenceData
# HTTP client configuration for the {ReferenceData::Service} to
# set the base path and a service name for breakers and metrics
#
class Configuration < EVSS::AWSConfiguration
class Configuration < EVSS::Configuration
##
# @return [String] Base path for ReferenceData URLs.
#
def base_path
Settings.evss.aws.url.to_s
# TODO: remove "/VONAPP2/domain2" when both pint instances are up
"#{Settings.evss.url}/VONAPP2/domain2/wss-referencedata-services-web/rest/referencedata/v1"
end

##
# @return [String] Service name to use in breakers and metrics.
#
def service_name
'EVSS/AWS/ReferenceData'
'EVSS/ReferenceData'
end

##
# @return [Boolean] Should the service use mock data in lower environments.
#
def mock_enabled?
# TODO: create mock data
false
Settings.evss.mock_reference || false
end
end
end
Expand Down
25 changes: 25 additions & 0 deletions lib/evss/reference_data/intake_sites_response.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true

require 'evss/response'

module EVSS
module ReferenceData
##
# Model for Intake Sites returned by reference_datea
#
# @param status [Integer] The HTTP status code
# @param response [Hash] The API response
#
# @!attribute countries
# @return [Array[String]] An array of intake sites
#
class IntakeSitesResponse < EVSS::Response
attribute :separation_locations, Array[Hash]

def initialize(status, response = nil)
separation_locations = response&.body&.dig('intake_sites')
super(status, separation_locations: separation_locations)
end
end
end
end
14 changes: 5 additions & 9 deletions lib/evss/reference_data/service.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'evss/jwt'

module EVSS
module ReferenceData
class Service < EVSS::Service
Expand Down Expand Up @@ -31,13 +29,11 @@ def get_states
end
end

private

# overrides EVSS::Service#headers_for_user
def headers_for_user(user)
{
Authorization: "Bearer #{EVSS::Jwt.new(user).encode}"
}
def get_separation_locations
with_monitoring_and_error_handling do
raw_response = perform(:get, 'intakesites')
EVSS::ReferenceData::IntakeSitesResponse.new(raw_response.status, raw_response)
end
end
end
end
Expand Down
11 changes: 0 additions & 11 deletions spec/lib/evss/aws_configuration_spec.rb

This file was deleted.

Loading