-
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.
- Loading branch information
Showing
9 changed files
with
140 additions
and
5 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
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
17 changes: 17 additions & 0 deletions
17
...sentative_portal/power_of_attorney_request_serializer/accredited_individual_serializer.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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module AccreditedRepresentativePortal | ||
class PowerOfAttorneyRequestSerializer | ||
class AccreditedIndividualSerializer < ApplicationSerializer | ||
attribute :full_name do |poa_holder| | ||
parts = [ | ||
poa_holder.first_name, | ||
poa_holder.middle_initial, | ||
poa_holder.last_name | ||
] | ||
|
||
parts.reject(&:blank?).join(' ') | ||
end | ||
end | ||
end | ||
end |
32 changes: 32 additions & 0 deletions
32
...tative_portal/power_of_attorney_request_serializer/power_of_attorney_holder_serializer.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,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module AccreditedRepresentativePortal | ||
class PowerOfAttorneyRequestSerializer | ||
class PowerOfAttorneyHolderSerializer < ApplicationSerializer | ||
attribute :type do |poa_holder| | ||
case poa_holder | ||
when AccreditedIndividual | ||
"accredited_#{poa_holder.individual_type}" | ||
when AccreditedOrganization | ||
'veteran_service_organization' | ||
end | ||
end | ||
|
||
with_options if: proc { |poa_holder| poa_holder.is_a?(AccreditedOrganization) } do | ||
attribute :name | ||
end | ||
|
||
with_options if: proc { |poa_holder| poa_holder.is_a?(AccreditedIndividual) } do | ||
attribute :full_name do |poa_holder| | ||
parts = [ | ||
poa_holder.first_name, | ||
poa_holder.middle_initial, | ||
poa_holder.last_name | ||
] | ||
|
||
parts.reject(&:blank?).join(' ') | ||
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
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
end | ||
|
||
describe 'GET /accredited_representative_portal/v0/power_of_attorney_requests' do | ||
it 'returns the list of power of attorney requests', skip: 'temporarily for a migration' do | ||
it 'returns the list of power of attorney requests' do | ||
poa_requests | ||
|
||
get('/accredited_representative_portal/v0/power_of_attorney_requests') | ||
|
@@ -88,6 +88,15 @@ | |
'email' => '[email protected]' | ||
} | ||
}, | ||
'power_of_attorney_holder' => { | ||
'id' => poa_requests[0].power_of_attorney_holder.id, | ||
'type' => 'veteran_service_organization', | ||
'name' => poa_requests[0].power_of_attorney_holder.name | ||
}, | ||
'accredited_individual' => { | ||
'id' => poa_requests[0].accredited_individual.id, | ||
'full_name' => "#{poa_requests[0].accredited_individual.first_name} #{poa_requests[0].accredited_individual.last_name}", | ||
}, | ||
'resolution' => nil | ||
}, | ||
{ | ||
|
@@ -145,6 +154,15 @@ | |
'email' => '[email protected]' | ||
} | ||
}, | ||
'power_of_attorney_holder' => { | ||
'id' => poa_requests[1].power_of_attorney_holder.id, | ||
'type' => 'veteran_service_organization', | ||
'name' => poa_requests[1].power_of_attorney_holder.name | ||
}, | ||
'accredited_individual' => { | ||
'id' => poa_requests[1].accredited_individual.id, | ||
'full_name' => "#{poa_requests[1].accredited_individual.first_name} #{poa_requests[1].accredited_individual.last_name}", | ||
}, | ||
'resolution' => { | ||
'id' => poa_requests[1].resolution.id, | ||
'type' => 'decision', | ||
|
@@ -208,6 +226,15 @@ | |
'email' => '[email protected]' | ||
} | ||
}, | ||
'power_of_attorney_holder' => { | ||
'id' => poa_requests[2].power_of_attorney_holder.id, | ||
'type' => 'veteran_service_organization', | ||
'name' => poa_requests[2].power_of_attorney_holder.name | ||
}, | ||
'accredited_individual' => { | ||
'id' => poa_requests[2].accredited_individual.id, | ||
'full_name' => "#{poa_requests[2].accredited_individual.first_name} #{poa_requests[2].accredited_individual.last_name}", | ||
}, | ||
'resolution' => { | ||
'id' => poa_requests[2].resolution.id, | ||
'type' => 'decision', | ||
|
@@ -272,6 +299,15 @@ | |
'email' => '[email protected]' | ||
} | ||
}, | ||
'power_of_attorney_holder' => { | ||
'id' => poa_requests[3].power_of_attorney_holder.id, | ||
'type' => 'veteran_service_organization', | ||
'name' => poa_requests[3].power_of_attorney_holder.name | ||
}, | ||
'accredited_individual' => { | ||
'id' => poa_requests[3].accredited_individual.id, | ||
'full_name' => "#{poa_requests[3].accredited_individual.first_name} #{poa_requests[3].accredited_individual.last_name}", | ||
}, | ||
'resolution' => { | ||
'id' => poa_requests[3].resolution.id, | ||
'type' => 'expiration', | ||
|
@@ -284,7 +320,7 @@ | |
end | ||
|
||
describe 'GET /accredited_representative_portal/v0/power_of_attorney_requests/:id' do | ||
it 'returns the details of a specific power of attorney request', skip: 'temporarily for a migration' do | ||
it 'returns the details of a specific power of attorney request' do | ||
get("/accredited_representative_portal/v0/power_of_attorney_requests/#{poa_request.id}") | ||
|
||
parsed_response = JSON.parse(response.body) | ||
|
@@ -353,6 +389,15 @@ | |
'creator_id' => poa_request.resolution.resolving.creator_id, | ||
'reason' => 'Didn\'t authorize treatment record disclosure', | ||
'decision_type' => 'declination' | ||
}, | ||
'power_of_attorney_holder' => { | ||
'id' => poa_request.power_of_attorney_holder.id, | ||
'type' => 'veteran_service_organization', | ||
'name' => poa_request.power_of_attorney_holder.name | ||
}, | ||
'accredited_individual' => { | ||
'id' => poa_request.accredited_individual.id, | ||
'full_name' => "#{poa_request.accredited_individual.first_name} #{poa_request.accredited_individual.last_name}", | ||
} | ||
} | ||
) | ||
|