diff --git a/config/betamocks/services_config.yml b/config/betamocks/services_config.yml index 2bdf997c445..3e29c582c21 100644 --- a/config/betamocks/services_config.yml +++ b/config/betamocks/services_config.yml @@ -941,6 +941,13 @@ - :name: "GIDS" :base_uri: <%= "#{URI(Settings.gids.url).host}:#{URI(Settings.gids.url).port}" %> :endpoints: + - :method: :get + :path: "/gids/v0/institution_programs" + :file_path: "gids/programs" + # Mock only enabled when filtering by flight programs, see: lib/gi/search_client.rb + :cache_multiple_responses: + :uid_location: query + :uid_locator: type - :method: :get :path: "/gids/v1/lce" :file_path: "gids/lce" diff --git a/config/settings.yml b/config/settings.yml index ae6ac19c385..4f6ede2d0ab 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -489,6 +489,8 @@ gids: url: https://dev.va.gov/gids open_timeout: 1 read_timeout: 1 + search: + use_mocks: false lce: use_mocks: false diff --git a/lib/gi/search_client.rb b/lib/gi/search_client.rb index bdb1528c565..0a57a92c4c5 100644 --- a/lib/gi/search_client.rb +++ b/lib/gi/search_client.rb @@ -14,6 +14,10 @@ def get_institution_search_results_v0(params = {}) end def get_institution_program_search_results_v0(params = {}) + # Mock response if querying for flight school programs + # TO-DO: Remove after flight school program data becomes accessible + config.instance_variable_set(:@program_type_flight, true) if params[:type] == 'FLGT' + response = perform(:get, 'v0/institution_programs', params) gids_response(response) end diff --git a/lib/gi/search_configuration.rb b/lib/gi/search_configuration.rb index f2124999100..63f35628ee8 100644 --- a/lib/gi/search_configuration.rb +++ b/lib/gi/search_configuration.rb @@ -4,5 +4,14 @@ module GI class SearchConfiguration < GI::Configuration self.read_timeout = Settings.gids.search&.read_timeout || 4 self.open_timeout = Settings.gids.search&.open_timeout || 4 + + # Mock response if querying for flight school programs + # TO-DO: Remove after flight school program data becomes accessible + def use_mocks? + return false unless instance_variable_defined?(:@program_type_flight) + + querying_by_flight = remove_instance_variable(:@program_type_flight) + (querying_by_flight && Settings.gids.search.use_mocks) || false + end end end