-
Notifications
You must be signed in to change notification settings - Fork 66
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
EDM-213/build lce interface and mockdata #19178
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6c3c6e3
Create lce client and config
jefftmarks 59d6c8c
Create lce client methods
jefftmarks f79bd3e
Create lce controllers
jefftmarks d75df7e
Update gids redis to respond to lce client
jefftmarks 92bce98
Create routes
jefftmarks bdb4189
Enable mocks
jefftmarks 87693b7
Add gids response to lce client
jefftmarks cdd0108
Fix linting
jefftmarks f4a6e7a
Update gids redis spec
jefftmarks e5fcd73
LCE client spec
jefftmarks 93c7e3a
Condense spec file
jefftmarks e9b8d79
Update codeowners
jefftmarks 91b8acd
Fix linting
jefftmarks 450e10c
Fix typo in spec test
jefftmarks 5184bd5
Fix spec typo
jefftmarks b95bbbe
Fix spec typo
jefftmarks e424012
Fix spec
jefftmarks 9aa8e40
Revert codeowners
jefftmarks 86d7862
Merge branch 'master' into EDM-213/build-lce-interfaces-and-mockdata
jefftmarks 9acd27b
Update services config and settings
jefftmarks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module V1 | ||
module GIDS | ||
module Lce | ||
class CertificationsController < LceController | ||
def show | ||
render json: service.get_certification_details_v1(scrubbed_params) | ||
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module V1 | ||
module GIDS | ||
module Lce | ||
class ExamsController < GIDS::LceController | ||
def show | ||
render json: service.get_exam_details_v1(scrubbed_params) | ||
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module V1 | ||
module GIDS | ||
module Lce | ||
class LicensesController < LceController | ||
def show | ||
render json: service.get_license_details_v1(scrubbed_params) | ||
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module V1 | ||
module GIDS | ||
module Lce | ||
class PrepsController < LceController | ||
def show | ||
render json: service.get_prep_details_v1(scrubbed_params) | ||
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module V1 | ||
module GIDS | ||
class LceController < GIDSController | ||
def index | ||
render json: service.get_lce_search_results_v1(scrubbed_params) | ||
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
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
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
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
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
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,41 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'gi/client' | ||
require_relative 'configuration' | ||
|
||
module GI | ||
module Lce | ||
class Client < GI::Client | ||
configuration GI::Lce::Configuration | ||
|
||
def get_lce_search_results_v1(params = {}) | ||
response = perform(:get, 'v1/lce', params) | ||
gids_response(response) | ||
end | ||
|
||
def get_certification_details_v1(params = {}) | ||
certification_id = params[:id] | ||
response = perform(:get, "v1/lce/certifications/#{certification_id}", params.except(:id)) | ||
gids_response(response) | ||
end | ||
|
||
def get_exam_details_v1(params = {}) | ||
exam_id = params[:id] | ||
response = perform(:get, "v1/lce/exams/#{exam_id}", params.except(:id)) | ||
gids_response(response) | ||
end | ||
|
||
def get_license_details_v1(params = {}) | ||
license_id = params[:id] | ||
response = perform(:get, "v1/lce/licenses/#{license_id}", params.except(:id)) | ||
gids_response(response) | ||
end | ||
|
||
def get_prep_details_v1(params = {}) | ||
prep_id = params[:id] | ||
response = perform(:get, "v1/lce/preps/#{prep_id}", params.except(:id)) | ||
gids_response(response) | ||
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'gi/configuration' | ||
|
||
module GI | ||
module Lce | ||
class Configuration < GI::Configuration | ||
def use_mocks? | ||
Settings.gids.lce.use_mocks || false | ||
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
require 'gi/lce/client' | ||
require 'gi/gids_response' | ||
|
||
# TO-DO: Replace stubbed data with VCR cassettes after GIDS connection established | ||
describe GI::Lce::Client do | ||
let(:client) { GI::Lce::Client.new } | ||
let(:search_data) do | ||
[ | ||
{ | ||
link: 'lce/certifications/1', | ||
name: 'Certification Name', | ||
type: 'certification' | ||
} | ||
] | ||
end | ||
let(:institution) { { name: 'Institution' } } | ||
let(:lcp_data) do | ||
{ | ||
desc: 'License Name', | ||
type: 'license', | ||
tests: [{ name: 'Test Name' }], | ||
institution: institution, | ||
officials: [{ title: 'Certifying Official' }] | ||
} | ||
end | ||
let(:exam_data) do | ||
{ | ||
name: 'Exam Name', | ||
tests: [{ description: 'Description' }], | ||
institution: institution | ||
} | ||
end | ||
|
||
it 'gets a list of licenses, certifications, exams, and prep courses' do | ||
search_response = OpenStruct.new(body: { data: search_data }) | ||
allow(client).to receive(:get_lce_search_results_v1).with(type: 'all').and_return(search_response) | ||
client_response = client.get_lce_search_results_v1(type: 'all').body | ||
expect(client_response[:data]).to be_an(Array) | ||
end | ||
|
||
%w[license certification prep].each do |type| | ||
it "gets #{type} details" do | ||
details_response = OpenStruct.new(body: { data: lcp_data }) | ||
query_method = :"get_#{type}_details_v1" | ||
|
||
allow(client).to receive(query_method).with(id: '1').and_return(details_response) | ||
client_response = client.send(query_method, id: '1').body | ||
expect(client_response[:data]).to be_an(Hash) | ||
expect(client_response[:data].keys).to contain_exactly(:desc, :type, :tests, :institution, :officials) | ||
end | ||
end | ||
|
||
it 'gets exam details' do | ||
details_response = OpenStruct.new(body: { data: exam_data }) | ||
|
||
allow(client).to receive(:get_exam_details_v1).with(id: '1').and_return(details_response) | ||
client_response = client.get_exam_details_v1(id: '1').body | ||
expect(client_response[:data]).to be_an(Hash) | ||
expect(client_response[:data].keys).to contain_exactly(:name, :tests, :institution) | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍