-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bdex/54508: intent to file get abstraction (#12427)
* Initial creation of common files between GET and POST endpoint migration work * Correct response abstraction file name; Add remaining abstraction functions * intent to file post abstraction * fix flipper placements * fix tests * fixes to swagger_spec.rb * rubocop fix * unit test fix --------- Co-authored-by: mchae-nava <129200156+mchae-nava@users.noreply.github.com> Co-authored-by: Seth Darr <seth.darr@agile6.com> Co-authored-by: Seth Darr <92405130+sethdarragile6@users.noreply.github.com>
- Loading branch information
1 parent
2579f14
commit d21a0af
Showing
17 changed files
with
188 additions
and
4 deletions.
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
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
20 changes: 20 additions & 0 deletions
20
lib/disability_compensation/providers/intent_to_file/evss_intent_to_file_provider.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,20 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'disability_compensation/providers/intent_to_file/intent_to_file_provider' | ||
require 'disability_compensation/responses/intent_to_files_response' | ||
require 'evss/intent_to_file/service' | ||
|
||
class EvssIntentToFileProvider | ||
include IntentToFileProvider | ||
def initialize(current_user) | ||
@service = EVSS::IntentToFile::Service.new(current_user) | ||
end | ||
|
||
def get_intent_to_file | ||
@service.get_intent_to_file | ||
end | ||
|
||
def create_intent_to_file(type) | ||
@service.create_intent_to_file(type) | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
lib/disability_compensation/providers/intent_to_file/intent_to_file_provider.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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module IntentToFileProvider | ||
def self.get_intent_to_file | ||
raise NotImplementedError, 'Do not use base module methods. Override this method in implementation class.' | ||
end | ||
|
||
def self.create_intent_to_file(type) | ||
raise NotImplementedError, 'Do not use base module methods. Override this method in implementation class.' | ||
end | ||
end |
1 change: 1 addition & 0 deletions
1
lib/disability_compensation/providers/intent_to_file/lighthouse_intent_to_file_provider.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 @@ | ||
# frozen_string_literal: true |
35 changes: 35 additions & 0 deletions
35
lib/disability_compensation/responses/intent_to_files_response.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,35 @@ | ||
# frozen_string_literal: true | ||
|
||
module DisabilityCompensation | ||
module ApiProvider | ||
class IntentToFile | ||
include ActiveModel::Serialization | ||
include Virtus.model | ||
|
||
# The spelling of these status types has been validated with the partner team | ||
STATUS_TYPES = %w[ | ||
active | ||
claim_recieved | ||
duplicate | ||
expired | ||
incomplete | ||
canceled | ||
].freeze | ||
|
||
attribute :id, String | ||
attribute :creation_date, DateTime | ||
attribute :expiration_date, DateTime | ||
attribute :participant_id, Integer | ||
attribute :source, String | ||
attribute :status, String | ||
attribute :type, String | ||
end | ||
|
||
class IntentToFilesResponse | ||
include ActiveModel::Serialization | ||
include Virtus.model | ||
|
||
attribute :intent_to_file, Array[DisabilityCompensation::ApiProvider::IntentToFile] | ||
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
11 changes: 11 additions & 0 deletions
11
...lib/disability_compensation/providers/intent_to_file/evss_intent_to_file_provider_spec.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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
require 'disability_compensation/providers/intent_to_file/evss_intent_to_file_provider' | ||
require 'support/disability_compensation_form/shared_examples/intent_to_file_provider' | ||
|
||
RSpec.describe EvssIntentToFileProvider do | ||
let(:current_user) { build(:disabilities_compensation_user) } | ||
|
||
it_behaves_like 'intent to file provider' | ||
end |
20 changes: 20 additions & 0 deletions
20
spec/lib/disability_compensation/providers/intent_to_file/intent_to_file_provider_spec.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,20 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
require 'disability_compensation/providers/intent_to_file/intent_to_file_provider' | ||
|
||
RSpec.describe IntentToFileProvider do | ||
let(:current_user) { build(:user) } | ||
|
||
it 'always raises an error on the IntentToFileProvider base module - get intent to file' do | ||
expect do | ||
IntentToFileProvider.get_intent_to_file | ||
end.to raise_error NotImplementedError | ||
end | ||
|
||
it 'always raises an error on the IntentToFileProvider base module - create intent to file' do | ||
expect do | ||
IntentToFileProvider.create_intent_to_file('') | ||
end.to raise_error NotImplementedError | ||
end | ||
end |
File renamed without changes.
File renamed without changes.
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
11 changes: 11 additions & 0 deletions
11
spec/support/disability_compensation_form/shared_examples/intent_to_file_provider.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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
shared_examples 'intent to file provider' do | ||
# this is used to instantiate any IntentToFileProvider with a current_user | ||
subject { described_class.new(current_user) } | ||
|
||
it { is_expected.to respond_to(:get_intent_to_file) } | ||
it { is_expected.to respond_to(:create_intent_to_file) } | ||
end |